mirror of
https://gitee.com/openharmony/security_certificate_framework
synced 2024-11-23 14:39:44 +00:00
commit
c1461fa7f7
@ -289,6 +289,7 @@ napi_value NapiX509Certificate::GetPublicKey(napi_env env, napi_callback_info in
|
||||
|
||||
NapiPubKey *pubKeyClass = new (std::nothrow) NapiPubKey(returnPubKey);
|
||||
if (pubKeyClass == nullptr) {
|
||||
napi_throw(env, CertGenerateBusinessError(env, CF_ERR_MALLOC, "Failed to create a pubkey class"));
|
||||
LOGE("create for x509 cert's public key obj failed");
|
||||
CfObjDestroy(returnPubKey);
|
||||
return nullptr;
|
||||
@ -935,7 +936,19 @@ void NapiX509Certificate::CreateX509CertComplete(napi_env env, napi_status statu
|
||||
return;
|
||||
}
|
||||
napi_value instance = CreateX509Cert(env);
|
||||
NapiX509Certificate *x509CertClass = new NapiX509Certificate(context->cert, context->object);
|
||||
NapiX509Certificate *x509CertClass = new (std::nothrow) NapiX509Certificate(context->cert, context->object);
|
||||
if (x509CertClass == nullptr) {
|
||||
context->errCode = CF_ERR_MALLOC;
|
||||
context->errMsg = "Failed to create x509Cert class";
|
||||
LOGE("Failed to create x509Cert class");
|
||||
CfObjDestroy(context->cert);
|
||||
if (context->object != nullptr) {
|
||||
context->object->destroy(&(context->object));
|
||||
}
|
||||
ReturnResult(env, context, nullptr);
|
||||
FreeCryptoFwkCtx(context);
|
||||
return;
|
||||
}
|
||||
napi_wrap(
|
||||
env, instance, x509CertClass,
|
||||
[](napi_env env, void *data, void *hint) {
|
||||
|
@ -236,7 +236,13 @@ static napi_value GenerateCrlEntryArray(napi_env env, CfArray *array)
|
||||
CfBlob *blob = reinterpret_cast<CfBlob *>(array->data + i);
|
||||
HcfX509CrlEntry *entry = reinterpret_cast<HcfX509CrlEntry *>(blob->data);
|
||||
napi_value instance = NapiX509CrlEntry::CreateX509CrlEntry(env);
|
||||
NapiX509CrlEntry *x509CrlEntryClass = new NapiX509CrlEntry(entry);
|
||||
NapiX509CrlEntry *x509CrlEntryClass = new (std::nothrow) NapiX509CrlEntry(entry);
|
||||
if (x509CrlEntryClass == nullptr) {
|
||||
napi_throw(env, CertGenerateBusinessError(env, CF_ERR_MALLOC, "Failed to create a x509CrlEntry class"));
|
||||
LOGE("Failed to create a x509CrlEntry class");
|
||||
CfObjDestroy(entry);
|
||||
return nullptr; /* the C++ objects wrapped will be automatically released by scope manager. */
|
||||
}
|
||||
napi_wrap(
|
||||
env, instance, x509CrlEntryClass,
|
||||
[](napi_env env, void *data, void *hint) {
|
||||
@ -484,7 +490,13 @@ napi_value NapiX509Crl::GetRevokedCertificate(napi_env env, napi_callback_info i
|
||||
return nullptr;
|
||||
}
|
||||
napi_value instance = NapiX509CrlEntry::CreateX509CrlEntry(env);
|
||||
NapiX509CrlEntry *x509CrlEntryClass = new NapiX509CrlEntry(crlEntry);
|
||||
NapiX509CrlEntry *x509CrlEntryClass = new (std::nothrow) NapiX509CrlEntry(crlEntry);
|
||||
if (x509CrlEntryClass == nullptr) {
|
||||
napi_throw(env, CertGenerateBusinessError(env, CF_ERR_MALLOC, "Failed to create a x509CrlEntry class"));
|
||||
LOGE("Failed to create a x509CrlEntry class");
|
||||
CfObjDestroy(crlEntry);
|
||||
return nullptr;
|
||||
}
|
||||
napi_wrap(
|
||||
env, instance, x509CrlEntryClass,
|
||||
[](napi_env env, void *data, void *hint) {
|
||||
@ -525,7 +537,13 @@ napi_value NapiX509Crl::GetRevokedCertificateWithCert(napi_env env, napi_callbac
|
||||
}
|
||||
|
||||
napi_value instance = NapiX509CrlEntry::CreateX509CrlEntry(env);
|
||||
NapiX509CrlEntry *x509CrlEntryClass = new NapiX509CrlEntry(crlEntry);
|
||||
NapiX509CrlEntry *x509CrlEntryClass = new (std::nothrow) NapiX509CrlEntry(crlEntry);
|
||||
if (x509CrlEntryClass == nullptr) {
|
||||
napi_throw(env, CertGenerateBusinessError(env, CF_ERR_MALLOC, "Failed to create a x509CrlEntry class"));
|
||||
LOGE("Failed to create a x509CrlEntry class");
|
||||
CfObjDestroy(crlEntry);
|
||||
return nullptr;
|
||||
}
|
||||
napi_wrap(
|
||||
env, instance, x509CrlEntryClass,
|
||||
[](napi_env env, void *data, void *hint) {
|
||||
@ -920,7 +938,16 @@ void NapiX509Crl::CreateX509CrlComplete(napi_env env, napi_status status, void *
|
||||
return;
|
||||
}
|
||||
napi_value instance = CreateX509Crl(env);
|
||||
NapiX509Crl *x509CrlClass = new NapiX509Crl(context->crl);
|
||||
NapiX509Crl *x509CrlClass = new (std::nothrow) NapiX509Crl(context->crl);
|
||||
if (x509CrlClass == nullptr) {
|
||||
context->errCode = CF_ERR_MALLOC;
|
||||
context->errMsg = "Failed to create a x509Crl class";
|
||||
LOGE("Failed to create a x509Crl class");
|
||||
CfObjDestroy(context->crl);
|
||||
ReturnResult(env, context, nullptr);
|
||||
FreeCryptoFwkCtx(context);
|
||||
return;
|
||||
}
|
||||
napi_wrap(
|
||||
env, instance, x509CrlClass,
|
||||
[](napi_env env, void *data, void *hint) {
|
||||
|
Loading…
Reference in New Issue
Block a user