Home
last modified time | relevance | path

Searched refs:x509Key (Results 1 – 18 of 18) sorted by relevance

/base/security/huks/test/unittest/huks_standard_test/module_test/utils_test/src/
Dhks_client_service_adapter_test.cpp71 HksBlob *x509Key = reinterpret_cast<HksBlob *>(HksMalloc(sizeof(HksBlob))); variable
72 x509Key->data = nullptr;
73 ASSERT_EQ(x509Key == nullptr, false) << "x509Key malloc failed.";
74 ret = TranslateFromX509PublicKey(HKS_ALG_RSA, x509Key, nullptr);
77 x509Key->data = reinterpret_cast<uint8_t *>(HksMalloc(sizeof(HksBlob)));
78 ASSERT_EQ(x509Key->data == nullptr, false) << "malloc failed.";
79 x509Key->size = 0;
80 ret = TranslateFromX509PublicKey(HKS_ALG_RSA, x509Key, nullptr);
83 x509Key->size = sizeof(HksBlob);
84 ret = TranslateFromX509PublicKey(HKS_ALG_RSA, x509Key, nullptr);
[all …]
/base/security/huks/utils/crypto_adapter/
Dhks_client_service_adapter_lite.c45 static int32_t PkCtxToX509(mbedtls_pk_context *ctx, struct HksBlob *x509Key) in PkCtxToX509() argument
74 x509Key->size = x509Size; in PkCtxToX509()
75 x509Key->data = x509KeyData; in PkCtxToX509()
128 …2_t RsaToX509PublicKey(const struct HksBlob *mod, const struct HksBlob *e, struct HksBlob *x509Key) in RsaToX509PublicKey() argument
138 ret = PkCtxToX509(&ctx, x509Key); in RsaToX509PublicKey()
191 struct HksBlob *x509Key) in EccToX509PublicKey() argument
201 ret = PkCtxToX509(&ctx, x509Key); in EccToX509PublicKey()
212 static int32_t Curve25519ToX509PublicKey(const struct HksBlob *publicKey, struct HksBlob *x509Key) in Curve25519ToX509PublicKey() argument
219 x509Key->data = (uint8_t *)HksMalloc(publicKey->size); in Curve25519ToX509PublicKey()
220 HKS_IF_NULL_LOGE_RETURN(x509Key->data, HKS_ERROR_MALLOC_FAIL, in Curve25519ToX509PublicKey()
[all …]
Dhks_client_service_adapter.c54 static int32_t EvpKeyToX509Format(EVP_PKEY *pkey, struct HksBlob *x509Key) in EvpKeyToX509Format() argument
74 x509Key->size = keyLength; in EvpKeyToX509Format()
75 x509Key->data = key; in EvpKeyToX509Format()
80 …2_t RsaToX509PublicKey(const struct HksBlob *mod, const struct HksBlob *e, struct HksBlob *x509Key) in RsaToX509PublicKey() argument
110 result = EvpKeyToX509Format(pkey, x509Key); in RsaToX509PublicKey()
146 …t alg, uint32_t keySize, const struct HksBlob *x, const struct HksBlob *y, struct HksBlob *x509Key) in EccToX509PublicKey() argument
187 ret = EvpKeyToX509Format(pkey, x509Key); in EccToX509PublicKey()
288 …t alg, uint32_t keySize, const struct HksBlob *x, const struct HksBlob *y, struct HksBlob *x509Key) in Sm2ToX509PublicKey() argument
324 int32_t ret = EvpKeyToX509Format(sm2EvpPkey, x509Key); in Sm2ToX509PublicKey()
365 const struct HksBlob *g, struct HksBlob *x509Key) in DsaToX509PublicKey() argument
[all …]
Dhks_client_service_adapter.h27 int32_t TranslateToX509PublicKey(const struct HksBlob *publicKey, struct HksBlob *x509Key);
29 int32_t TranslateFromX509PublicKey(const uint32_t alg, const struct HksBlob *x509Key, struct HksBlo…
/base/security/huks/interfaces/inner_api/huks_standard/main/src/
Dhks_api_adapter.c97 struct HksBlob x509Key = { 0, NULL }; in HksExportPublicKeyAdapter() local
98 ret = TranslateToX509PublicKey(&publicKey, &x509Key); in HksExportPublicKeyAdapter()
104 …CheckBlob(key) != HKS_SUCCESS) || (memcpy_s(key->data, key->size, x509Key.data, x509Key.size) != E… in HksExportPublicKeyAdapter()
108 key->size = x509Key.size; in HksExportPublicKeyAdapter()
111 HKS_FREE_BLOB(x509Key); in HksExportPublicKeyAdapter()
/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/alg_module_test/src/
Dopenssl_dh_helper.c217 int32_t DhX509ToHksBlob(const struct HksBlob *x509Key, struct HksBlob *publicKey) in DhX509ToHksBlob() argument
219 if (x509Key == NULL || x509Key->data == NULL || x509Key->size == 0 || publicKey == NULL) { in DhX509ToHksBlob()
223 uint8_t *data = x509Key->data; in DhX509ToHksBlob()
225 EVP_PKEY *pkey = d2i_PUBKEY(NULL, (const unsigned char **)&data, x509Key->size); in DhX509ToHksBlob()
265 int32_t DhHksBlobToX509(const struct HksBlob *key, struct HksBlob *x509Key) in DhHksBlobToX509() argument
267 if (CheckBlob(key) != HKS_SUCCESS || CheckBlob(x509Key) != HKS_SUCCESS) { in DhHksBlobToX509()
294 x509Key->size = length; in DhHksBlobToX509()
295 if (memcpy_s(x509Key->data, x509Key->size, tmp, length) != 0) { in DhHksBlobToX509()
Dopenssl_dsa_helper.c260 int32_t X509ToDsaPublicKey(struct HksBlob *x509Key, struct HksBlob *publicKey) in X509ToDsaPublicKey() argument
262 uint8_t *data = x509Key->data; in X509ToDsaPublicKey()
264 EVP_PKEY *pkey = d2i_PUBKEY(NULL, (const unsigned char **)&data, x509Key->size); in X509ToDsaPublicKey()
318 bool DsaGetx509PubKey(EVP_PKEY *pkey, struct HksBlob *x509Key) in DsaGetx509PubKey() argument
323 if (ret <= 0 || x509Key->size < length) { in DsaGetx509PubKey()
327 x509Key->size = length; in DsaGetx509PubKey()
329 if (memcpy_s(x509Key->data, x509Key->size, tmp, length) != EOK) { in DsaGetx509PubKey()
Dopenssl_ecc_helper.c507 int32_t X509ToHksBlob(const struct HksBlob *x509Key, struct HksBlob *publicKey) in X509ToHksBlob() argument
509 if (x509Key == NULL || x509Key->data == NULL || x509Key->size == 0 || publicKey == NULL) { in X509ToHksBlob()
513 uint8_t *data = x509Key->data; in X509ToHksBlob()
515 EVP_PKEY *pkey = d2i_PUBKEY(NULL, (const unsigned char **)&data, x509Key->size); in X509ToHksBlob()
535 int32_t HksBlobToX509(const struct HksBlob *key, struct HksBlob *x509Key) in HksBlobToX509() argument
582 x509Key->size = length; in HksBlobToX509()
583 if (memcpy_s(x509Key->data, x509Key->size, tmp, length) != 0) { in HksBlobToX509()
Dopenssl_rsa_helper.c103 bool OpensslGetx509PubKey(EVP_PKEY *pkey, struct HksBlob *x509Key) in OpensslGetx509PubKey() argument
108 if (ret <= 0 || x509Key->size < length) { in OpensslGetx509PubKey()
112 x509Key->size = length; in OpensslGetx509PubKey()
114 if (memcpy_s(x509Key->data, x509Key->size, tmp, length) != EOK) { in OpensslGetx509PubKey()
125 int32_t X509ToRsaPublicKey(struct HksBlob *x509Key, struct HksBlob *publicKey) in X509ToRsaPublicKey() argument
127 uint8_t *data = x509Key->data; in X509ToRsaPublicKey()
129 EVP_PKEY *pkey = d2i_PUBKEY(NULL, (const unsigned char **)&data, x509Key->size); in X509ToRsaPublicKey()
Dhks_rsa_common_mt.cpp194 …struct HksBlob x509Key = { .size = SET_SIZE_4096, .data = static_cast<uint8_t *>(HksMalloc(SET_SIZ… in EncryptServiceTestCase() local
195 ASSERT_NE(x509Key.data, nullptr); in EncryptServiceTestCase()
200 OpensslGetx509PubKey(pkey, &x509Key); in EncryptServiceTestCase()
202 EXPECT_EQ(HksImportKey(&authId, paramInSet, &x509Key), HKS_SUCCESS); in EncryptServiceTestCase()
224 HksFree(x509Key.data); in EncryptServiceTestCase()
568 …struct HksBlob x509Key = { .size = SET_SIZE_4096, .data = static_cast<uint8_t *>(HksMalloc(SET_SIZ… in VerifyServiceTestCase() local
569 ASSERT_NE(x509Key.data, nullptr); in VerifyServiceTestCase()
574 OpensslGetx509PubKey(pkey, &x509Key); in VerifyServiceTestCase()
576 EXPECT_EQ(HksImportKey(&authId, paramInSet, &x509Key), HKS_SUCCESS); in VerifyServiceTestCase()
595 HksFree(x509Key.data); in VerifyServiceTestCase()
Dhks_ecc_verify_mt.cpp878 HksBlob x509Key = { .size = ECC_KEY_SIZE, .data = (uint8_t *)HksMalloc(ECC_KEY_SIZE) }; in RunTestCase() local
879 ASSERT_NE(x509Key.data, nullptr); in RunTestCase()
880 EXPECT_EQ(HksBlobToX509(&pubKey, &x509Key), ECC_SUCCESS); in RunTestCase()
882 EXPECT_EQ(HksImportKey(&pubId, paramInSet, &x509Key), HKS_SUCCESS); in RunTestCase()
885 HksFree(x509Key.data); in RunTestCase()
Dhks_ecc_sign_mt.cpp860 HksBlob x509Key = { .size = ECC_KEY_SIZE, .data = (uint8_t *)HksMalloc(ECC_KEY_SIZE) }; in RunTestCase() local
861 ASSERT_NE(x509Key.data, nullptr); in RunTestCase()
869 EXPECT_EQ(HksExportPublicKey(&authId, paramInSet, &x509Key), HKS_SUCCESS); in RunTestCase()
870 EXPECT_EQ(X509ToHksBlob(&x509Key, &pubKey), ECC_SUCCESS); in RunTestCase()
898 HksFree(x509Key.data); in RunTestCase()
Dhks_dsa_mt.cpp893 … struct HksBlob x509Key = { .size = SET_SIZE_4096, .data = (uint8_t *)HksMalloc(SET_SIZE_4096) }; in VerifyServiceTestCase() local
894 ASSERT_NE(x509Key.data, nullptr); in VerifyServiceTestCase()
899 DsaGetx509PubKey(pkey, &x509Key); in VerifyServiceTestCase()
901 EXPECT_EQ(HksImportKey(&authId, paramInSet, &x509Key), HKS_SUCCESS); in VerifyServiceTestCase()
913 HksFree(x509Key.data); in VerifyServiceTestCase()
/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/alg_module_test/include/
Dopenssl_dh_helper.h35 int32_t DhX509ToHksBlob(const struct HksBlob *x509Key, struct HksBlob *publicKey);
37 int32_t DhHksBlobToX509(const struct HksBlob *key, struct HksBlob *x509Key);
Dopenssl_dsa_helper.h33 bool DsaGetx509PubKey(EVP_PKEY *pkey, struct HksBlob *x509Key);
41 int32_t X509ToDsaPublicKey(struct HksBlob *x509Key, struct HksBlob *publicKey);
Dopenssl_ecc_helper.h40 int32_t X509ToHksBlob(const struct HksBlob *x509Key, struct HksBlob *publicKey);
42 int32_t HksBlobToX509(const struct HksBlob *key, struct HksBlob *x509Key);
Dopenssl_rsa_helper.h35 bool OpensslGetx509PubKey(EVP_PKEY *pkey, struct HksBlob *x509Key);
37 int32_t X509ToRsaPublicKey(struct HksBlob *x509Key, struct HksBlob *publicKey);
/base/security/huks/test/unittest/huks_standard_test/interface_inner_test/sdk_test/src/
Dhks_inner_test.cpp393 HksBlob x509Key = {.size = 0, .data = nullptr}; variable
400 ret = TranslateToX509PublicKey(&publicKey, &x509Key);
409 ret = TranslateToX509PublicKey(&publicKey, &x509Key);
411 ret = TranslateFromX509PublicKey(&x509Key, &publicKey);