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 SIGNATRUETOOLS_CERTUTILS_H 16#define SIGNATRUETOOLS_CERTUTILS_H 17 18#include <string> 19#include <sstream> 20#include <vector> 21#include <utility> 22 23#include "openssl/ossl_typ.h" 24#include "openssl/x509.h" 25#include "openssl/x509v3.h" 26#include "string_utils.h" 27#include "signature_tools_errno.h" 28#include "signature_tools_log.h" 29 30using std::pair; 31using std::istringstream; 32using std::getline; 33 34namespace OHOS { 35namespace SignatureTools { 36/** 37* buildDN 38* 39* @param nameString nameString 40* @return X500Name 41*/ 42X509_NAME* BuildDN(const std::string &nameString, X509_REQ* req); 43/** 44* To verify the format of subject or issuer. 45* Refer to X509_NAMEStyle.fromstring(). 46* 47* @param nameString subject or issuer 48*/ 49int g_checkDn(const std::string &nameString, std::vector<pair<std::string, std::string>>& pairs); 50} // namespace SignatureTools 51} // namespace OHOS 52#endif // SIGNATRUETOOLS_CERTUTILS_H