From 3261c02d90ef8fc9a06c8fce626d4c74b12a29bb Mon Sep 17 00:00:00 2001 From: Annie_wang Date: Tue, 14 Feb 2023 20:18:28 +0800 Subject: [PATCH] update docs Signed-off-by: Annie_wang --- .../reference/apis/js-apis-cert.md | 17 ++++++++--------- en/application-dev/security/cert-guidelines.md | 8 ++++---- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/en/application-dev/reference/apis/js-apis-cert.md b/en/application-dev/reference/apis/js-apis-cert.md index 08df60a00e..cf334f6fd3 100644 --- a/en/application-dev/reference/apis/js-apis-cert.md +++ b/en/application-dev/reference/apis/js-apis-cert.md @@ -102,7 +102,7 @@ Creates an **X509Cert** instance. This API uses an asynchronous callback to retu | Name | Type | Mandatory| Description | | -------- | ----------------------------- | ---- | -------------------------- | | inStream | [EncodingBlob](#encodingblob) | Yes | X.509 certificate serialization data. | -| callback | AsyncCallback\ | Yes | Callback invoked to return the result. **X509Cer** instance created.| +| callback | AsyncCallback\ | Yes | Callback invoked to return the result. **X509Cert** instance created.| **Example** @@ -115,7 +115,7 @@ let encodingData = null; let encodingBlob = { data: encodingData, // Set the encoding format, which can be FORMAT_PEM or FORMAT_DER. - encodingFormat: cryptoFramework.EncodingFormat.FORMAT_PEM + encodingFormat: cryptoCert.EncodingFormat.FORMAT_PEM }; cryptoCert.createX509Cert(encodingBlob, function (error, x509Cert) { if (error != null) { @@ -144,7 +144,7 @@ Creates an **X509Cert** instance. This API uses a promise to return the result. | Type | Description | | ------- | ---------------- | -| Promise\ | **X509Cer** instance created.| +| Promise\ | **X509Cert** instance created.| **Example** @@ -189,7 +189,6 @@ Verifies the certificate signature. This API uses an asynchronous callback to re ```js import cryptoCert from '@ohos.security.cert'; -import cryptoFramework from "@ohos.security.cryptoFramework" // Certificate binary data, which must be set based on the service. let encodingData = null; @@ -250,7 +249,7 @@ let encodingBlob = { }; cryptoCert.createX509Cert(encodingBlob).then(x509Cert => { console.log("createX509Cert success"); - // Generate a public key by AsyKeyGenerator or obtain the public key by using getPublicKey() of the X509Cert instance. + // The service can call getPublicKey() of the upper-level X509Cert object to obtain the public key. let pubKey = null; x509Cert.verify(pubKey).then(result => { console.log("verify success"); @@ -1217,7 +1216,7 @@ cryptoCert.createX509Crl(encodingBlob).then(x509Crl => { verify(key : cryptoFramework.PubKey, callback : AsyncCallback\) : void -Verifies the signature of the X.509 CRL. This API uses an asynchronous callback to return the result. +Verifies the signature of the X.509 CRL. This API uses an asynchronous callback to return the result. The RSA algorithm is supported. **System capability**: SystemCapability.Security.Cert @@ -1225,7 +1224,7 @@ Verifies the signature of the X.509 CRL. This API uses an asynchronous callback | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ------------------------------------------------------------ | -| key | cryptoFramework.PubKey | Yes | Public key used for signature verification. | +| key | cryptoFramework.PubKey | Yes | Public key used for signature verification. | | callback | AsyncCallback\ | Yes | Callback invoked to return the result. If **error** is **null**, the signature verification is successful. If **error** is not **null**, the signature verification fails.| @@ -1264,7 +1263,7 @@ cryptoCert.createX509Crl(encodingBlob, function (error, x509Crl) { verify(key : cryptoFramework.PubKey) : Promise\ -Verifies the signature of the X.509 CRL. This API uses a promise to return the result. +Verifies the signature of the X.509 CRL. This API uses a promise to return the result. The RSA algorithm is supported. **System capability**: SystemCapability.Security.Cert @@ -2061,7 +2060,7 @@ Obtains the issuer of this revoked certificate. This API uses an asynchronous ca **Return value** | Type | Description | -| --------------------- | ---------------------- - | +| --------------------- | ----------------------- | | [DataBlob](#datablob) | Promise used to return the issuer of the revoked certificate obtained.| **Example** diff --git a/en/application-dev/security/cert-guidelines.md b/en/application-dev/security/cert-guidelines.md index ed0e3e39a7..dd7238f966 100644 --- a/en/application-dev/security/cert-guidelines.md +++ b/en/application-dev/security/cert-guidelines.md @@ -71,7 +71,7 @@ let certData = "-----BEGIN CERTIFICATE-----\n" + "I1Lwu6in1ruflZhzseWulXwcITf3bm/Y5X1g1XFWQUH\n" + "-----END CERTIFICATE-----\n"; -// Convert the certificate data form a string to a Uint8Array.. +// Convert the certificate data form a string to a Uint8Array. function stringToUint8Array(str) { var arr = []; for (var i = 0, j = str.length; i < j; i++) { @@ -209,7 +209,7 @@ let crlData = "-----BEGIN X509 CRL-----\n" + "DrAA7hErVgXhtURLbAI=\n" + "-----END X509 CRL-----\n"; -// Convert the certificate data form a string to a Uint8Array.. +// Convert the certificate data form a string to a Uint8Array. function stringToUint8Array(str) { var arr = []; for (var i = 0, j = str.length; i < j; i++) { @@ -260,7 +260,7 @@ function crlSample() { console.log("isRevoked failed, errCode: " + error.code + ", errMsg: " + error.message); } - // Obtain the PubKey instance by using generateKeyPair() or convertKey() of AsyKeyGenerator. The process is omitted here. + // The binary data of the public key needs to be passed to convertKey() of @ohos.security.cryptoFramework to obtain the PubKey object. The process is omitted here. let pubKey = null; // Verify the CRL signature. @@ -441,7 +441,7 @@ function crlEntrySample() { } // Obtain the serial number of the revoked certificate. - let serialNumber = crlEntry.getSerialNumber(); + serialNumber = crlEntry.getSerialNumber(); // Obtain the revocation date of the revoked certificate. try { -- GitLab