/base/security/huks/test/unittest/huks_standard_test/module_test/utils_test/src/ |
D | hks_client_service_adapter_test.cpp | 101 HksBlob *pubKey = reinterpret_cast<HksBlob *>(HksMalloc(sizeof(HksBlob))); variable 102 pubKey->data = nullptr; 103 ASSERT_EQ(pubKey == nullptr, false) << "pubKey malloc failed."; 104 ret = TranslateToX509PublicKey(pubKey, nullptr); 107 pubKey->data = reinterpret_cast<uint8_t *>(HksMalloc(sizeof(HksBlob))); 108 ASSERT_EQ(pubKey->data == nullptr, false) << "malloc failed."; 109 pubKey->size = 0; 110 ret = TranslateToX509PublicKey(pubKey, nullptr); 113 pubKey->size = sizeof(HksBlob); 114 ret = TranslateToX509PublicKey(pubKey, nullptr); [all …]
|
/base/security/crypto_framework/frameworks/js/napi/crypto/src/ |
D | napi_pub_key.cpp | 29 NapiPubKey::NapiPubKey(HcfPubKey *pubKey) : NapiKey(reinterpret_cast<HcfKey *>(pubKey)) {} in NapiPubKey() argument 77 HcfPubKey *pubKey = napiPubKey->GetPubKey(); in JsGetEncoded() local 78 if (pubKey == nullptr) { in JsGetEncoded() 85 HcfResult res = pubKey->base.getEncoded(&pubKey->base, &returnBlob); in JsGetEncoded() 97 static napi_value GetAsyKeySpecBigInt(napi_env env, AsyKeySpecItem item, HcfPubKey *pubKey) in GetAsyKeySpecBigInt() argument 100 HcfResult res = pubKey->getAsyKeySpecBigInteger(pubKey, item, &returnBigInteger); in GetAsyKeySpecBigInt() 112 static napi_value GetAsyKeySpecNumber(napi_env env, AsyKeySpecItem item, HcfPubKey *pubKey) in GetAsyKeySpecNumber() argument 115 HcfResult res = pubKey->getAsyKeySpecInt(pubKey, item, &returnInt); in GetAsyKeySpecNumber() 127 static napi_value GetAsyKeySpecString(napi_env env, AsyKeySpecItem item, HcfPubKey *pubKey) in GetAsyKeySpecString() argument 130 HcfResult res = pubKey->getAsyKeySpecString(pubKey, item, &returnString); in GetAsyKeySpecString() [all …]
|
D | napi_key_pair.cpp | 54 if (this->keyPair_->pubKey != nullptr) { in ConvertToJsKeyPair() 55 NapiPubKey *napiPubKey = new (std::nothrow) NapiPubKey(this->keyPair_->pubKey); in ConvertToJsKeyPair() 60 napi_value pubKey = napiPubKey->ConvertToJsPubKey(env); in ConvertToJsKeyPair() local 62 env, pubKey, napiPubKey, in ConvertToJsKeyPair() 73 napi_set_named_property(env, instance, CRYPTO_TAG_PUB_KEY.c_str(), pubKey); in ConvertToJsKeyPair()
|
/base/security/crypto_framework/test/unittest/src/ |
D | crypto_rsa_asy_key_generator_by_spec_test.cpp | 978 HcfPubKey *pubKey = nullptr; variable 979 res = generator->generatePubKey(generator, &pubKey); 981 EXPECT_NE(pubKey, nullptr); 983 HcfObjDestroy(pubKey); 1047 HcfPubKey *pubKey = nullptr; variable 1048 res = generator->generatePubKey(generator, &pubKey); 1050 EXPECT_NE(pubKey, nullptr); 1052 HcfObjDestroy(pubKey); 1148 const char *pkClassName = keyPair->pubKey->base.base.getClass(); 1174 keyPair->pubKey->base.base.destroy(&(keyPair->pubKey->base.base)); [all …]
|
D | crypto_ecc_asy_key_generator_by_spec_test.cpp | 1235 HcfPubKey *pubKey = nullptr; variable 1236 res = generator->generatePubKey(generator, &pubKey); 1239 ASSERT_NE(pubKey, nullptr); 1241 HcfObjDestroy(pubKey); 1304 HcfPubKey *pubKey = nullptr; variable 1305 res = generator->generatePubKey(generator, &pubKey); 1308 ASSERT_NE(pubKey, nullptr); 1310 HcfObjDestroy(pubKey); 1437 HcfPubKey *pubKey = nullptr; variable 1438 res = generator->generatePubKey(generator, &pubKey); [all …]
|
D | crypto_dsa_asy_key_generator_test.cpp | 135 HcfResult ret = keyPair->pubKey->base.getEncoded(&(keyPair->pubKey->base), pkBlob); in GetKeyEncodedTest() 321 const char *pkClassName = dsa2048KeyPair_->pubKey->base.base.getClass(); 340 keyPair->pubKey->base.base.destroy(&(keyPair->pubKey->base.base)); 341 keyPair->pubKey = nullptr; 347 dsa2048KeyPair_->pubKey->base.base.destroy(nullptr); 348 dsa2048KeyPair_->pubKey->base.base.destroy((HcfObjectBase *)&g_obj); 350 const char *alg = dsa2048KeyPair_->pubKey->base.getAlgorithm(&(dsa2048KeyPair_->pubKey->base)); 356 const char *alg = dsa2048KeyPair_->pubKey->base.getAlgorithm(nullptr); 362 const char *alg = dsa2048KeyPair_->pubKey->base.getAlgorithm((HcfKey *)&g_obj); 369 … HcfResult ret = dsa2048KeyPair_->pubKey->base.getEncoded(&(dsa2048KeyPair_->pubKey->base), &blob); [all …]
|
D | crypto_sm2_asy_key_generator_test.cpp | 354 const char *className = keyPair->pubKey->base.base.getClass(); 372 keyPair->pubKey->base.base.destroy((HcfObjectBase *)(&(keyPair->pubKey->base.base))); 373 keyPair->pubKey = nullptr; 390 keyPair->pubKey->base.base.destroy(nullptr); 407 const char *format = keyPair->pubKey->base.getFormat(&(keyPair->pubKey->base)); 426 const char *format = keyPair->pubKey->base.getFormat(nullptr); 445 const char *algName = keyPair->pubKey->base.getAlgorithm(&(keyPair->pubKey->base)); 464 const char *algName = keyPair->pubKey->base.getAlgorithm(nullptr); 484 res = keyPair->pubKey->base.getEncoded(&(keyPair->pubKey->base), &blob); 508 res = keyPair->pubKey->base.getEncoded(nullptr, &blob); [all …]
|
/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/alg_module_test/src/ |
D | openssl_dh_helper.c | 48 const BIGNUM *pubKey = NULL; in DhSaveKeyMaterial() local 50 DH_get0_key(dh, &pubKey, &privKey); in DhSaveKeyMaterial() 51 const uint32_t rawMaterialLen = sizeof(struct KeyMaterialDh) + (uint32_t)BN_num_bytes(pubKey) + in DhSaveKeyMaterial() 61 keyMaterial->pubKeySize = BN_num_bytes(pubKey); in DhSaveKeyMaterial() 66 BN_bn2bin(pubKey, rawMaterial + offset); in DhSaveKeyMaterial() 125 BIGNUM *pubKey = BN_bin2bn(key->data + offset, keyMaterial->pubKeySize, NULL); in InitDhStruct() local 129 if (DH_set0_key(dh, pubKey, privKey) != 1) { in InitDhStruct() 130 if (pubKey != NULL) { in InitDhStruct() 131 BN_free(pubKey); in InitDhStruct() 144 …const int keyLen, const struct HksBlob *nativeKey, const struct HksBlob *pubKey, struct HksBlob *s… in DhAgreeKey() argument [all …]
|
/base/security/crypto_framework/plugin/openssl_plugin/key/asy_key_generator/src/ |
D | dsa_asy_key_generator_openssl.c | 135 DestroyDsaPubKey((HcfObjectBase *)impl->base.pubKey); in DestroyDsaKeyPair() 136 impl->base.pubKey = NULL; in DestroyDsaKeyPair() 453 static HcfResult CreateDsaKeyPair(const HcfOpensslDsaPubKey *pubKey, const HcfOpensslDsaPriKey *pri… in CreateDsaKeyPair() argument 463 keyPair->base.pubKey = (HcfPubKey *)pubKey; in CreateDsaKeyPair() 607 BIGNUM *pubKey = NULL; in GenerateOpensslDsaKeyByPubKeySpec() local 608 if (BigIntegerToBigNum(&(paramsSpec->pk), &pubKey) != HCF_SUCCESS) { in GenerateOpensslDsaKeyByPubKeySpec() 613 if (CreateOpensslDsaKey(&(paramsSpec->base), pubKey, NULL, returnDsa) != HCF_SUCCESS) { in GenerateOpensslDsaKeyByPubKeySpec() 614 Openssl_BN_free(pubKey); in GenerateOpensslDsaKeyByPubKeySpec() 622 BIGNUM *pubKey = NULL; in GenerateOpensslDsaKeyByKeyPairSpec() local 624 if (BigIntegerToBigNum(&(paramsSpec->pk), &pubKey) != HCF_SUCCESS) { in GenerateOpensslDsaKeyByKeyPairSpec() [all …]
|
D | sm2_asy_key_generator_openssl.c | 125 if (impl->base.pubKey != NULL) { in DestroySm2KeyPair() 126 DestroySm2PubKey((HcfObjectBase *)impl->base.pubKey); in DestroySm2KeyPair() 127 impl->base.pubKey = NULL; in DestroySm2KeyPair() 307 static HcfResult PackSm2KeyPair(HcfOpensslSm2PubKey *pubKey, HcfOpensslSm2PriKey *priKey, in PackSm2KeyPair() argument 317 returnKeyPair->base.pubKey = (HcfPubKey *)pubKey; in PackSm2KeyPair() 379 HcfOpensslSm2PubKey *pubKey = NULL; in EngineConvertSm2Key() local 384 ret = ConvertEcPubKey(impl->curveId, pubKeyBlob, &pubKey); in EngineConvertSm2Key() 395 ret = PackSm2KeyPair(pubKey, priKey, &keyPair); in EngineConvertSm2Key() 398 HcfObjDestroy(pubKey); in EngineConvertSm2Key() 421 HcfOpensslSm2PubKey *pubKey = NULL; in CreateAndAssignKeyPair() local [all …]
|
D | rsa_asy_key_generator_openssl.c | 285 if (impl->base.pubKey != NULL) { in DestroyKeyPair() 286 DestroyPubKey((HcfObjectBase *)impl->base.pubKey); in DestroyKeyPair() 287 impl->base.pubKey = NULL; in DestroyKeyPair() 554 static HcfResult DuplicatePkAndSkFromRSA(RSA *rsa, RSA **pubKey, RSA **priKey) in DuplicatePkAndSkFromRSA() argument 560 if (DuplicateRsa(rsa, false, pubKey) != HCF_SUCCESS) { in DuplicatePkAndSkFromRSA() 566 Openssl_RSA_free(*pubKey); in DuplicatePkAndSkFromRSA() 567 *pubKey = NULL; in DuplicatePkAndSkFromRSA() 579 RSA *pubKey = NULL, *priKey = NULL; in PackKeyPair() local 580 if (DuplicatePkAndSkFromRSA(rsa, &pubKey, &priKey) != HCF_SUCCESS) { in PackKeyPair() 588 Openssl_RSA_free(pubKey); in PackKeyPair() [all …]
|
/base/security/huks/frameworks/huks_standard/main/crypto_engine/openssl/src/ |
D | hks_openssl_dh.c | 75 BIGNUM *pubKey = BN_bin2bn(key->data + offset, keyMaterial->pubKeySize, NULL); in InitDhStruct() local 79 if (DH_set0_key(dh, pubKey, privKey) != HKS_OPENSSL_SUCCESS) { in InitDhStruct() 91 const BIGNUM *pubKey = NULL; in DhSaveKeyMaterial() local 93 DH_get0_key(dh, &pubKey, &privKey); in DhSaveKeyMaterial() 94 const uint32_t rawMaterialLen = sizeof(struct KeyMaterialDh) + (uint32_t)BN_num_bytes(pubKey) in DhSaveKeyMaterial() 104 keyMaterial->pubKeySize = (uint32_t)BN_num_bytes(pubKey); in DhSaveKeyMaterial() 109 BN_bn2bin(pubKey, rawMaterial + offset); in DhSaveKeyMaterial() 166 int32_t HksOpensslDhAgreeKey(const struct HksBlob *nativeKey, const struct HksBlob *pubKey, in HksOpensslDhAgreeKey() argument 174 struct KeyMaterialDh *pubKeyMaterial = (struct KeyMaterialDh *)pubKey->data; in HksOpensslDhAgreeKey() 175 …BIGNUM *pub = BN_bin2bn(pubKey->data + sizeof(struct KeyMaterialDh), pubKeyMaterial->pubKeySize, N… in HksOpensslDhAgreeKey()
|
/base/security/huks/frameworks/huks_standard/main/crypto_engine/mbedtls/src/ |
D | hks_mbedtls_ecdh.c | 43 const struct HksBlob *pubKey, mbedtls_ecdh_context *ctx) in EccKeyMaterialToCtx() argument 45 int32_t ret = HksEccKeyMaterialToPub(pubKey, &(ctx->Qp)); in EccKeyMaterialToCtx() 55 const struct HksBlob *pubKey, const struct HksKeySpec *spec, struct HksBlob *sharedKey) in HksMbedtlsEcdh() argument 57 int32_t ret = EccKeyCheck(pubKey); in HksMbedtlsEcdh() 82 ret = EccKeyMaterialToCtx(nativeKey, pubKey, &ctx); in HksMbedtlsEcdh()
|
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() 64 keyMaterial->pubKeySize = pubKey->size; in SaveEd25519KeyMaterial() 69 if (memcpy_s(buffer + offset, totalSize - offset, pubKey->data, pubKey->size) != EOK) { in SaveEd25519KeyMaterial() 76 offset += pubKey->size; in SaveEd25519KeyMaterial() 102 uint8_t pubKey[ED25519_PUBLIC_KEY_LEN] = {0}; in HksEd25519GenerateKey() local 104 struct HksBlob pubKeyBlob = { ED25519_PUBLIC_KEY_LEN, pubKey }; in HksEd25519GenerateKey()
|
/base/security/crypto_framework/test/fuzztest/key/asykeygenerator_fuzzer/ |
D | asykeygenerator_fuzzer.cpp | 575 (void)keyPair->pubKey->base.getEncoded(&(keyPair->pubKey->base), &pubKeyBlob); in TestRsaKey() 580 HcfPubKey *pubKey = dupKeyPair->pubKey; in TestRsaKey() local 581 (void)pubKey->base.getAlgorithm(&(pubKey->base)); in TestRsaKey() 582 (void)pubKey->base.getFormat(&(pubKey->base)); in TestRsaKey() 583 (void)pubKey->base.base.getClass(); in TestRsaKey() 607 (void)keyPair->pubKey->base.getEncoded(&(keyPair->pubKey->base), &pubKeyBlob); in TestDsaKey() 612 HcfPubKey *pubKey = dupKeyPair->pubKey; in TestDsaKey() local 613 (void)pubKey->base.getAlgorithm(&(pubKey->base)); in TestDsaKey() 614 (void)pubKey->base.getFormat(&(pubKey->base)); in TestDsaKey() 615 (void)pubKey->base.base.getClass(); in TestDsaKey() [all …]
|
/base/security/certificate_framework/frameworks/js/napi/certificate/src/ |
D | napi_pub_key.cpp | 29 NapiPubKey::NapiPubKey(HcfPubKey *pubKey) : NapiKey(reinterpret_cast<HcfKey *>(pubKey)) {} in NapiPubKey() argument 80 HcfPubKey *pubKey = napiPubKey->GetPubKey(); in JsGetEncoded() local 82 HcfResult res = pubKey->base.getEncoded(&pubKey->base, &returnBlob); in JsGetEncoded()
|
/base/security/huks/frameworks/huks_standard/main/crypto_engine/mbedtls/include/ |
D | hks_mbedtls_x25519.h | 38 const struct HksBlob *pubKey, const struct HksKeySpec *spec, struct HksBlob *sharedKey); 47 const struct HksBlob *pubKey, const struct HksKeySpec *spec, struct HksBlob *sharedKey);
|
/base/security/huks/utils/crypto_adapter/ |
D | hks_client_service_adapter_lite.c | 161 mbedtls_ecp_keypair *pubKey = mbedtls_pk_ec(*ctx); in InitEccPkCtx() 162 ret = mbedtls_ecp_group_load(&(pubKey->MBEDTLS_PRIVATE(grp)), grp_id); in InitEccPkCtx() 168 … ret = mbedtls_mpi_read_binary(&(pubKey->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(X)), x->data, x->size); in InitEccPkCtx() 174 … ret = mbedtls_mpi_read_binary(&(pubKey->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(Y)), y->data, y->size); in InitEccPkCtx() 181 ret = mbedtls_mpi_lset(&(pubKey->MBEDTLS_PRIVATE(Q).MBEDTLS_PRIVATE(Z)), 1); in InitEccPkCtx() 357 static int32_t X509PublicKeyToEcc(mbedtls_ecp_keypair *pubKey, struct HksBlob *eccPublicKey) in X509PublicKeyToEcc() argument 360 uint32_t xSize = mbedtls_mpi_size(&(pubKey->MBEDTLS_PRIVATE(grp).P)); in X509PublicKeyToEcc() 361 uint32_t ySize = mbedtls_mpi_size(&(pubKey->MBEDTLS_PRIVATE(grp).P)); in X509PublicKeyToEcc() 371 if (mbedtls_mpi_size(&(pubKey->MBEDTLS_PRIVATE(grp).P)) > UINT32_MAX / HKS_BITS_PER_BYTE) { in X509PublicKeyToEcc() 373 …HKS_LOG_E("invalid param, the size is :%" LOG_PUBLIC "u", mbedtls_mpi_size(&(pubKey->MBEDTLS_PRIVA… in X509PublicKeyToEcc() [all …]
|
/base/security/huks/test/unittest/huks_standard_test/crypto_engine_test/src/ |
D | hks_crypto_hal_dsa_sign.cpp | 119 … struct HksBlob pubKey = { .size = PUB_KEY_SIZE, .data = (uint8_t *)HksMalloc(PUB_KEY_SIZE) }; in RunTestCase() local 120 ASSERT_NE(pubKey.data, nullptr); in RunTestCase() 122 EXPECT_EQ(HksCryptoHalGetPubKey(&key, &pubKey), HKS_SUCCESS); in RunTestCase() 124 EXPECT_EQ(HksCryptoHalVerify(&pubKey, &hksUsageSpec, &hash, &signature), HKS_SUCCESS); in RunTestCase() 129 HksFree(pubKey.data); in RunTestCase()
|
/base/update/updater/services/package/pkg_verify/ |
D | openssl_util.cpp | 142 EVP_PKEY *pubKey = X509_get_pubkey(issuerCert); in VerifyX509CertByIssuerCert() local 143 if (pubKey == nullptr) { in VerifyX509CertByIssuerCert() 148 bool ret = (X509_verify(cert, pubKey) == 1); in VerifyX509CertByIssuerCert() 149 EVP_PKEY_free(pubKey); in VerifyX509CertByIssuerCert() 153 int32_t VerifyDigestByPubKey(EVP_PKEY *pubKey, const int nid, const std::vector<uint8_t> &digestDat… in VerifyDigestByPubKey() argument 157 if (pubKey == nullptr) { in VerifyDigestByPubKey() 170 if (EVP_DigestVerifyInit(mdCtx, &pkeyCtx, EVP_get_digestbynid(nid), nullptr, pubKey) != 1) { in VerifyDigestByPubKey()
|
/base/security/certificate_framework/frameworks/adapter/v2.0/src/ |
D | cf_adapter_cert_openssl.c | 128 int32_t CfOpensslVerifyCert(const CfBase *certObj, const CfBlob *pubKey) in CfOpensslVerifyCert() argument 131 (void)pubKey; in CfOpensslVerifyCert() 202 EVP_PKEY *pubKey = (EVP_PKEY *)X509_get_pubkey(certObj->x509Cert); in GetCertPubKey() local 203 if (pubKey == NULL) { in GetCertPubKey() 210 int32_t pubKeyLen = i2d_PUBKEY(pubKey, &pubKeyBytes); in GetCertPubKey() 212 EVP_PKEY_free(pubKey); in GetCertPubKey() 219 EVP_PKEY_free(pubKey); in GetCertPubKey()
|
/base/security/huks/frameworks/huks_standard/main/crypto_engine/openssl/include/ |
D | hks_openssl_curve25519.h | 33 int32_t HksOpensslX25519AgreeKey(const struct HksBlob *nativeKey, const struct HksBlob *pubKey, 36 int32_t HksOpensslEd25519AgreeKey(const struct HksBlob *nativeKey, const struct HksBlob *pubKey,
|
/base/update/updater/services/package/pkg_algorithm/ |
D | pkg_algo_sign.cpp | 135 EVP_PKEY *pubKey = X509_get_pubkey(rcert); in VerifyDigest() local 136 if (pubKey == nullptr) { in VerifyDigest() 142 int ret = VerifyDigestByPubKey(pubKey, nid, digest, signature); in VerifyDigest() 144 EVP_PKEY_free(pubKey); in VerifyDigest() 149 EVP_PKEY_free(pubKey); in VerifyDigest()
|
/base/security/huks/test/fuzz_test/innerapi_fuzzer/hksexportpublickey_fuzzer/ |
D | hksexportpublickey_fuzzer.cpp | 42 struct HksBlob pubKey = { BLOB_SIZE, static_cast<uint8_t *>(myData + BLOB_SIZE) }; in DoSomethingInterestingWithMyAPI() local 47 (void)HksExportPublicKey(&keyAlias, paramSet, &pubKey); in DoSomethingInterestingWithMyAPI()
|
/base/security/huks/test/fuzz_test/innerapi_fuzzer/hksimportkey_fuzzer/ |
D | hksimportkey_fuzzer.cpp | 42 struct HksBlob pubKey = { BLOB_SIZE, static_cast<uint8_t *>(myData + BLOB_SIZE) }; in DoSomethingInterestingWithMyAPI() local 47 (void)HksImportKey(&keyAlias, paramSet, &pubKey); in DoSomethingInterestingWithMyAPI()
|