mirror of
https://gitee.com/openharmony/security_crypto_framework
synced 2025-02-22 00:40:37 +00:00
commit
ad25a0bd04
@ -572,6 +572,12 @@ HcfResult ConvertPubPemStrToKey(EVP_PKEY **pkey, const char *keyType, int select
|
||||
return HCF_SUCCESS;
|
||||
}
|
||||
|
||||
int PrivateKeyReadNullCb(char *buf, int size, int rwflag, void *userdata)
|
||||
{
|
||||
LOGE("Failed to read private key from bio.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
HcfResult ConvertPriPemStrToKey(const char *keyStr, EVP_PKEY **pkey, const char *keyType)
|
||||
{
|
||||
BIO *bio = OpensslBioNew(OpensslBioSMem());
|
||||
@ -588,7 +594,7 @@ HcfResult ConvertPriPemStrToKey(const char *keyStr, EVP_PKEY **pkey, const char
|
||||
return HCF_ERR_CRYPTO_OPERATION;
|
||||
}
|
||||
|
||||
EVP_PKEY *pkeyRet = OpensslPemReadBioPrivateKey(bio, pkey, NULL, NULL);
|
||||
EVP_PKEY *pkeyRet = OpensslPemReadBioPrivateKey(bio, pkey, PrivateKeyReadNullCb, NULL);
|
||||
OpensslBioFreeAll(bio);
|
||||
if (pkeyRet == NULL) {
|
||||
LOGE("Failed to read private key from bio");
|
||||
|
Loading…
x
Reference in New Issue
Block a user