1 /* 2 * Copyright (c) 2022 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 16 #ifndef HUKS_COMMON_RSA_TEST_COMMON_H 17 #define HUKS_COMMON_RSA_TEST_COMMON_H 18 19 #include <string> 20 #include "huks_three_stage_test_common.h" 21 namespace Unittest::RsaCipher { 22 static const uint32_t RSA_COMMON_SIZE = 1024; 23 static const std::string g_inData_5 = "RSA_5"; 24 static const std::string g_inData_12 = "RSA_12_ttttt"; 25 static const std::string g_inData_14 = "RSA_14_ttttttt"; 26 static const std::string g_inData_20 = "RSA_20_ttttttttttttt"; 27 static const std::string g_inData_32 = "RSA_32_ttttttttttttttttttttttttt"; 28 static const std::string g_inData_64 = "RSA_64_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt"; 29 static const std::string g_inData_96 = "RSA_96_ttttttttttttttttttttttttttttttttttttttttttttttttttttttttt" 30 "tttttttttttttttttttttttttttttttt"; 31 static const std::string g_inData_128 = "RSA_128_tttttttttttttttttttttttttttttttttttttttttttttttttttttttt" 32 "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt"; 33 static const std::string g_inData_256 = "RSA_256_tttttttttttttttttttttttttttttttttttttttttttttttttttttttt" 34 "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt" 35 "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt" 36 "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt"; 37 static const std::string g_inData_384 = "RSA_384_tttttttttttttttttttttttttttttttttttttttttttttttttttttttt" 38 "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt" 39 "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt" 40 "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt" 41 "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt" 42 "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt"; 43 static const std::string g_inData_512 = "RSA_512_tttttttttttttttttttttttttttttttttttttttttttttttttttttttt" 44 "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt" 45 "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt" 46 "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt" 47 "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt" 48 "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt" 49 "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt" 50 "tttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt"; 51 52 OH_Huks_Result HksRsaCipherTestCase(const struct OH_Huks_Blob *keyAlias, struct OH_Huks_ParamSet *genParamSet, 53 struct OH_Huks_ParamSet *encryptParamSet, struct OH_Huks_ParamSet *decryptParamSet, const struct OH_Huks_Blob *inData); 54 OH_Huks_Result HksRsaCipherTestCaseAbnormal(const struct OH_Huks_Blob *keyAlias, struct OH_Huks_ParamSet *genParamSet, 55 struct OH_Huks_ParamSet *encryptParamSet, struct OH_Huks_ParamSet *decryptParamSet, const struct OH_Huks_Blob *inData); 56 OH_Huks_Result HksRsaCipherTestEncrypt(const struct OH_Huks_Blob *keyAlias, const struct OH_Huks_ParamSet *encryptParamSet, 57 const struct OH_Huks_Blob *inData, struct OH_Huks_Blob *cipherText); 58 OH_Huks_Result HksRsaCipherTestEncryptAbnormal(const struct OH_Huks_Blob *keyAlias, const struct OH_Huks_ParamSet *encryptParamSet, 59 const struct OH_Huks_Blob *inData, struct OH_Huks_Blob *cipherText); 60 OH_Huks_Result HksRsaCipherTestDecrypt(const struct OH_Huks_Blob *keyAlias, const struct OH_Huks_ParamSet *decryptParamSet, 61 const struct OH_Huks_Blob *cipherText, struct OH_Huks_Blob *plainText, const struct OH_Huks_Blob *inData); 62 } // namespace Unittest::RsaCipher 63 #endif // HUKS_COMMON_RSA_TEST_COMMON_H