Refine Netsecurity error codes

Signed-off-by: Yangys <yangyousheng@huawei.com>
This commit is contained in:
Yangys 2024-08-05 21:35:42 +08:00
parent 5d94bf9de2
commit 2604488bc6

View File

@ -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<number> } 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<number>;
/**
@ -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;
}