/ohos5.0/base/update/sys_installer_lite/frameworks/source/verify/ |
H A D | app_rsa.c | 22 void AppRsaInit(AppRsaContext *rsa) in AppRsaInit() argument 24 if (rsa == NULL) { in AppRsaInit() 27 mbedtls_pk_init(&rsa->context); in AppRsaInit() 31 int32 AppRsaDecodePublicKey(AppRsaContext *rsa, const uint8 *publicKey, uint32 length) in AppRsaDecodePublicKey() argument 33 if ((rsa == NULL) || (publicKey == NULL)) { in AppRsaDecodePublicKey() 37 int32 parseRet = mbedtls_pk_parse_public_key(&rsa->context, publicKey, length); in AppRsaDecodePublicKey() 55 if (!mbedtls_pk_can_do(&(rsa->context), MBEDTLS_PK_RSA)) { in AppVerifyData() 60 mbedtls_rsa_set_padding(mbedtls_pk_rsa(rsa->context), MBEDTLS_RSA_PKCS_V21, MBEDTLS_MD_SHA256); in AppVerifyData() 71 void AppRsaFree(AppRsaContext *rsa) in AppRsaFree() argument 73 if (rsa == NULL) { in AppRsaFree() [all …]
|
H A D | app_rsa.h | 37 void AppRsaInit(AppRsaContext *rsa); 42 int32 AppRsaDecodePublicKey(AppRsaContext *rsa, const uint8 *publicKey, uint32 length); 47 int32 AppVerifyData(AppRsaContext *rsa, const uint8 *plainBuf, uint32 plainBufLen, const uint8 *cip… 53 void AppRsaFree(AppRsaContext *rsa);
|
H A D | hota_verify.c | 105 AppRsaContext rsa; in HotaSignVerifyByHash() local 111 AppRsaInit(&rsa); in HotaSignVerifyByHash() 117 int ret = AppRsaDecodePublicKey(&rsa, keyBuf, length); in HotaSignVerifyByHash() 122 ret = AppVerifyData(&rsa, hash, hashLen, imageSign, signLen); in HotaSignVerifyByHash() 123 AppRsaFree(&rsa); in HotaSignVerifyByHash()
|
/ohos5.0/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/alg_module_test/src/ |
H A D | openssl_rsa_helper.c | 76 if (rsa == NULL) { in GenerateRsaKey() 82 RSA_free(rsa); in GenerateRsaKey() 90 RSA_free(rsa); in GenerateRsaKey() 96 RSA_free(rsa); in GenerateRsaKey() 134 if (rsa == NULL) { in X509ToRsaPublicKey() 193 if (rsa != NULL) { in InitRsa() 200 if (rsa == NULL) { in InitRsa() 213 return rsa; in InitRsa() 240 if (rsa == NULL) { in EncryptRsa() 245 RSA_free(rsa); in EncryptRsa() [all …]
|
/ohos5.0/base/security/crypto_framework/plugin/openssl_plugin/common/src/ |
H A D | rsa_openssl_common.c | 20 static RSA *DuplicateRsaPriKeyForSpec(const RSA *rsa) in DuplicateRsaPriKeyForSpec() argument 30 OpensslRsaGet0Key(rsa, &n, &e, &d); in DuplicateRsaPriKeyForSpec() 58 HcfResult DuplicateRsa(RSA *rsa, bool needPrivate, RSA **dupRsa) in DuplicateRsa() argument 61 if (rsa == NULL || dupRsa == NULL) { in DuplicateRsa() 66 retRSA = OpensslRsaPrivateKeyDup(rsa); in DuplicateRsa() 69 retRSA = DuplicateRsaPriKeyForSpec(rsa); in DuplicateRsa() 72 retRSA = OpensslRsaPublicKeyDup(rsa); in DuplicateRsa() 83 EVP_PKEY *NewEvpPkeyByRsa(RSA *rsa, bool withDuplicate) in NewEvpPkeyByRsa() argument 85 if (rsa == NULL) { in NewEvpPkeyByRsa() 96 if (OpensslEvpPkeySet1Rsa(pKey, rsa) != HCF_OPENSSL_SUCCESS) { in NewEvpPkeyByRsa() [all …]
|
H A D | openssl_adapter.c | 686 void OpensslRsaFree(RSA *rsa) in OpensslRsaFree() argument 688 RSA_free(rsa); in OpensslRsaFree() 691 int OpensslRsaGenerateMultiPrimeKey(RSA *rsa, int bits, int primes, in OpensslRsaGenerateMultiPrimeKey() argument 694 return RSA_generate_multi_prime_key(rsa, bits, primes, e, cb); in OpensslRsaGenerateMultiPrimeKey() 699 return RSA_generate_key_ex(rsa, bits, e, cb); in OpensslRsaGenerateKeyEx() 702 int OpensslRsaBits(const RSA *rsa) in OpensslRsaBits() argument 704 return RSA_bits(rsa); in OpensslRsaBits() 737 RSA *OpensslRsaPublicKeyDup(RSA *rsa) in OpensslRsaPublicKeyDup() argument 739 return RSAPublicKey_dup(rsa); in OpensslRsaPublicKeyDup() 742 RSA *OpensslRsaPrivateKeyDup(RSA *rsa) in OpensslRsaPrivateKeyDup() argument [all …]
|
/ohos5.0/base/security/huks/frameworks/huks_standard/main/crypto_engine/openssl/src/ |
H A D | hks_openssl_rsa.c | 127 RSA *rsa = NULL; in InitRsaStruct() local 133 rsa = RSA_new(); in InitRsaStruct() 134 if (rsa != NULL) { in InitRsaStruct() 138 rsa = NULL; in InitRsaStruct() 144 if (rsa == NULL) { in InitRsaStruct() 152 return rsa; in InitRsaStruct() 236 RSA *rsa = RSA_new(); in HksOpensslRsaGenerateKey() 253 RSA_free(rsa); in HksOpensslRsaGenerateKey() 260 RSA_free(rsa); in HksOpensslRsaGenerateKey() 322 RSA_free(rsa); in InitEvpPkeyCtx() [all …]
|
/ohos5.0/base/security/huks/frameworks/crypto_lite/cipher/src/ |
H A D | cipher_rsa.c | 131 mbedtls_rsa_context *rsa = NULL; in RsaLoadPrivateKey() local 150 rsa = mbedtls_pk_rsa(*pk); in RsaLoadPrivateKey() 151 if (rsa == NULL) { in RsaLoadPrivateKey() 181 mbedtls_rsa_context *rsa = NULL; in RsaLoadPublicKey() local 195 rsa = mbedtls_pk_rsa(*pk); in RsaLoadPublicKey() 196 if (rsa == NULL) { in RsaLoadPublicKey() 201 if (mbedtls_rsa_check_pubkey(rsa)) { in RsaLoadPublicKey() 267 int32_t rsaLen = mbedtls_rsa_get_len(rsa); in RsaEncryptMultipleBlock() 336 if (rsa == NULL) { in RsaEncrypt() 341 size_t rsaLen = mbedtls_rsa_get_len(rsa); in RsaEncrypt() [all …]
|
/ohos5.0/base/security/crypto_framework/plugin/openssl_plugin/key/asy_key_generator/src/ |
H A D | rsa_asy_key_generator_openssl.c | 374 *rsa = tempRsa; in ConvertPubKeyFromX509() 394 *rsa = tmpRsa; in ConvertPriKeyFromPKCS8() 818 if (rsa == NULL) { in DuplicatePkAndSkFromRSA() 909 if (rsa == NULL) { in GenerateKeyPair() 1231 RSA *rsa = NULL; in InitRsaStructByBin() local 1235 return rsa; in InitRsaStructByBin() 1238 if (rsa == NULL) { in InitRsaStructByBin() 1243 return rsa; in InitRsaStructByBin() 1254 rsa = NULL; in InitRsaStructByBin() 1255 return rsa; in InitRsaStructByBin() [all …]
|
/ohos5.0/docs/zh-cn/application-dev/reference/apis-crypto-architecture-kit/ |
H A D | js-apis-system-cipher.md | 29 调用cipher rsa方法时,传入的参数。 62 ## cipher.rsa 64 rsa(options: CipherRsaOptions): void 74 | options | [CipherRsaOptions](#cipherrsaoptions) | 是 | rsa加解密需要设置的参数。 | 80 rsa() { 81 cipher.rsa({ 96 console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`); 102 cipher.rsa({ 129 console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`); 173 console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`);
|
/ohos5.0/base/update/sys_installer_lite/frameworks/test/unittest/common/src/ |
H A D | ota_test.cpp | 415 AppRsaContext rsa; variable 418 AppRsaInit(&rsa); 423 int ret = AppRsaDecodePublicKey(&rsa, keyBuf, length); 424 AppRsaFree(&rsa); 432 AppRsaContext rsa; variable 434 AppRsaInit(&rsa); 439 int ret = AppRsaDecodePublicKey(&rsa, keyBuf, length); 446 ret = AppVerifyData(&rsa, imageHashLocal, HASH_LENGTH, 448 AppRsaFree(&rsa);
|
/ohos5.0/docs/zh-cn/application-dev/security/CryptoArchitectureKit/ |
H A D | Readme-CN.md | 51 - [使用RSA非对称密钥(PKCS1模式)加解密](crypto-rsa-asym-encrypt-decrypt-pkcs1.md) 52 - [使用RSA非对称密钥分段加解密](crypto-rsa-asym-encrypt-decrypt-by-segment.md) 53 - [使用RSA非对称密钥(PKCS1_OAEP模式)加解密](crypto-rsa-asym-encrypt-decrypt-pkcs1_oaep.md) 59 - [使用RSA密钥对(PKCS1模式)签名验签(ArkTS)](crypto-rsa-sign-sig-verify-pkcs1.md) 60 - [使用RSA密钥对(PKCS1模式)验签(C/C++)](crypto-rsa-sign-sig-verify-pkcs1-ndk.md) 61 - [使用RSA密钥对(PKCS1模式)签名及签名恢复(ArkTS)](crypto-rsa-sign-sig-verify-recover-pkcs1.md) 62 - [使用RSA密钥对(PKCS1模式)签名恢复(C/C++)](crypto-rsa-sign-sig-verify-recover-pkcs1-ndk.md) 63 - [使用RSA密钥对分段签名验签(PKCS1模式)(ArkTS)](crypto-rsa-sign-sig-verify-pkcs1-by-segment.md) 64 - [使用RSA密钥对分段验签(PKCS1模式)(C/C++)](crypto-rsa-sign-sig-verify-pkcs1-by-segment-ndk.md) 65 - [使用RSA密钥对签名验签(PSS模式)(ArkTS)](crypto-rsa-sign-sig-verify-pss.md) [all …]
|
H A D | crypto-rsa-sign-sig-verify-pkcs1.md | 4 对应的算法规格请查看[签名验签算法规格:RSA](crypto-sign-sig-verify-overview.md#rsa)。 12 …如何生成RSA非对称密钥,开发者可参考下文示例,并结合[非对称密钥生成和转换规格:RSA](crypto-asym-key-generation-conversion-spec.md#rsa)和[… 23 - 当数据量较大时,可以多次调用update,即[分段签名验签](crypto-rsa-sign-sig-verify-pkcs1-by-segment.md)。 39 - 当数据量较大时,可以多次调用update,即[分段签名验签](crypto-rsa-sign-sig-verify-pkcs1-by-segment.md)。
|
H A D | crypto-encrypt-decrypt-by-segment.md | 27 - RSA:填充模式不同,输入的数据的规则不同。请根据[RSA算法规格](crypto-asym-encrypt-decrypt-spec.md#rsa)确认单次传入的数据量长度。 32 **开发示例:** [使用RSA非对称密钥分段加解密](crypto-rsa-asym-encrypt-decrypt-by-segment.md)
|
/ohos5.0/base/update/updater/services/package/pkg_algorithm/ |
H A D | pkg_algo_sign.cpp | 54 RSA *rsa = PEM_read_bio_RSAPrivateKey(in, nullptr, nullptr, nullptr); in SignBuffer() local 56 if (rsa == nullptr) { in SignBuffer() 62 uint32_t size = static_cast<uint32_t>(RSA_size(rsa)); in SignBuffer() 66 ret = RSA_sign(NID_sha256, buffer.buffer, buffer.length, sign.data(), &size, rsa); in SignBuffer() 68 ret = RSA_sign(NID_sha384, buffer.buffer, buffer.length, sign.data(), &size, rsa); in SignBuffer() 71 RSA_free(rsa); in SignBuffer()
|
/ohos5.0/docs/en/application-dev/reference/apis-crypto-architecture-kit/ |
H A D | js-apis-system-cipher.md | 29 Defines the input parameters of **cipher.rsa()**. 62 ## cipher.rsa 64 rsa(options: CipherRsaOptions): void 80 rsa() { 81 cipher.rsa({ 96 console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`); 102 cipher.rsa({ 129 console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`); 173 console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`);
|
/ohos5.0/docs/en/application-dev/security/CryptoArchitectureKit/ |
H A D | Readme-EN.md | 51 …- [Encryption and Decryption with an RSA Asymmetric Key Pair (PKCS1)](crypto-rsa-asym-encrypt-decr… 52 …- [Encryption and Decryption by Segment with an RSA Asymmetric Key Pair](crypto-rsa-asym-encrypt-d… 53 …- [Encryption and Decryption with an RSA Asymmetric Key Pair (PKCS1_OAEP)](crypto-rsa-asym-encrypt… 59 …- [Signing and Signature Verification with an RSA Key Pair (PKCS1 Mode) (ArkTS)](crypto-rsa-sign-s… 60 …- [Signature Verification with an RSA Key Pair (PKCS1 Mode) (C/C++)](crypto-rsa-sign-sig-verify-pk… 61 …- [Signing and Signature Recovery Using an RSA Key Pair (PKCS1 Mode) (ArkTS)](crypto-rsa-sign-sig-… 62 …- [Signature Recovery Using an RSA Key Pair (PKCS1 Mode) (C/C++)](crypto-rsa-sign-sig-verify-recov… 63 … Verification by Segment with an RSA Key Pair (PKCS1 Mode) (ArkTS)](crypto-rsa-sign-sig-verify-pkc… 64 …- [Signature Verification by Segment with an RSA Key Pair (PKCS1 Mode) (C/C++)](crypto-rsa-sign-si… 65 …- [Signing and Signature Verification with an RSA Key Pair (PSS Mode) (ArkTS)](crypto-rsa-sign-sig… [all …]
|
H A D | crypto-rsa-sign-sig-verify-pkcs1.md | 4 For details about the algorithm specifications, see [RSA](crypto-sign-sig-verify-overview.md#rsa). 12 …example in this topic, [RSA](crypto-asym-key-generation-conversion-spec.md#rsa) and [Randomly Gene… 23 … call **Sign.update()** multiple times to [pass in data by segment](crypto-rsa-sign-sig-verify-pkc… 38 …all **Verify.update()** multiple times to [pass in data by segment](crypto-rsa-sign-sig-verify-pkc…
|
/ohos5.0/base/security/crypto_framework/plugin/openssl_plugin/common/inc/ |
H A D | rsa_openssl_common.h | 30 HcfResult DuplicateRsa(RSA *rsa, bool needPrivate, RSA **dupRsa); 32 EVP_PKEY *NewEvpPkeyByRsa(RSA *rsa, bool withDuplicate);
|
H A D | openssl_adapter.h | 192 void OpensslRsaFree(RSA *rsa); 193 int OpensslRsaGenerateMultiPrimeKey(RSA *rsa, int bits, int primes, 195 int OpensslRsaGenerateKeyEx(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb); 196 int OpensslRsaBits(const RSA *rsa); 203 RSA *OpensslRsaPublicKeyDup(RSA *rsa); 204 RSA *OpensslRsaPrivateKeyDup(RSA *rsa);
|
/ohos5.0/base/security/certificate_manager/services/cert_manager_standard/cert_manager_engine/main/core/src/ |
H A D | cert_manager_app_cert_process.c | 139 static int32_t SaveKeyMaterialRsa(const RSA *rsa, const uint32_t keySize, struct CmBlob *keyOut) in SaveKeyMaterialRsa() argument 157 keyMaterial->nSize = (uint32_t)BN_bn2bin(RSA_get0_n(rsa), tmpBuff); in SaveKeyMaterialRsa() 164 keyMaterial->eSize = (uint32_t)BN_bn2bin(RSA_get0_e(rsa), tmpBuff); in SaveKeyMaterialRsa() 171 keyMaterial->dSize = (uint32_t)BN_bn2bin(RSA_get0_d(rsa), tmpBuff); in SaveKeyMaterialRsa() 238 const RSA *rsa = EVP_PKEY_get0_RSA((EVP_PKEY *)priKey); in ImportRsaKey() local 239 if (rsa == NULL) { in ImportRsaKey() 244 uint32_t keySize = ((uint32_t)RSA_size(rsa)) * CM_BITS_PER_BYTE; in ImportRsaKey() 246 ret = SaveKeyMaterialRsa(rsa, keySize, &keyPair); in ImportRsaKey()
|
/ohos5.0/base/security/huks/utils/crypto_adapter/ |
H A D | hks_client_service_adapter.c | 82 RSA *rsa = NULL; in RsaToX509PublicKey() local 90 rsa = RSA_new(); in RsaToX509PublicKey() 91 HKS_IF_NULL_LOGE_BREAK(rsa, "rsa is null") in RsaToX509PublicKey() 98 if (RSA_set0_key(rsa, rsaN, rsaE, NULL) == 0) { in RsaToX509PublicKey() 106 if (EVP_PKEY_set1_RSA(pkey, rsa) == 0) { in RsaToX509PublicKey() 113 SELF_FREE_PTR(rsa, RSA_free) in RsaToX509PublicKey() 453 const RSA *rsa = EVP_PKEY_get0_RSA(pkey); in X509PublicKeyToRsa() local 454 HKS_IF_NULL_LOGE_RETURN(rsa, HKS_ERROR_NULL_POINTER, in X509PublicKeyToRsa() 457 int nSize = BN_num_bytes(RSA_get0_n(rsa)); in X509PublicKeyToRsa() 458 int eSize = BN_num_bytes(RSA_get0_e(rsa)); in X509PublicKeyToRsa() [all …]
|
/ohos5.0/base/security/crypto_framework/test/unittest/src/ |
H A D | openssl_adapter_mock.c | 1087 void OpensslRsaFree(RSA *rsa) in OpensslRsaFree() argument 1089 if (rsa != NULL) { in OpensslRsaFree() 1090 RSA_free(rsa); in OpensslRsaFree() 1097 return RSA_generate_multi_prime_key(rsa, bits, primes, e, cb); in OpensslRsaGenerateMultiPrimeKey() 1102 return RSA_generate_key_ex(rsa, bits, e, cb); in OpensslRsaGenerateKeyEx() 1105 int OpensslRsaBits(const RSA *rsa) in OpensslRsaBits() argument 1107 return RSA_bits(rsa); in OpensslRsaBits() 1140 RSA *OpensslRsaPublicKeyDup(RSA *rsa) in OpensslRsaPublicKeyDup() argument 1142 return RSAPublicKey_dup(rsa); in OpensslRsaPublicKeyDup() 1145 RSA *OpensslRsaPrivateKeyDup(RSA *rsa) in OpensslRsaPrivateKeyDup() argument [all …]
|
/ohos5.0/foundation/communication/dsoftbus/core/adapter/huks/src/ |
H A D | softbus_rsa_encrypt.c | 200 static int32_t EncryptByPublicKey(const uint8_t *src, uint32_t srcLen, const RSA *rsa, uint8_t *out… in EncryptByPublicKey() argument 202 …if (src == NULL || srcLen == 0 || rsa == NULL || out == NULL || outLen < SOFTBUS_RSA_ENCRYPT_LEN) { in EncryptByPublicKey() 213 const BIGNUM *modNum = RSA_get0_n(rsa); in EncryptByPublicKey() 214 const BIGNUM *exp = RSA_get0_e(rsa); in EncryptByPublicKey()
|
/ohos5.0/base/security/crypto_framework/plugin/openssl_plugin/crypto_operation/cipher/src/ |
H A D | cipher_rsa_openssl.c | 91 RSA *rsa = NULL; in InitEvpPkeyCtx() local 93 ret = DuplicateRsaFromKey(key, opMode, &rsa); in InitEvpPkeyCtx() 98 EVP_PKEY *pkey = NewEvpPkeyByRsa(rsa, false); in InitEvpPkeyCtx() 102 OpensslRsaFree(rsa); in InitEvpPkeyCtx()
|