/base/security/crypto_framework/frameworks/js/napi/crypto/src/ |
D | napi_pri_key.cpp | 29 NapiPriKey::NapiPriKey(HcfPriKey *priKey) : NapiKey(reinterpret_cast<HcfKey *>(priKey)) {} in NapiPriKey() argument 77 HcfPriKey *priKey = napiPriKey->GetPriKey(); in JsGetEncoded() local 78 if (priKey == nullptr) { in JsGetEncoded() 85 HcfResult res = priKey->base.getEncoded(&priKey->base, &returnBlob); in JsGetEncoded() 109 HcfPriKey *priKey = napiPriKey->GetPriKey(); in JsClearMem() local 110 if (priKey == nullptr) { in JsClearMem() 116 priKey->clearMem(priKey); in JsClearMem() 120 static napi_value GetAsyKeySpecBigInt(napi_env env, AsyKeySpecItem item, HcfPriKey *priKey) in GetAsyKeySpecBigInt() argument 123 HcfResult res = priKey->getAsyKeySpecBigInteger(priKey, item, &returnBigInteger); in GetAsyKeySpecBigInt() 135 static napi_value GetAsyKeySpecNumber(napi_env env, AsyKeySpecItem item, HcfPriKey *priKey) in GetAsyKeySpecNumber() argument [all …]
|
D | napi_key_pair.cpp | 76 if (this->keyPair_->priKey != nullptr) { in ConvertToJsKeyPair() 77 NapiPriKey *napiPriKey = new (std::nothrow) NapiPriKey(this->keyPair_->priKey); in ConvertToJsKeyPair() 82 napi_value priKey = napiPriKey->ConvertToJsPriKey(env); in ConvertToJsKeyPair() local 84 env, priKey, napiPriKey, in ConvertToJsKeyPair() 96 napi_set_named_property(env, instance, CRYPTO_TAG_PRI_KEY.c_str(), priKey); in ConvertToJsKeyPair()
|
D | napi_asy_key_generator.cpp | 59 HcfBlob *priKey = nullptr; member 105 HcfBlobDataFree(ctx->priKey); in FreeConvertKeyCtx() 106 HcfFree(ctx->priKey); in FreeConvertKeyCtx() 156 HcfBlob *priKey = nullptr; in GetPkAndSkBlobFromNapiValueIfInput() local 158 priKey = GetBlobFromNapiValue(env, skValue); in GetPkAndSkBlobFromNapiValueIfInput() 159 if (priKey == nullptr) { in GetPkAndSkBlobFromNapiValueIfInput() 166 *returnPriKey = priKey; in GetPkAndSkBlobFromNapiValueIfInput() 191 HcfBlob *priKey = nullptr; in BuildConvertKeyCtx() local 192 if (!GetPkAndSkBlobFromNapiValueIfInput(env, argv[PARAM0], argv[PARAM1], &pubKey, &priKey)) { in BuildConvertKeyCtx() 199 ctx->priKey = priKey; in BuildConvertKeyCtx() [all …]
|
/base/security/crypto_framework/test/unittest/src/ |
D | crypto_ecc_asy_key_generator_by_spec_test.cpp | 1258 HcfPriKey *priKey = nullptr; variable 1259 res = generator->generatePriKey(generator, &priKey); 1262 ASSERT_NE(priKey, nullptr); 1264 HcfObjDestroy(priKey); 1327 HcfPriKey *priKey = nullptr; variable 1328 res = generator->generatePriKey(generator, &priKey); 1331 ASSERT_NE(priKey, nullptr); 1333 HcfObjDestroy(priKey); 1461 HcfPriKey *priKey = nullptr; variable 1462 res = generator->generatePriKey(generator, &priKey); [all …]
|
D | crypto_rsa_asy_key_generator_by_spec_test.cpp | 1000 HcfPriKey *priKey = nullptr; variable 1001 res = generator->generatePriKey(generator, &priKey); 1003 EXPECT_EQ(priKey, nullptr); 1005 HcfObjDestroy(priKey); 1070 HcfPriKey *priKey = nullptr; variable 1071 res = generator->generatePriKey(generator, &priKey); 1073 EXPECT_NE(priKey, nullptr); 1075 HcfObjDestroy(priKey); 1342 const char *skClassName = keyPair->priKey->base.base.getClass(); 1367 keyPair->priKey->base.base.destroy(&(keyPair->priKey->base.base)); [all …]
|
D | crypto_ecc_no_length_sign_test.cpp | 498 res = sign->init(sign, nullptr, ecc224KeyPair_->priKey); 513 res = sign->init(sign, nullptr, ecc224KeyPair_->priKey); 528 res = sign->init(sign, nullptr, ecc224KeyPair_->priKey); 543 res = sign->init(sign, nullptr, ecc224KeyPair_->priKey); 558 res = sign->init(sign, nullptr, ecc224KeyPair_->priKey); 573 res = sign->init(sign, nullptr, ecc256KeyPair_->priKey); 588 res = sign->init(sign, nullptr, ecc256KeyPair_->priKey); 603 res = sign->init(sign, nullptr, ecc256KeyPair_->priKey); 618 res = sign->init(sign, nullptr, ecc256KeyPair_->priKey); 633 res = sign->init(sign, nullptr, ecc256KeyPair_->priKey); [all …]
|
D | crypto_ecc_sign_test.cpp | 523 res = sign->init(sign, nullptr, ecc224KeyPair_->priKey); 538 res = sign->init(sign, nullptr, ecc224KeyPair_->priKey); 553 res = sign->init(sign, nullptr, ecc224KeyPair_->priKey); 568 res = sign->init(sign, nullptr, ecc224KeyPair_->priKey); 583 res = sign->init(sign, nullptr, ecc224KeyPair_->priKey); 598 res = sign->init(sign, nullptr, ecc256KeyPair_->priKey); 613 res = sign->init(sign, nullptr, ecc256KeyPair_->priKey); 628 res = sign->init(sign, nullptr, ecc256KeyPair_->priKey); 643 res = sign->init(sign, nullptr, ecc256KeyPair_->priKey); 658 res = sign->init(sign, nullptr, ecc256KeyPair_->priKey); [all …]
|
D | crypto_dsa_asy_key_generator_test.cpp | 139 ret = keyPair->priKey->base.getEncoded(&(keyPair->priKey->base), skBlob); in GetKeyEncodedTest() 477 const char *skClassName = dsa2048KeyPair_->priKey->base.base.getClass(); 496 keyPair->priKey->base.base.destroy(&(keyPair->priKey->base.base)); 497 keyPair->priKey = nullptr; 503 const char *alg = dsa2048KeyPair_->priKey->base.getAlgorithm(&(dsa2048KeyPair_->priKey->base)); 510 … HcfResult ret = dsa2048KeyPair_->priKey->base.getEncoded(&(dsa2048KeyPair_->priKey->base), &blob); 520 … const char *skFormat = dsa2048KeyPair_->priKey->base.getFormat(&(dsa2048KeyPair_->priKey->base)); 527 …HcfResult ret = dsa2048KeyPair_->priKey->getAsyKeySpecBigInteger(dsa2048KeyPair_->priKey, DSA_P_BN… 538 …HcfResult ret = dsa2048KeyPair_->priKey->getAsyKeySpecBigInteger(dsa2048KeyPair_->priKey, DSA_Q_BN… 549 …HcfResult ret = dsa2048KeyPair_->priKey->getAsyKeySpecBigInteger(dsa2048KeyPair_->priKey, DSA_G_BN… [all …]
|
D | crypto_sm2_asy_key_generator_test.cpp | 548 keyPair->priKey->clearMem(keyPair->priKey); 565 keyPair->priKey->clearMem(nullptr); 582 const char *algName = keyPair->priKey->base.base.getClass(); 601 keyPair->priKey->base.base.destroy((HcfObjectBase *)(&(keyPair->priKey->base.base))); 602 keyPair->priKey = nullptr; 619 keyPair->priKey->base.base.destroy(nullptr); 636 const char *format = keyPair->priKey->base.getFormat(&keyPair->priKey->base); 655 const char *format = keyPair->priKey->base.getFormat(nullptr); 674 const char *algName = keyPair->priKey->base.getAlgorithm(&keyPair->priKey->base); 693 const char *algName = keyPair->priKey->base.getAlgorithm(nullptr); [all …]
|
D | crypto_ecc_asy_key_generator_test.cpp | 799 keyPair->priKey->clearMem(keyPair->priKey); 816 keyPair->priKey->clearMem(nullptr); 833 keyPair->priKey->clearMem((HcfPriKey *)&g_obj); 850 const char *algName = keyPair->priKey->base.base.getClass(); 869 keyPair->priKey->base.base.destroy((HcfObjectBase *)(&(keyPair->priKey->base.base))); 870 keyPair->priKey = nullptr; 887 keyPair->priKey->base.base.destroy(nullptr); 904 keyPair->priKey->base.base.destroy(&g_obj); 921 const char *format = keyPair->priKey->base.getFormat(&keyPair->priKey->base); 940 const char *format = keyPair->priKey->base.getFormat(nullptr); [all …]
|
D | crypto_rsa_asy_key_generator_test.cpp | 400 EXPECT_NE(keyPair->priKey, nullptr); 411 HcfPriKey *prikey = keyPair->priKey; 432 EXPECT_NE(keyPair->priKey, nullptr); 443 HcfPriKey *prikey = keyPair->priKey; 465 HcfPriKey *priKey = keyPair->priKey; variable 467 res = pubKey->base.getEncoded((HcfKey *)priKey, &pubKeyBlob); 469 res = priKey->base.getEncoded((HcfKey *)pubKey, &priKeyBlob); 486 HcfPriKey *priKey = keyPair->priKey; variable 488 res = pubKey->base.getEncoded((HcfKey *)priKey, nullptr); 490 res = priKey->base.getEncoded((HcfKey *)pubKey, nullptr); [all …]
|
D | crypto_sm2_sign_test.cpp | 248 res = sign->init(sign, nullptr, sm2256KeyPair_->priKey); 263 res = sign->init(nullptr, nullptr, sm2256KeyPair_->priKey); 278 res = sign->init(sign, nullptr, sm2256KeyPair_->priKey); 282 res = sign->init(sign, nullptr, sm2256KeyPair_->priKey); 312 res = sign->init(sign, nullptr, sm2256KeyPair_->priKey); 331 res = sign->init(sign, nullptr, sm2256KeyPair_->priKey); 365 res = sign->init(sign, nullptr, sm2256KeyPair_->priKey); 384 res = sign->init(sign, nullptr, sm2256KeyPair_->priKey); 407 res = sign->init(sign, nullptr, sm2256KeyPair_->priKey); 430 res = sign->init(sign, nullptr, sm2256KeyPair_->priKey); [all …]
|
D | crypto_ecc_key_agreement_test.cpp | 313 …res = keyAgreement->generateSecret(keyAgreement, ecc224KeyPair_->priKey, ecc224KeyPair_->pubKey, &… 332 …res = keyAgreement->generateSecret(keyAgreement, ecc256KeyPair_->priKey, ecc256KeyPair_->pubKey, &… 351 …res = keyAgreement->generateSecret(keyAgreement, ecc384KeyPair_->priKey, ecc384KeyPair_->pubKey, &… 370 …res = keyAgreement->generateSecret(keyAgreement, ecc521KeyPair_->priKey, ecc521KeyPair_->pubKey, &… 389 … res = keyAgreement->generateSecret(nullptr, ecc256KeyPair_->priKey, ecc256KeyPair_->pubKey, &out); 407 …res = keyAgreement->generateSecret((HcfKeyAgreement *)(&obj), ecc256KeyPair_->priKey, ecc256KeyPai… 443 …res = keyAgreement->generateSecret(keyAgreement, ecc256KeyPair_->priKey, (HcfPubKey *)(&obj), &out… 478 …res = keyAgreement->generateSecret(keyAgreement, ecc256KeyPair_->priKey, ecc256KeyPair_->pubKey, n… 519 ecc256KeyPair_->priKey, ecc256KeyPair_->pubKey, &out); 557 res = spiObj->engineGenerateSecret(spiObj, ecc256KeyPair_->priKey, (HcfPubKey *)&obj, &out); [all …]
|
D | crypto_dsa_asy_key_generator_by_spec_test.cpp | 352 keyPair->priKey->clearMem(keyPair->priKey); 370 keyPair->priKey->clearMem(keyPair->priKey); 681 const char *skClassName = keyPair->priKey->base.base.getClass(); 699 keyPair->priKey->base.base.destroy(&(keyPair->priKey->base.base)); 700 keyPair->priKey = nullptr; 718 const char *alg = keyPair->priKey->base.getAlgorithm(&(keyPair->priKey->base)); 738 ret = keyPair->priKey->base.getEncoded(&(keyPair->priKey->base), &blob); 759 const char *pkFormat = keyPair->priKey->base.getFormat(&(keyPair->priKey->base)); 778 ret = keyPair->priKey->getAsyKeySpecBigInteger(keyPair->priKey, DSA_P_BN, &p); 800 ret = keyPair->priKey->getAsyKeySpecBigInteger(keyPair->priKey, DSA_Q_BN, &q); [all …]
|
D | crypto_rsa_asy_key_generator_by_spec_cov_test.cpp | 353 HcfPriKey *priKey = nullptr; variable 354 res = spiObj->engineGeneratePriKeyBySpec(spiObj, nullptr, &priKey); 356 EXPECT_EQ(priKey, nullptr); 381 HcfPriKey *priKey = nullptr; variable 382 …engineGeneratePriKeyBySpec(spiObj, reinterpret_cast<HcfAsyKeyParamsSpec *>(&rsaPairSpec), &priKey); 384 EXPECT_EQ(priKey, nullptr); 409 HcfPriKey *priKey = nullptr; variable 410 …engineGeneratePriKeyBySpec(spiObj, reinterpret_cast<HcfAsyKeyParamsSpec *>(&rsaPairSpec), &priKey); 412 EXPECT_EQ(priKey, nullptr); 435 HcfPriKey *priKey = nullptr; variable [all …]
|
/base/security/certificate_manager/services/cert_manager_standard/cert_manager_engine/main/core/src/ |
D | cert_manager_app_cert_process.c | 228 static int32_t ImportRsaKey(const EVP_PKEY *priKey, const struct CmBlob *keyUri) in ImportRsaKey() argument 233 const RSA *rsa = EVP_PKEY_get0_RSA((EVP_PKEY *)priKey); in ImportRsaKey() 266 static int32_t ImportEccKey(const EVP_PKEY *priKey, const struct CmBlob *keyUri) in ImportEccKey() argument 271 const EC_KEY *eccKey = EVP_PKEY_get0_EC_KEY((EVP_PKEY *)priKey); in ImportEccKey() 305 static int32_t ImportEd25519Key(const EVP_PKEY *priKey, const struct CmBlob *keyUri) in ImportEd25519Key() argument 308 int32_t ret = SaveKeyMaterialCurve25519(HKS_ALG_ED25519, priKey, &keyPair); in ImportEd25519Key() 331 static int32_t ImportKeyPair(const EVP_PKEY *priKey, const struct CmBlob *keyUri) in ImportKeyPair() argument 333 switch (EVP_PKEY_base_id(priKey)) { in ImportKeyPair() 335 return ImportRsaKey(priKey, keyUri); in ImportKeyPair() 337 return ImportEccKey(priKey, keyUri); in ImportKeyPair() [all …]
|
/base/security/crypto_framework/plugin/openssl_plugin/key/asy_key_generator/src/ |
D | sm2_asy_key_generator_openssl.c | 129 if (impl->base.priKey != NULL) { in DestroySm2KeyPair() 130 DestroySm2PriKey((HcfObjectBase *)impl->base.priKey); in DestroySm2KeyPair() 131 impl->base.priKey = NULL; in DestroySm2KeyPair() 307 static HcfResult PackSm2KeyPair(HcfOpensslSm2PubKey *pubKey, HcfOpensslSm2PriKey *priKey, in PackSm2KeyPair() argument 318 returnKeyPair->base.priKey = (HcfPriKey *)priKey; in PackSm2KeyPair() 380 HcfOpensslSm2PriKey *priKey = NULL; in EngineConvertSm2Key() local 390 ret = ConvertEcPriKey(impl->curveId, priKeyBlob, &priKey); in EngineConvertSm2Key() 395 ret = PackSm2KeyPair(pubKey, priKey, &keyPair); in EngineConvertSm2Key() 399 HcfObjDestroy(priKey); in EngineConvertSm2Key() 415 HcfOpensslSm2PriKey *priKey = NULL; in CreateAndAssignKeyPair() local [all …]
|
D | dsa_asy_key_generator_openssl.c | 137 DestroyDsaPriKey((HcfObjectBase *)impl->base.priKey); in DestroyDsaKeyPair() 138 impl->base.priKey = NULL; in DestroyDsaKeyPair() 453 …ic HcfResult CreateDsaKeyPair(const HcfOpensslDsaPubKey *pubKey, const HcfOpensslDsaPriKey *priKey, in CreateDsaKeyPair() argument 464 keyPair->base.priKey = (HcfPriKey *)priKey; in CreateDsaKeyPair() 623 BIGNUM *priKey = NULL; in GenerateOpensslDsaKeyByKeyPairSpec() local 628 if (BigIntegerToBigNum(&(paramsSpec->sk), &priKey) != HCF_SUCCESS) { in GenerateOpensslDsaKeyByKeyPairSpec() 633 if (CreateOpensslDsaKey(&(paramsSpec->base), pubKey, priKey, returnDsa) != HCF_SUCCESS) { in GenerateOpensslDsaKeyByKeyPairSpec() 635 Openssl_BN_free(priKey); in GenerateOpensslDsaKeyByKeyPairSpec() 660 HcfOpensslDsaPriKey *priKey = NULL; in CreateDsaKeyPairByCommSpec() local 661 if (CreateDsaPriKey(dsa, &priKey) != HCF_SUCCESS) { in CreateDsaKeyPairByCommSpec() [all …]
|
D | rsa_asy_key_generator_openssl.c | 289 if (impl->base.priKey != NULL) { in DestroyKeyPair() 290 DestroyPriKey((HcfObjectBase *)impl->base.priKey); in DestroyKeyPair() 291 impl->base.priKey = NULL; in DestroyKeyPair() 554 static HcfResult DuplicatePkAndSkFromRSA(RSA *rsa, RSA **pubKey, RSA **priKey) in DuplicatePkAndSkFromRSA() argument 564 if (DuplicateRsa(rsa, true, priKey) != HCF_SUCCESS) { in DuplicatePkAndSkFromRSA() 579 RSA *pubKey = NULL, *priKey = NULL; in PackKeyPair() local 580 if (DuplicatePkAndSkFromRSA(rsa, &pubKey, &priKey) != HCF_SUCCESS) { in PackKeyPair() 589 Openssl_RSA_free(priKey); in PackKeyPair() 599 ret = PackPriKey(priKey, &priKeyImpl); in PackKeyPair() 604 (*retKeyPair)->base.priKey = (HcfPriKey *)priKeyImpl; in PackKeyPair() [all …]
|
D | ecc_asy_key_generator_openssl.c | 405 static HcfResult InitEcKeyByPriKey(const HcfBigInteger *priKey, EC_KEY *ecKey) in InitEcKeyByPriKey() argument 408 if (BigIntegerToBigNum(priKey, &sk) != HCF_SUCCESS) { in InitEcKeyByPriKey() 422 static HcfResult SetEcPubKeyFromPriKey(const HcfBigInteger *priKey, EC_KEY *ecKey) in SetEcPubKeyFromPriKey() argument 430 if (BigIntegerToBigNum(priKey, &sk) != HCF_SUCCESS) { in SetEcPubKeyFromPriKey() 458 static HcfResult SetEcKey(const HcfPoint *pubKey, const HcfBigInteger *priKey, EC_KEY *ecKey) in SetEcKey() argument 468 if (priKey != NULL) { in SetEcKey() 469 res = InitEcKeyByPriKey(priKey, ecKey); in SetEcKey() 475 res = SetEcPubKeyFromPriKey(priKey, ecKey); in SetEcKey() 663 if (impl->base.priKey != NULL) { in DestroyEccKeyPair() 664 DestroyEccPriKey((HcfObjectBase *)impl->base.priKey); in DestroyEccKeyPair() [all …]
|
/base/security/huks/frameworks/huks_standard/main/crypto_engine/mbedtls/src/ |
D | hks_crypto_ed25519.c | 54 static int32_t SaveEd25519KeyMaterial(const struct HksBlob *pubKey, const struct HksBlob *priKey, in SaveEd25519KeyMaterial() argument 57 uint32_t totalSize = sizeof(struct KeyMaterial25519) + pubKey->size + priKey->size; in SaveEd25519KeyMaterial() 65 keyMaterial->priKeySize = priKey->size; in SaveEd25519KeyMaterial() 77 if (memcpy_s(buffer + offset, totalSize - offset, priKey->data, priKey->size) != EOK) { in SaveEd25519KeyMaterial() 103 uint8_t priKey[ED25519_PRIVATE_KEY_LEN] = {0}; in HksEd25519GenerateKey() local 105 struct HksBlob priKeyBlob = { ED25519_PRIVATE_KEY_LEN, priKey }; in HksEd25519GenerateKey()
|
/base/security/crypto_framework/plugin/openssl_plugin/crypto_operation/key_agreement/src/ |
D | ecdh_openssl.c | 138 static HcfResult EngineGenerateSecret(HcfKeyAgreementSpi *self, HcfPriKey *priKey, in EngineGenerateSecret() argument 141 if ((self == NULL) || (priKey == NULL) || (pubKey == NULL) || (returnSecret == NULL)) { in EngineGenerateSecret() 146 (!IsClassMatch((HcfObjectBase *)priKey, HCF_OPENSSL_ECC_PRI_KEY_CLASS)) || in EngineGenerateSecret() 151 EVP_PKEY *priPKey = NewPKeyByEccPriKey((HcfOpensslEccPriKey *)priKey); in EngineGenerateSecret()
|
/base/security/crypto_framework/interfaces/innerkits/key/ |
D | key_pair.h | 27 HcfPriKey *priKey; member
|
/base/security/crypto_framework/test/fuzztest/key/asykeygenerator_fuzzer/ |
D | asykeygenerator_fuzzer.cpp | 576 (void)keyPair->priKey->base.getEncoded(&(keyPair->priKey->base), &priKeyBlob); in TestRsaKey() 608 (void)keyPair->priKey->base.getEncoded(&(keyPair->priKey->base), &priKeyBlob); in TestDsaKey() 629 HcfPriKey *priKey = nullptr; in GenEccKeyBySpec() local 656 (void)generator->generatePriKey(generator, &priKey); in GenEccKeyBySpec() 660 HcfObjDestroy(priKey); in GenEccKeyBySpec() 682 HcfPriKey *priKey = nullptr; in GenRsaKeyBySpec() local 706 (void)generator->generatePriKey(generator, &priKey); in GenRsaKeyBySpec() 710 HcfObjDestroy(priKey); in GenRsaKeyBySpec() 725 HcfPriKey *priKey = nullptr; in GenDsaKeyBySpec() local 748 (void)generator->generatePriKey(generator, &priKey); in GenDsaKeyBySpec() [all …]
|
/base/security/crypto_framework/frameworks/spi/ |
D | key_agreement_spi.h | 29 HcfResult (*engineGenerateSecret)(HcfKeyAgreementSpi *self, HcfPriKey *priKey,
|