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_STRINGUTILS_H
16#define SIGNATRUETOOLS_STRINGUTILS_H
17
18#include <string>
19#include <vector>
20#include <sstream>
21
22#include "openssl/pem.h"
23#include "openssl/x509.h"
24#include "signature_tools_log.h"
25#include "verify_hap_openssl_utils.h"
26
27namespace OHOS {
28namespace SignatureTools {
29class StringUtils {
30public:
31    StringUtils() = delete;
32    static bool IsEmpty(const std::string& cs);
33    static bool ContainsCase(const std::vector<std::string> &strs, const std::string& str);
34    static bool CaseCompare(const std::string& str1, const std::string& str2);
35    static std::vector<std::string> SplitString(const std::string& str, char delimiter);
36    static std::string Trim(const std::string& str);
37    static std::string FormatLoading(std::string& dealStr);
38    static std::string Pkcs7ToString(PKCS7* p7);
39    static std::string x509CertToString(X509* cert);
40    static std::string SubjectToString(X509* cert);
41    static bool CheckStringToint(const std::string& in, int& out);
42};
43} // namespace SignatureTools
44} // namespace OHOS
45#endif // SIGNATRUETOOLS_STRINGUTILS_H