1 /* 2 * Copyright (c) 2024-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef SIGNATURETOOLS_CMS_UTILS_H 16 #define SIGNATURETOOLS_CMS_UTILS_H 17 18 #include <vector> 19 #include <string> 20 #include <sstream> 21 22 #include "signature_tools_log.h" 23 #include "pkcs7_data.h" 24 25 namespace OHOS { 26 namespace SignatureTools { 27 class CmsUtils { 28 public: 29 static bool VerifySignDataWithUnsignedDataDigest(const std::vector<int8_t>& unsignedDataDigest, 30 const std::vector<int8_t>& signedData); 31 static bool CheckOwnerID(const std::string& signature, const std::string& profileOwnerID, 32 const std::string& profileType); 33 static int CreateNIDFromOID(const std::string& oid, const std::string& shortName, 34 const std::string& longName); 35 private: 36 CmsUtils(); 37 }; 38 } // namespace SignatureTools 39 } // namespace OHOS 40 #endif // SIGNATURETOOLS_CMS_UTILS_H