From 2604488bc695a6b51021c39ba3dc607ad0b38540 Mon Sep 17 00:00:00 2001 From: Yangys Date: Mon, 5 Aug 2024 21:35:42 +0800 Subject: [PATCH] Refine Netsecurity error codes Signed-off-by: Yangys --- api/@ohos.net.networkSecurity.d.ts | 53 ++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/api/@ohos.net.networkSecurity.d.ts b/api/@ohos.net.networkSecurity.d.ts index da5315903..e11309514 100644 --- a/api/@ohos.net.networkSecurity.d.ts +++ b/api/@ohos.net.networkSecurity.d.ts @@ -98,6 +98,33 @@ declare namespace networkSecurity { * @syscap SystemCapability.Communication.NetStack * @since 11 */ + /** + * Certificate verification to the server. + * @param { CertBlob } cert - Certificates to be verified. + * @param { CertBlob } [caCert] - Incoming custom CA cert. + * @returns { Promise } The promise returned by the function. + * Number equals 0 if verify of certification from server succeed, else verify failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2305001 - Unspecified error. + * @throws { BusinessError } 2305002 - Unable to get issuer certificate. + * @throws { BusinessError } 2305003 - Unable to get certificate revocation list (CRL). + * @throws { BusinessError } 2305004 - Unable to decrypt certificate signature. + * @throws { BusinessError } 2305005 - Unable to decrypt CRL signature. + * @throws { BusinessError } 2305006 - Unable to decode issuer public key. + * @throws { BusinessError } 2305007 - Certificate signature failure. + * @throws { BusinessError } 2305008 - CRL signature failure. + * @throws { BusinessError } 2305009 - Certificate is not yet valid. + * @throws { BusinessError } 2305010 - Certificate has expired. + * @throws { BusinessError } 2305011 - CRL is not yet valid. + * @throws { BusinessError } 2305012 - CRL has expired. + * @throws { BusinessError } 2305018 - Self-signed certificate. + * @throws { BusinessError } 2305023 - Certificate has been revoked. + * @throws { BusinessError } 2305024 - Invalid certificate authority (CA). + * @throws { BusinessError } 2305027 - Certificate is untrusted. + * @throws { BusinessError } 2305069 - Invalid certificate verification context. + * @syscap SystemCapability.Communication.NetStack + * @since 12 + */ export function certVerification(cert: CertBlob, caCert?: CertBlob): Promise; /** @@ -124,6 +151,32 @@ declare namespace networkSecurity { * @syscap SystemCapability.Communication.NetStack * @since 11 */ + /** + * Certificate verification to the server. + * @param { CertBlob } cert - Certificates to be verified. + * @param { CertBlob } [caCert] - Incoming custom CA cert. + * @returns { number } Returns 0 if verify of certification from server succeed, else verify failed. + * @throws { BusinessError } 401 - Parameter error. + * @throws { BusinessError } 2305001 - Unspecified error. + * @throws { BusinessError } 2305002 - Unable to get issuer certificate. + * @throws { BusinessError } 2305003 - Unable to get certificate revocation list (CRL). + * @throws { BusinessError } 2305004 - Unable to decrypt certificate signature. + * @throws { BusinessError } 2305005 - Unable to decrypt CRL signature. + * @throws { BusinessError } 2305006 - Unable to decode issuer public key. + * @throws { BusinessError } 2305007 - Certificate signature failure. + * @throws { BusinessError } 2305008 - CRL signature failure. + * @throws { BusinessError } 2305009 - Certificate is not yet valid. + * @throws { BusinessError } 2305010 - Certificate has expired. + * @throws { BusinessError } 2305011 - CRL is not yet valid. + * @throws { BusinessError } 2305012 - CRL has expired. + * @throws { BusinessError } 2305018 - Self-signed certificate. + * @throws { BusinessError } 2305023 - Certificate has been revoked. + * @throws { BusinessError } 2305024 - Invalid certificate authority (CA). + * @throws { BusinessError } 2305027 - Certificate is untrusted. + * @throws { BusinessError } 2305069 - Invalid certificate verification context. + * @syscap SystemCapability.Communication.NetStack + * @since 12 + */ export function certVerificationSync(cert: CertBlob, caCert?: CertBlob): number; }