mirror of
https://gitee.com/openharmony/security_certificate_framework
synced 2024-11-23 14:39:44 +00:00
commit
1f993723a6
@ -356,7 +356,7 @@ bool CheckIsSelfSigned(const X509 *cert)
|
||||
}
|
||||
|
||||
ret = (X509_NAME_cmp(issuer, subject) == 0);
|
||||
LOGI("CheckIsSelfSigned() ret: %d .", ret);
|
||||
LOGI("The ret of whether the cert is self signed is %d.", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,6 @@ static EVP_PKEY *ConvertByteArrayToPubKey(const uint8_t *pubKeyBytes, size_t len
|
||||
LOGE("ConvertByteArrayToPubkey invalid params.");
|
||||
return NULL;
|
||||
}
|
||||
LOGI("pubkeyBytes len: %d .", len);
|
||||
EVP_PKEY *pubKey = d2i_PUBKEY(NULL, &pubKeyBytes, len); // pubkey DER format.
|
||||
if (pubKey == NULL) {
|
||||
LOGE("d2i_PUBKEY() failed!");
|
||||
@ -1097,7 +1096,7 @@ static BIO *CreateConnectBio(char *host, char *port, int ssl)
|
||||
}
|
||||
bio = BIO_new_ssl_connect(sslCtx);
|
||||
if (BIO_set_conn_hostname(bio, host) != 1) {
|
||||
LOGE("Set host name %s failed.", host);
|
||||
LOGE("Set host name failed.");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
@ -1111,17 +1110,17 @@ static BIO *CreateConnectBio(char *host, char *port, int ssl)
|
||||
|
||||
if (port != NULL) {
|
||||
if (BIO_set_conn_port(bio, port) != 1) {
|
||||
LOGE("Set port %s failed.", port);
|
||||
LOGE("Set port failed.");
|
||||
return NULL;
|
||||
}
|
||||
} else if (ssl) {
|
||||
if (BIO_set_conn_port(bio, HTTPS_PORT) != 1) {
|
||||
LOGE("Set port %s failed.", HTTPS_PORT);
|
||||
LOGE("Set port failed.");
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
if (BIO_set_conn_port(bio, HTTP_PORT) != 1) {
|
||||
LOGE("Set port %s failed.", HTTP_PORT);
|
||||
LOGE("Set port failed.");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -864,8 +864,9 @@ static CfResult Comparex509CertX509Openssl(HcfX509CrlSpi *self, const HcfCertifi
|
||||
bool bRet = IsRevoked(self, x509Cert);
|
||||
if (!bRet) {
|
||||
*out = false;
|
||||
LOGI("Crl revoked is false!");
|
||||
}
|
||||
LOGI("x509Crl match x509Cert %d!", *out);
|
||||
LOGI("x509Crl match x509Cert!");
|
||||
return CF_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,6 @@ static CfResult GetDataByEntryOpenssl(int32_t count, CfArray *outArr, X509_NAME_
|
||||
CfArrayDataClearAndFree(outArr);
|
||||
return CF_ERR_CRYPTO_OPERATION;
|
||||
}
|
||||
LOGI("i2d_ASN1_OBJECT %s, %d", (const char *)p, len);
|
||||
CfResult res = DeepCopyDataToOut((const char *)p, len, &(outArr->data[i]));
|
||||
if (res != CF_SUCCESS) {
|
||||
LOGE("DeepCopyDataToOut error");
|
||||
@ -242,7 +241,7 @@ static CfResult CollectAndParseName(const char *cp, char *work, int chtype, X509
|
||||
const char *t = cp;
|
||||
t++;
|
||||
if (*cp == '\\' && *t == '\0') {
|
||||
LOGE("Escape character at end of name string\n");
|
||||
LOGE("Escape character at end of name string");
|
||||
return CF_INVALID_PARAMS;
|
||||
}
|
||||
if (*cp == '\\') {
|
||||
@ -272,17 +271,17 @@ static X509_NAME *ParseName(const char *cp, int chtype, const char *desc)
|
||||
|
||||
X509_NAME *name = X509_NAME_new();
|
||||
if (name == NULL) {
|
||||
LOGE("Out of memory\n");
|
||||
LOGE("Out of memory");
|
||||
return NULL;
|
||||
}
|
||||
char *work = OPENSSL_strdup(cp);
|
||||
if (work == NULL) {
|
||||
LOGE("Error copying name input\n");
|
||||
LOGE("Error copying name input");
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (CollectAndParseName(cp, work, chtype, name) != CF_SUCCESS) {
|
||||
LOGE("Error CollectAndParseName\n");
|
||||
LOGE("Error CollectAndParseName");
|
||||
goto err;
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,6 @@ const std::string CERT_TAG_CERT_MATCH_PARAMS = "certMatchParameters";
|
||||
const std::string CERT_TAG_MAX_LENGTH = "maxLength";
|
||||
const std::string CERT_TAG_VALIDATE_PARAMS = "validationParameters";
|
||||
const std::string CERT_TAG_KEYSTORE = "keystore";
|
||||
const std::string CERT_TAG_PWD = "pwd";
|
||||
|
||||
enum ResultCode {
|
||||
JS_SUCCESS = 0,
|
||||
|
@ -503,7 +503,7 @@ static void CreateTrustAnchorsWithKeyStoreExecute(napi_env env, void *data)
|
||||
context->async->errCode =
|
||||
HcfCreateTrustAnchorWithKeyStore(context->keyStore, context->pwd, &context->trustAnchorArray);
|
||||
if (context->async->errCode != CF_SUCCESS) {
|
||||
context->async->errMsg = "KeyStore and Password mismatch!";
|
||||
context->async->errMsg = "Failed to create trust anchor from p12!";
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user