From 8c389014939365775fb16ea7de05425c3b4ed44c Mon Sep 17 00:00:00 2001 From: lanlanlan Date: Wed, 22 Mar 2023 02:38:04 +0000 Subject: [PATCH 1/4] update api/@ohos.security.cryptoFramework.d.ts. Signed-off-by: lanlanlan --- api/@ohos.security.cryptoFramework.d.ts | 1893 +++++++++++++---------- 1 file changed, 1041 insertions(+), 852 deletions(-) diff --git a/api/@ohos.security.cryptoFramework.d.ts b/api/@ohos.security.cryptoFramework.d.ts index 36060f33e9..81ba43417f 100644 --- a/api/@ohos.security.cryptoFramework.d.ts +++ b/api/@ohos.security.cryptoFramework.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,951 +13,1140 @@ * limitations under the License. */ -import {AsyncCallback, Callback} from './basic'; +import { AsyncCallback, Callback } from './basic'; /** * Provides a set of encryption and decryption algorithm library framework, shields the underlying differences, * encapsulate the relevant algorithm library, and provides a unified functional interface upward. + * * @namespace cryptoFramework * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ declare namespace cryptoFramework { + /** + * Enum for result code. + * + * @enum { number } + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + enum Result { /** - * Enum for result code. - * @enum {number} + * Indicates that input parameters is invalid. + * * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ - enum Result { - /** Indicates that input parameters is invalid. - * @since 9 - */ - INVALID_PARAMS = 401, + INVALID_PARAMS = 401, - /** Indicates that function or algorithm is not supported. - * @since 9 - */ - NOT_SUPPORT = 801, + /** + * Indicates that function or algorithm is not supported. + * + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + NOT_SUPPORT = 801, - /** Indicates the memory error. - * @since 9 - */ - ERR_OUT_OF_MEMORY = 17620001, + /** + * Indicates the memory error. + * + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + ERR_OUT_OF_MEMORY = 17620001, - /** Indicates that runtime error. - * @since 9 - */ - ERR_RUNTIME_ERROR = 17620002, + /** + * Indicates that runtime error. + * + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + ERR_RUNTIME_ERROR = 17620002, - /** Indicates that crypto operation error. - * @since 9 - */ - ERR_CRYPTO_OPERATION = 17630001, - } + /** + * Indicates that crypto operation error. + * + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + ERR_CRYPTO_OPERATION = 17630001 + } + + /** + * Provides the data blob type. + * + * @typedef DataBlob + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + interface DataBlob { + data: Uint8Array; + } + + /** + * Provides the ParamsSpec type, including the algorithm name. + * + * @typedef ParamsSpec + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + interface ParamsSpec { + /** + * Indicates the algorithm name. Should be set before initialization of a cipher object. + * + * @type { string } + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + algName: string; + } + + /** + * Provides the IvParamsSpec type, including the parameter iv. + * + * @typedef IvParamsSpec + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + interface IvParamsSpec extends ParamsSpec { + /** + * Indicates the algorithm parameters such as iv. + * + * @type { DataBlob } + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + iv: DataBlob; + } + + /** + * Provides the GcmParamsSpec type, including the parameter iv, aad and authTag. + * + * @typedef GcmParamsSpec + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + interface GcmParamsSpec extends ParamsSpec { + /** + * Indicates the GCM algorithm parameters such as iv. + * + * @type { DataBlob } + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + iv: DataBlob; /** - * Provides the data blob type. - * @typedef DataBlob + * Indicates the additional Authenticated Data in GCM mode. + * + * @type { DataBlob } * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ - interface DataBlob { - data : Uint8Array; - } + aad: DataBlob; /** - * Provides the ParamsSpec type, including the algorithm name. - * @typedef ParamsSpec + * Indicates the output tag from the encryption operation. The tag is used for integrity check. + * + * @type { DataBlob } * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ - interface ParamsSpec { - /** - * Indicates the algorithm name. Should be set before initialization of a cipher object. - * @type { string } - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - algName : string; - } + authTag: DataBlob; + } + + /** + * Provides the CcmParamsSpec type, including the parameter iv, aad and authTag. + * + * @typedef CcmParamsSpec + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + interface CcmParamsSpec extends ParamsSpec { + /** + * Indicates the GCM algorithm parameters such as IV. + * + * @type { DataBlob } + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + iv: DataBlob; /** - * Provides the IvParamsSpec type, including the parameter iv. - * @typedef IvParamsSpec + * Indicates the Additional Authenticated Data in CCM mode. + * + * @type { DataBlob } * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ - interface IvParamsSpec extends ParamsSpec { - /** - * Indicates the algorithm parameters such as iv. - * @type { DataBlob } - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - iv : DataBlob; - } + aad: DataBlob; /** - * Provides the GcmParamsSpec type, including the parameter iv, aad and authTag. - * @typedef GcmParamsSpec + * Indicates the output tag from the encryption operation. The tag is used for integrity check. + * + * @type { DataBlob } + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + authTag: DataBlob; + } + + /** + * Enum for obtain the crypto operation. + * + * @enum { number } + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + enum CryptoMode { + /** + * The value of encryption operation for AES, 3DES and RSA. + * * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ - interface GcmParamsSpec extends ParamsSpec { - /** - * Indicates the GCM algorithm parameters such as iv. - * @type { DataBlob } - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - iv : DataBlob; + ENCRYPT_MODE = 0, - /** - * Indicates the additional Authenticated Data in GCM mode. - * @type { DataBlob } - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - aad : DataBlob; + /** + * The value of decryption operation for AES, 3DES and RSA. + * + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + DECRYPT_MODE = 1 + } + + /** + * Provides the Key type, which is the common parent class of keys. + * + * @typedef Key + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + interface Key { + /** + * Encode the key object to binary data. + * + * @returns { DataBlob } the binary data of the key object. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + getEncoded(): DataBlob; + + /** + * Indicates the format of the key object. + * + * @type { string } + * @readonly + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + readonly format: string; + + /** + * Indicates the algorithm name of the key object. + * + * @type { string } + * @readonly + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + readonly algName: string; + } + + /** + * Provides the SymKey type, which is used for symmetric cryptography. + * + * @typedef SymKey + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + interface SymKey extends Key { + /** + * Reset the key data to zero in the memory. + * + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + clearMem(): void; + } + + /** + * Provides the private key type. + * + * @typedef PriKey + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + interface PriKey extends Key { + /** + * Clear memory of private key. + * + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + clearMem(): void; + } + + /** + * The public key class of asymmetrical key. + * + * @typedef PubKey + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + interface PubKey extends Key {} + + /** + * The keyPair class of asymmetrical key. Include privateKey and publickey. + * + * @typedef KeyPair + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + interface KeyPair { + /** + * KeyPair's private key. + * + * @type { PriKey } + * @readonly + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + readonly priKey: PriKey; + + /** + * KeyPair's public key. + * + * @type { PubKey } + * @readonly + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + readonly pubKey: PubKey; + } + + /** + * Provides the random interface. + * + * @typedef Random + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + interface Random { + /** + * Generate random DataBlob by given length. + * + * @param { number } len - indicates the length of random DataBlob. + * @param { AsyncCallback } callback - the callback used to return random DataBlob. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + generateRandom(len: number, callback: AsyncCallback): void; + + /** + * Generate random DataBlob by given length. + * + * @param { number } len - indicates the length of random DataBlob. + * @returns { Promise } the promise used to return the generated random blob. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + generateRandom(len: number): Promise; - /** - * Indicates the output tag from the encryption operation. The tag is used for integrity check. - * @type { DataBlob } - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - authTag : DataBlob; - } + /** + * Set seed by given DataBlob. + * + * @param { DataBlob } seed - indicates the seed DataBlob. + * @throws { BusinessError } 17620001 - memory error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + setSeed(seed: DataBlob): void; + } + + /** + * Provides the rand create func. + * + * @returns { Random } returns the created rand instance. + * @throws { BusinessError } 17620001 - memory error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + function createRandom(): Random; + + /** + * The AsyKeyGenerator provides the ability to generate or convert keyPair. + * + * @typedef AsyKeyGenerator + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + interface AsyKeyGenerator { + /** + * Used to generate asymmetric key pair. + * + * @param { AsyncCallback } callback - the callback used to return keypair. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + generateKeyPair(callback: AsyncCallback): void; /** - * Provides the CcmParamsSpec type, including the parameter iv, aad and authTag. - * @typedef CcmParamsSpec + * Used to generate asymmetric key pair. + * + * @returns { Promise } the promise used to return keypair. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ - interface CcmParamsSpec extends ParamsSpec { - /** - * Indicates the GCM algorithm parameters such as IV. - * @type { DataBlob } - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - iv : DataBlob; + generateKeyPair(): Promise; - /** - * Indicates the Additional Authenticated Data in CCM mode. - * @type { DataBlob } - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - aad : DataBlob; + /** + * Used to convert asymmetric key pair . + * + * @param { DataBlob } pubKey - the public key data blob. + * @param { DataBlob } priKey - the private key data blob. + * @param { AsyncCallback } callback - the callback used to return keypair. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + convertKey(pubKey: DataBlob, priKey: DataBlob, callback: AsyncCallback): void; - /** - * Indicates the output tag from the encryption operation. The tag is used for integrity check. - * @type { DataBlob } - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - authTag : DataBlob; - } + /** + * Used to convert asymmetric key pair. + * + * @param { DataBlob } pubKey - the public key data blob. + * @param { DataBlob } priKey - the private key data blob. + * @returns { Promise } the promise used to return keypair. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + convertKey(pubKey: DataBlob, priKey: DataBlob): Promise; /** - * Enum for obtain the crypto operation. - * @enum { number } + * The algName of the AsyKeyGenerator. + * + * @type { string } + * @readonly + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + readonly algName: string; + } + + /** + * Provides the SymKeyGenerator type, which is used for generating symmetric key. + * + * @typedef SymKeyGenerator + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + interface SymKeyGenerator { + /** + * Generate a symmetric key object randomly. + * + * @param { AsyncCallback } callback - the callback of generateSymKey. + * @throws { BusinessError } 17620001 - memory error. * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ - enum CryptoMode { - /** - * The value of encryption operation for AES, 3DES and RSA. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - ENCRYPT_MODE = 0, + generateSymKey(callback: AsyncCallback): void; - /** - * The value of decryption operation for AES, 3DES and RSA. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - DECRYPT_MODE = 1, - } + /** + * Generate a symmetric key object randomly. + * + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 17620001 - memory error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + generateSymKey(): Promise; /** - * Provides the Key type, which is the common parent class of keys. - * @typedef Key + * Generate a symmetric key object according to the provided binary key data. + * + * @param { DataBlob } key - the key data blob. + * @param { AsyncCallback } callback - the callback of generateSymKey. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ - interface Key { - /** - * Encode the key object to binary data. - * @returns { DataBlob } the binary data of the key object. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - getEncoded() : DataBlob; + convertKey(key: DataBlob, callback: AsyncCallback): void; - /** - * Indicates the format of the key object. - * @type { string } - * @readonly - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - readonly format : string; + /** + * Generate a symmetric key object according to the provided binary key data. + * + * @param { DataBlob } key - the key data blob. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + convertKey(key: DataBlob): Promise; - /** - * Indicates the algorithm name of the key object. - * @type { string } - * @readonly - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - readonly algName : string; - } + /** + * Indicates the algorithm name of the SymKeyGenerator object. + * + * @type { string } + * @readonly + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + readonly algName: string; + } + + /** + * Provides the asymmetrical key generator instance func. + * + * @param { string } algName - indicates the algorithm name. + * @returns { AsyKeyGenerator } the generator obj create by algName. + * @throws { BusinessError } 401 - invalid parameters. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + function createAsyKeyGenerator(algName: string): AsyKeyGenerator; + + /** + * Create a symmetric key generator according to the given algorithm name. + * + * @param { string } algName - indicates the algorithm name. + * @returns { SymKeyGenerator } the symmetric key generator instance. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 801 - this operation is not supported. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + function createSymKeyGenerator(algName: string): SymKeyGenerator; + + /** + * Provides the Mac type, which is used for Mac generation. + * + * @typedef Mac + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + interface Mac { + /** + * Init hmac with given SymKey. + * + * @param { SymKey } key - indicates the SymKey. + * @param { AsyncCallback } callback - the callback of the init function. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + init(key: SymKey, callback: AsyncCallback): void; /** - * Provides the SymKey type, which is used for symmetric cryptography. - * @typedef SymKey + * Init hmac with given SymKey. + * + * @param { SymKey } key - indicates the SymKey. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17630001 - crypto operation error. * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ - interface SymKey extends Key { - /** - * Reset the key data to zero in the memory. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - clearMem() : void; - } + init(key: SymKey): Promise; /** - * Provides the private key type. - * @typedef PriKey + * Update hmac with DataBlob. + * + * @param { DataBlob } input - indicates the DataBlob. + * @param { AsyncCallback } callback - the callback of the update function. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17630001 - crypto operation error. * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ - interface PriKey extends Key { + update(input: DataBlob, callback: AsyncCallback): void; - /** - * Clear memory of private key. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - clearMem() : void; - } + /** + * Update hmac with DataBlob. + * + * @param { DataBlob } input - indicates the DataBlob. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + update(input: DataBlob): Promise; /** - * The public key class of asymmetrical key. - * @typedef PubKey + * Output the result of hmac calculation. + * + * @param { AsyncCallback } callback - the callback of the doFinal function. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17630001 - crypto operation error. * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ - interface PubKey extends Key {} + doFinal(callback: AsyncCallback): void; /** - * The keyPair class of asymmetrical key. Include privateKey and publickey. - * @typedef KeyPair + * Output the result of hmac calculation. + * + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17630001 - crypto operation error. * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ - interface KeyPair { + doFinal(): Promise; - /** - * KeyPair's private key. - * @type { PriKey } - * @readonly - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - readonly priKey : PriKey; + /** + * Output the length of hmac result. + * + * @returns { number } returns the length of the hmac result. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + getMacLength(): number; - /** - * KeyPair's public key. - * @type { PubKey } - * @readonly - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - readonly pubKey : PubKey; - } + /** + * Indicates the algorithm name. + * + * @type { string } + * @readonly + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + readonly algName: string; + } + + /** + * Provides the mac create func. + * + * @param { string } algName - indicates the mac algorithm name. + * @returns { Mac } returns the created mac instance. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + function createMac(algName: string): Mac; + + /** + * Provides the Md type, which is used for Md generation. + * + * @typedef Md + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + interface Md { + /** + * Update md with DataBlob. + * + * @param { DataBlob } input - indicates the DataBlob. + * @param { AsyncCallback } callback - the callback of the update function. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + update(input: DataBlob, callback: AsyncCallback): void; /** - * Provides the random interface. - * @typedef Random + * Update md with DataBlob. + * + * @param { DataBlob } input - indicates the DataBlob. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17630001 - crypto operation error. * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ - interface Random { - /** - * Generate random DataBlob by given length. - * @param len Indicates the length of random DataBlob. - * @returns Returns the generated random blob. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - generateRandom(len : number, callback: AsyncCallback) : void; - generateRandom(len : number) : Promise; + update(input: DataBlob): Promise; - /** - * Set seed by given DataBlob. - * @param seed Indicates the seed DataBlob. - * @throws { BusinessError } 17620001 - memory error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - setSeed(seed : DataBlob) : void; - } + /** + * Output the result of md calculation. + * + * @param { AsyncCallback } callback - the callback of the digest function. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + digest(callback: AsyncCallback): void; /** - * Provides the rand create func. - * @returns Returns the created rand instance. + * Output the result of md calculation. + * + * @returns { Promise } the promise returned by the function. * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + digest(): Promise; + + /** + * Output the length of md result. + * + * @returns { number } returns the length of the hmac result. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + getMdLength(): number; + + /** + * Indicates the algorithm name. + * + * @type { string } + * @readonly + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + readonly algName: string; + } + + /** + * Provides the md create func. + * + * @param { string } algName - indicates the md algorithm name. + * @returns { Md } returns the created md instance. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + function createMd(algName: string): Md; + + /** + * Provides the Cipher type, which is used for encryption and decryption operations. + * + * @typedef Cipher + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + interface Cipher { + /** + * Init the crypto operation with the given crypto mode, key and parameters. + * + * @param { CryptoMode } opMode - indicates the crypto mode is encryption or decryption. + * @param { Key } key - indicates the symmetric key or the asymmetric key. + * @param { ParamsSpec } params - indicates the algorithm parameters such as IV. + * @param { AsyncCallback } callback - the callback of the init function. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17620002 - runtime error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + init(opMode: CryptoMode, key: Key, params: ParamsSpec, callback: AsyncCallback): void; + + /** + * Init the crypto operation with the given crypto mode, key and parameters. + * + * @param { CryptoMode } opMode - indicates the crypto mode is encryption or decryption. + * @param { Key } key - indicates the symmetric key or the asymmetric key. + * @param { ParamsSpec } params - indicates the algorithm parameters such as IV. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17620002 - runtime error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + init(opMode: CryptoMode, key: Key, params: ParamsSpec): Promise; + + /** + * Update the crypto operation with the input data, and feed back the encrypted or decrypted data + * this time. RSA is not supported in this function. + * + * @param { DataBlob } data - indicates the data to be encrypted or decrypted. + * @param { AsyncCallback } callback - the callback of the update function. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17620002 - runtime error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + update(data: DataBlob, callback: AsyncCallback): void; + + /** + * Update the crypto operation with the input data, and feed back the encrypted or decrypted data + * this time. RSA is not supported in this function. + * + * @param { DataBlob } data - indicates the data to be encrypted or decrypted. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17620002 - runtime error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + update(data: DataBlob): Promise; + + /** + * Finish the crypto operation, encrypt or decrypt the input data, and then feed back the output data. + * Data cannot be updated after the crypto operation is finished. + * + * @param { DataBlob } data - indicates the data to be finally encrypted or decrypted. + * @param { AsyncCallback } callback - the callback of the doFinal function. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17620002 - runtime error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + doFinal(data: DataBlob, callback: AsyncCallback): void; + + /** + * Finish the crypto operation, encrypt or decrypt the input data, and then feed back the output data. + * Data cannot be updated after the crypto operation is finished. + * + * @param { DataBlob } data - indicates the data to be finally encrypted or decrypted. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17620002 - runtime error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + doFinal(data: DataBlob): Promise; + + /** + * Indicates the algorithm name of the Cipher object. + * + * @type { string } + * @readonly + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + readonly algName: string; + } + + /** + * Create a cipher object for encryption and decryption operations according to the given specifications. + * Two different Cipher objects should be created when using RSA encryption and decryption, + * even with the same specifications. + * + * @param { string } transformation - indicates the description to be transformed to cipher specifications. + * @returns { Cipher } the cipher object returned by the function. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 801 - this operation is not supported. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + function createCipher(transformation: string): Cipher; + + /** + * Provides sign function. + * + * @typedef Sign + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + interface Sign { + /** + * Used to init environment. + * + * @param { PriKey } priKey - the private key. + * @param { AsyncCallback } callback - the call back function return nothing. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17620002 - runtime error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + init(priKey: PriKey, callback: AsyncCallback): void; + + /** + * Used to init environment. + * + * @param { PriKey } priKey - the private key. + * @returns { Promise } return nothing. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17620002 - runtime error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + init(priKey: PriKey): Promise; + + /** + * Used to append the message need to be signed. + * + * @param { DataBlob } data - the data need to be signed. + * @param { AsyncCallback } callback - the call back function return nothing. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17620002 - runtime error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + update(data: DataBlob, callback: AsyncCallback): void; + + /** + * Used to append the message need to be signed. + * + * @param { DataBlob } data - the data need to be signed. + * @returns { Promise } return nothing. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17620002 - runtime error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + update(data: DataBlob): Promise; + + /** + * Used to sign message, include the update data. + * + * @param { DataBlob } data - the data need to be signed. + * @param { AsyncCallback } callback - return the signed message. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17620002 - runtime error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + sign(data: DataBlob, callback: AsyncCallback): void; + + /** + * Used to append the message need to be signed. + * + * @param { DataBlob } data - the private key. + * @returns { Promise } return the signed message. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17620002 - runtime error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + sign(data: DataBlob): Promise; + + /** + * The sign algName. + * + * @type { string } + * @readonly + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + readonly algName: string; + } + + /** + * Provides verify function. + * + * @typedef Verify + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + interface Verify { + /** + * Used to init environment. + * + * @param { PubKey } pubKey - the public key. + * @param { AsyncCallback } callback - return nothing. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17620002 - runtime error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + init(pubKey: PubKey, callback: AsyncCallback): void; + + /** + * Used to init environment. + * + * @param { PubKey } pubKey - the public key. + * @returns { Promise } return nothing. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17620002 - runtime error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + init(pubKey: PubKey): Promise; + + /** + * Used to append the message need to be verified. + * + * @param { DataBlob } data - the data need to be verified. + * @param { AsyncCallback } callback - return nothing. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17620002 - runtime error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + update(data: DataBlob, callback: AsyncCallback): void; + + /** + * Used to append the message need to be verified. + * + * @param { DataBlob } data - the data need to be verified. + * @returns { Promise } return nothing. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17620002 - runtime error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + update(data: DataBlob): Promise; + + /** + * Used to verify message, include the update data. + * + * @param { DataBlob } data - the data need to be verified. + * @param { DataBlob } signatureData - the signature data. + * @param { AsyncCallback } callback - return the verify result. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17620002 - runtime error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + verify(data: DataBlob, signatureData: DataBlob, callback: AsyncCallback): void; + + /** + * Used to verify message, include the update data. + * + * @param { DataBlob } data - the data need to be verified. + * @param { DataBlob } signatureData - the signature data. + * @returns { Promise } return the verify result. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17620002 - runtime error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + verify(data: DataBlob, signatureData: DataBlob): Promise; + + /** + * Indicates the verify algorithm name. + * + * @type { string } + * @readonly + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + readonly algName: string; + } + + /** + * Create sign class. + * + * @param { string } algName - indicates the algorithm name and params. + * @returns { Sign } the sign class. + * @throws { BusinessError } 401 - invalid parameters. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + function createSign(algName: string): Sign; + + /** + * Create verify class. + * + * @param { string } algName - indicates the algorithm name and params. + * @returns { Verify } the verify class. + * @throws { BusinessError } 401 - invalid parameters. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + function createVerify(algName: string): Verify; + + /** + * Provides key agreement function. + * + * @typedef KeyAgreement + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + interface KeyAgreement { + /** + * Used to generate secret. + * + * @param { PriKey } priKey - the private key. + * @param { PubKey } pubKey - the public key. + * @param { AsyncCallback } callback - return the secret. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17620002 - runtime error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + generateSecret(priKey: PriKey, pubKey: PubKey, callback: AsyncCallback): void; + + /** + * Used to generate secret. + * + * @param { PriKey } priKey - the private key. + * @param { PubKey } pubKey - the public key. + * @returns { Promise } the promise used to return secret. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 17620001 - memory error. + * @throws { BusinessError } 17620002 - runtime error. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + generateSecret(priKey: PriKey, pubKey: PubKey): Promise; + + /** + * Indicates the algorithm name. + * + * @type { string } + * @readonly * @syscap SystemCapability.Security.CryptoFramework * @since 9 */ - function createRandom() : Random; - - /** - * The AsyKeyGenerator provides the ability to generate or convert keyPair. - * @typedef AsyKeyGenerator - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - interface AsyKeyGenerator { - /** - * Used to generate asymmetric key pair. - * @param { AsyncCallback } callback - the callback used to return keypair. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - generateKeyPair(callback : AsyncCallback) : void; - - /** - * Used to generate asymmetric key pair. - * @returns { Promise } - the promise used to return keypair. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - generateKeyPair() : Promise; - - /** - * Used to convert asymmetric key pair . - * @param { DataBlob } pubKey - the public key data blob. - * @param { DataBlob } priKey - the private key data blob. - * @param { AsyncCallback } callback - the callback used to return keypair. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - convertKey(pubKey : DataBlob, priKey : DataBlob, callback : AsyncCallback) : void; - - /** - * Used to convert asymmetric key pair. - * @param { DataBlob } pubKey - the public key data blob. - * @param { DataBlob } priKey - the private key data blob. - * @returns { promise } - the promise used to return keypair. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - convertKey(pubKey : DataBlob, priKey : DataBlob) : Promise; - - /** - * The algName of the AsyKeyGenerator. - * @type { string } - * @syscap SystemCapability.Security.CryptoFramework - * @readonly - * @since 9 - */ - readonly algName : string; - } - - /** - * Provides the SymKeyGenerator type, which is used for generating symmetric key. - * @typedef SymKeyGenerator - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - interface SymKeyGenerator { - /** - * Generate a symmetric key object randomly. - * @param { AsyncCallback } callback - the callback of generateSymKey. - * @throws { BusinessError } 17620001 - memory error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - generateSymKey(callback : AsyncCallback) : void; - - /** - * Generate a symmetric key object randomly. - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 17620001 - memory error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - generateSymKey() : Promise; - - /** - * Generate a symmetric key object according to the provided binary key data. - * @param { AsyncCallback } callback - the callback of generateSymKey. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - convertKey(key : DataBlob, callback : AsyncCallback) : void; - - /** - * Generate a symmetric key object according to the provided binary key data. - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - convertKey(key : DataBlob) : Promise; - - /** - * Indicates the algorithm name of the SymKeyGenerator object. - * @type { string } - * @readonly - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - readonly algName : string; - } - - /** - * Provides the asymmetrical key generator instance func. - * @param { string } algName Indicates the algorithm name. - * @returns {AsyKeyGenerator} the generator obj create by algName. - * @throws { BusinessError } 401 - invalid parameters. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - function createAsyKeyGenerator(algName : string) : AsyKeyGenerator; - - /** - * Create a symmetric key generator according to the given algorithm name. - * @param { string } algName - indicates the algorithm name. - * @returns { SymKeyGenerator } the symmetric key generator instance. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 801 - this operation is not supported. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - function createSymKeyGenerator(algName : string) : SymKeyGenerator; - - interface Mac { - /** - * Init hmac with given SymKey. - * @param key Indicates the SymKey. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - init(key : SymKey, callback : AsyncCallback) : void; - init(key : SymKey) : Promise; - - /** - * Update hmac with DataBlob. - * @param input Indicates the DataBlob. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - update(input : DataBlob, callback : AsyncCallback) : void; - update(input : DataBlob) : Promise; - - /** - * Output the result of hmac calculation. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - doFinal(callback : AsyncCallback) : void; - doFinal() : Promise; - - /** - * Output the length of hmac result. - * @returns Returns the length of the hmac result. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - getMacLength() : number; - - /** - * Indicates the algorithm name. - * @type { string } - * @readonly - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - readonly algName : string; - } - - /** - * Provides the mac create func. - * @param algName Indicates the mac algorithm name. - * @returns Returns the created mac instance. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - function createMac(algName : string) : Mac; - - interface Md { - /** - * Update md with DataBlob. - * @param input Indicates the DataBlob. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - update(input : DataBlob, callback : AsyncCallback) : void; - update(input : DataBlob) : Promise; - - /** - * Output the result of md calculation. - * @returns Returns the calculated hmac result. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - digest(callback : AsyncCallback) : void; - digest() : Promise; - - /** - * Output the length of md result. - * @returns Returns the length of the hmac result. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - getMdLength() : number; - - /** - * Indicates the algorithm name. - * @type { string } - * @readonly - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - readonly algName : string; - } - - /** - * Provides the md create func. - * @param algName Indicates the md algorithm name. - * @returns Returns the created md instance. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - function createMd(algName : string) : Md; - - /** - * Provides the Cipher type, which is used for encryption and decryption operations. - * @typedef Cipher - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - interface Cipher { - /** - * Init the crypto operation with the given crypto mode, key and parameters. - * @param { CryptoMode } opMode - indicates the crypto mode is encryption or decryption. - * @param { Key } key - indicates the symmetric key or the asymmetric key. - * @param { ParamsSpec } params - indicates the algorithm parameters such as IV. - * @param { AsyncCallback } callback - the callback of the init function. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17620002 - runtime error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - init(opMode : CryptoMode, key : Key, params : ParamsSpec, callback : AsyncCallback) : void; - - /** - * Init the crypto operation with the given crypto mode, key and parameters. - * @param { CryptoMode } opMode - indicates the crypto mode is encryption or decryption. - * @param { Key } key - indicates the symmetric key or the asymmetric key. - * @param { ParamsSpec } params - indicates the algorithm parameters such as IV. - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17620002 - runtime error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - init(opMode : CryptoMode, key : Key, params : ParamsSpec) : Promise; - - /** - * Update the crypto operation with the input data, and feed back the encrypted or decrypted data - * this time. RSA is not supported in this function. - * @param { DataBlob } data - indicates the data to be encrypted or decrypted. - * @param { AsyncCallback } callback - the callback of the update function. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17620002 - runtime error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - update(data : DataBlob, callback : AsyncCallback) : void; - - /** - * Update the crypto operation with the input data, and feed back the encrypted or decrypted data - * this time. RSA is not supported in this function. - * @param { DataBlob } data - indicates the data to be encrypted or decrypted. - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17620002 - runtime error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - update(data : DataBlob) : Promise; - - /** - * Finish the crypto operation, encrypt or decrypt the input data, and then feed back the output data. - * Data cannot be updated after the crypto operation is finished. - * @param { DataBlob } data - indicates the data to be finally encrypted or decrypted. - * @param { AsyncCallback } callback - the callback of the doFinal function. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17620002 - runtime error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - doFinal(data : DataBlob, callback : AsyncCallback) : void; - - /** - * Finish the crypto operation, encrypt or decrypt the input data, and then feed back the output data. - * Data cannot be updated after the crypto operation is finished. - * @param { DataBlob } data - indicates the data to be finally encrypted or decrypted. - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17620002 - runtime error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - doFinal(data : DataBlob) : Promise; - - /** - * Indicates the algorithm name of the Cipher object. - * @type { string } - * @readonly - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - readonly algName : string; - } - - /** - * Create a cipher object for encryption and decryption operations according to the given specifications. - * Two different Cipher objects should be created when using RSA encryption and decryption, - * even with the same specifications. - * @param { string } transformation - Indicates the description to be transformed to cipher specifications. - * @returns { Cipher } the cipher object returned by the function. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 801 - this operation is not supported. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - function createCipher(transformation : string) : Cipher; - - /** - * Provides sign function. - * @typedef Sign - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - interface Sign { - /** - * Used to init environment. - * @param { PriKey } priKey - the private key. - * @param { AsyncCallback } callback - return nothing. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17620002 - runtime error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - init(priKey : PriKey, callback : AsyncCallback) : void; - - /** - * Used to init environment. - * @param { PriKey } priKey - the private key. - * @returns { promise } - return nothing. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17620002 - runtime error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - init(priKey : PriKey) : Promise; - - /** - * Used to append the message need to be signed. - * @param { DataBlob } data - the data need to be signed. - * @param { AsyncCallback } callback - return nothing. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17620002 - runtime error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - update(data : DataBlob, callback : AsyncCallback) : void; - - /** - * Used to append the message need to be signed. - * @param { DataBlob } data - the data need to be signed. - * @returns { promise } - return nothing. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17620002 - runtime error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - update(data : DataBlob) : Promise; - - /** - * Used to sign message, include the update data. - * @param { DataBlob } data - the data need to be signed. - * @param { AsyncCallback } callback - return the signed message. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17620002 - runtime error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - sign(data : DataBlob, callback : AsyncCallback) : void; - - /** - * Used to append the message need to be signed. - * @param { DataBlob } data - the private key. - * @returns { promise } - return the signed message. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17620002 - runtime error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - sign(data : DataBlob) : Promise; - - /** - * The sign algName. - * @type { string } - * @syscap SystemCapability.Security.CryptoFramework - * @readonly - * @since 9 - */ - readonly algName : string; - } - - /** - * Provides verify function. - * @typedef Verify - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - interface Verify { - /** - * Used to init environment. - * @param { PubKey } pubKey - the public key. - * @param { AsyncCallback } callback - return nothing. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17620002 - runtime error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - init(pubKey : PubKey, callback : AsyncCallback) : void; - - /** - * Used to init environment. - * @param { PubKey } pubKey - the public key. - * @returns { promise } - return nothing. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17620002 - runtime error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - init(pubKey : PubKey) : Promise; - - /** - * Used to append the message need to be verified. - * @param { DataBlob } data - the data need to be verified. - * @param { AsyncCallback } callback - return nothing. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17620002 - runtime error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - update(data : DataBlob, callback : AsyncCallback) : void; - - /** - * Used to append the message need to be verified. - * @param { DataBlob } data - the data need to be verified. - * @returns { promise } - return nothing. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17620002 - runtime error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - update(data : DataBlob) : Promise; - - /** - * Used to verify message, include the update data. - * @param { DataBlob } data - the data need to be verified. - * @param { DataBlob } signatureData - the signature data. - * @param { AsyncCallback } callback - return the verify result. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17620002 - runtime error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - verify(data : DataBlob, signatureData : DataBlob, callback : AsyncCallback) : void; - - /** - * Used to verify message, include the update data. - * @param { DataBlob } data - the data need to be verified. - * @param { DataBlob } signatureData - the signature data. - * @returns { Promise } callback - return the verify result. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17620002 - runtime error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - verify(data : DataBlob, signatureData : DataBlob) : Promise; - - /** - * Indicates the verify algorithm name. - * @type { string } - * @readonly - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - readonly algName : string; - } - - /** - * Create sign class. - * @param { string } algName - Indicates the algorithm name and params. - * @returns { Sign } the sign class. - * @throws { BusinessError } 401 - invalid parameters. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - function createSign(algName : string) : Sign; - - /** - * Create verify class. - * @param { string } algName - Indicates the algorithm name and params. - * @returns { Verify } the verify class. - * @throws { BusinessError } 401 - invalid parameters. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - function createVerify(algName : string) : Verify; - - /** - * Provides key agreement function. - * @typedef KeyAgreement - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - interface KeyAgreement { - /** - * Used to generate secret. - * @param { PriKey } priKey - the private key. - * @param { PubKey } pubKey - the public key. - * @param { AsyncCallback } callback - return the secret. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17620002 - runtime error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - generateSecret(priKey : PriKey, pubKey : PubKey, callback : AsyncCallback) : void; - - /** - * Used to generate secret. - * @param { PriKey } priKey - the private key. - * @param { PubKey } pubKey - the public key. - * @returns { Promise } the promise used to return secret. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 17620001 - memory error. - * @throws { BusinessError } 17620002 - runtime error. - * @throws { BusinessError } 17630001 - crypto operation error. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - generateSecret(priKey : PriKey, pubKey : PubKey) : Promise; - - /** - * Indicates the algorithm name. - * @type { string } - * @readonly - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - readonly algName : string; - } - - /** - * Create key agreement class. - * @param { string } algName - Indicates the algorithm name and params. - * @returns { KeyAgreement } the key agreement class. - * @throws { BusinessError } 401 - invalid parameters. - * @syscap SystemCapability.Security.CryptoFramework - * @since 9 - */ - function createKeyAgreement(algName : string) : KeyAgreement; + readonly algName: string; + } + + /** + * Create key agreement class. + * + * @param { string } algName - indicates the algorithm name and params. + * @returns { KeyAgreement } the key agreement class. + * @throws { BusinessError } 401 - invalid parameters. + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ + function createKeyAgreement(algName: string): KeyAgreement; } export default cryptoFramework; -- Gitee From a7de86d95583343a5c275271a8e4b0871151a5c0 Mon Sep 17 00:00:00 2001 From: lanlanlan Date: Wed, 22 Mar 2023 02:40:30 +0000 Subject: [PATCH 2/4] update api/@system.cipher.d.ts. Signed-off-by: lanlanlan --- api/@system.cipher.d.ts | 93 +++++++++++++++++++++++++++++++---------- 1 file changed, 72 insertions(+), 21 deletions(-) diff --git a/api/@system.cipher.d.ts b/api/@system.cipher.d.ts index a22cffdfae..0ec7cb82e1 100644 --- a/api/@system.cipher.d.ts +++ b/api/@system.cipher.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Huawei Device Co., Ltd. + * Copyright (c) 2020-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -15,24 +15,30 @@ /** * Defines the cipher response. - * @since 3 - * @syscap SystemCapability.Security.Cipher + * + * @typedef CipherResponse * @permission N/A + * @syscap SystemCapability.Security.Cipher + * @since 3 */ export interface CipherResponse { /** * response text - * @since 3 + * + * @permission N/A * @syscap SystemCapability.Security.Cipher + * @since 3 */ text: string; } /** * Defines the rsa cipher options. - * @since 3 - * @syscap SystemCapability.Security.Cipher + * + * @typedef CipherRsaOptions * @permission N/A + * @syscap SystemCapability.Security.Cipher + * @since 3 */ export interface CipherRsaOptions { /** @@ -40,8 +46,10 @@ export interface CipherRsaOptions { * The options are as follows: * encrypt: Encrypts data. * decrypt: Decrypts data. - * @since 3 + * + * @permission N/A * @syscap SystemCapability.Security.Cipher + * @since 3 */ action: string; @@ -52,8 +60,10 @@ export interface CipherRsaOptions { * For example, if the key length is 1024 bytes, the text cannot exceed 62 bytes (1024/8 - 66 = 62). * The text content to be decrypted must be a binary value encoded using Base64. * The default format is used for Base64 encoding. - * @since 3 + * + * @permission N/A * @syscap SystemCapability.Security.Cipher + * @since 3 */ text: string; @@ -61,46 +71,58 @@ export interface CipherRsaOptions { * Keys encrypted using RSA. * During encryption, this parameter is a public key. * During decryption, it is a private key. - * @since 3 + * + * @permission N/A * @syscap SystemCapability.Security.Cipher + * @since 3 */ key: string; /** * RSA algorithm padding. * The default value is RSA/None/OAEPWithSHA256AndMGF1Padding. - * @since 3 + * + * @permission N/A * @syscap SystemCapability.Security.Cipher + * @since 3 */ transformation?: string; /** * Called when data is encrypted or decrypted successfully. - * @since 3 + * + * @permission N/A * @syscap SystemCapability.Security.Cipher + * @since 3 */ success: (data: CipherResponse) => void; /** * Called when data fails to be encrypted or decrypted. - * @since 3 + * + * @permission N/A * @syscap SystemCapability.Security.Cipher + * @since 3 */ fail: (data: string, code: number) => void; /** * Called when the execution is completed. - * @since 3 + * + * @permission N/A * @syscap SystemCapability.Security.Cipher + * @since 3 */ complete: () => void; } /** * Defines the aes cipher options. - * @since 3 - * @syscap SystemCapability.Security.Cipher + * + * @typedef CipherAesOptions * @permission N/A + * @syscap SystemCapability.Security.Cipher + * @since 3 */ export interface CipherAesOptions { /** @@ -108,6 +130,8 @@ export interface CipherAesOptions { * The options are as follows: * encrypt: Encrypts data. * decrypt: Decrypts data. + * + * @permission N/A * @syscap SystemCapability.Security.Cipher * @since 3 */ @@ -118,6 +142,8 @@ export interface CipherAesOptions { * The text to be encrypted must be a common text. * The text content to be decrypted must be a binary value encoded using Base64. * The default format is used for Base64 encoding. + * + * @permission N/A * @syscap SystemCapability.Security.Cipher * @since 3 */ @@ -125,6 +151,8 @@ export interface CipherAesOptions { /** * Key used for encryption or decryption, which is a character string encrypted using Base64. + * + * @permission N/A * @syscap SystemCapability.Security.Cipher * @since 3 */ @@ -133,6 +161,8 @@ export interface CipherAesOptions { /** * Encryption mode and padding of the AES algorithm. * The default value is AES/CBC/PKCS5Padding. + * + * @permission N/A * @syscap SystemCapability.Security.Cipher * @since 3 */ @@ -142,6 +172,8 @@ export interface CipherAesOptions { * Initial vector for AES-based encryption and decryption. * The value is a character string encoded using Base64. * The default value is the key value. + * + * @permission N/A * @syscap SystemCapability.Security.Cipher * @since 3 */ @@ -150,6 +182,8 @@ export interface CipherAesOptions { /** * Offset of the initial vector for AES-based encryption and decryption. * The default value is 0. + * + * @permission N/A * @syscap SystemCapability.Security.Cipher * @since 3 */ @@ -158,6 +192,8 @@ export interface CipherAesOptions { /** * Length of the initial vector for AES-based encryption and decryption. * The default value is 16. + * + * @permission N/A * @syscap SystemCapability.Security.Cipher * @since 3 */ @@ -165,6 +201,8 @@ export interface CipherAesOptions { /** * Called when data is encrypted or decrypted successfully. + * + * @permission N/A * @syscap SystemCapability.Security.Cipher * @since 3 */ @@ -172,6 +210,8 @@ export interface CipherAesOptions { /** * Called when data fails to be encrypted or decrypted. + * + * @permission N/A * @syscap SystemCapability.Security.Cipher * @since 3 */ @@ -179,6 +219,8 @@ export interface CipherAesOptions { /** * Called when the execution is completed. + * + * @permission N/A * @syscap SystemCapability.Security.Cipher * @since 3 */ @@ -187,26 +229,35 @@ export interface CipherAesOptions { /** * Defines the cipher functions. + * + * @permission N/A + * @syscap SystemCapability.Security.Cipher * @since 3 * @deprecated since 9 * @useinstead ohos.security.cryptoFramework.Cipher - * @syscap SystemCapability.Security.Cipher - * @permission N/A */ export default class Cipher { /** * Encrypts or decrypts data using RSA. - * @deprecated since 9 - * @param options RSA options + * + * @permission N/A + * @param { CipherRsaOptions } options - RSA options * @syscap SystemCapability.Security.Cipher + * @since 3 + * @deprecated since 9 + * @useinstead ohos.security.cryptoFramework.Cipher */ static rsa(options: CipherRsaOptions): void; /** * Encrypts or decrypts data using AES. - * @deprecated since 9 - * @param options AES options + * + * @permission N/A + * @param { CipherAesOptions } options - AES options * @syscap SystemCapability.Security.Cipher + * @since 3 + * @deprecated since 9 + * @useinstead ohos.security.cryptoFramework.Cipher */ static aes(options: CipherAesOptions): void; } -- Gitee From 689a9e5547c019f373688912a7bdf8bdce8d919c Mon Sep 17 00:00:00 2001 From: lanlanlan Date: Wed, 22 Mar 2023 02:41:17 +0000 Subject: [PATCH 3/4] update api/@ohos.security.cert.d.ts. Signed-off-by: lanlanlan --- api/@ohos.security.cert.d.ts | 1570 ++++++++++++++++++---------------- 1 file changed, 825 insertions(+), 745 deletions(-) diff --git a/api/@ohos.security.cert.d.ts b/api/@ohos.security.cert.d.ts index 124d83a27e..5ffc45b066 100644 --- a/api/@ohos.security.cert.d.ts +++ b/api/@ohos.security.cert.d.ts @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,805 +13,784 @@ * limitations under the License. */ -import {AsyncCallback, Callback} from './basic'; -import cryptoFramework from '@ohos.security.cryptoFramework' +import { AsyncCallback, Callback } from './basic'; +import cryptoFramework from '@ohos.security.cryptoFramework'; /** * Provides a set of cert operation, shields the underlying differences, * encapsulates the relevant algorithm library, and provides a unified functional interface upward. + * * @namespace cert * @syscap SystemCapability.Security.Cert * @since 9 */ declare namespace cert { + /** + * Enum for result code + * + * @enum { number } + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + enum CertResult { /** - * Enum for result code - * @enum {number} + * Indicates that input parameters is invalid. + * * @syscap SystemCapability.Security.Cert * @since 9 */ - enum CertResult { - /** Indicates that input parameters is invalid. - * @since 9 - */ - INVALID_PARAMS = 401, + INVALID_PARAMS = 401, - /** Indicates that function or algorithm is not supported. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - NOT_SUPPORT = 801, + /** + * Indicates that function or algorithm is not supported. + * + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + NOT_SUPPORT = 801, - /** Indicates the memory error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - ERR_OUT_OF_MEMORY = 19020001, + /** + * Indicates the memory error. + * + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + ERR_OUT_OF_MEMORY = 19020001, - /** Indicates that runtime error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - ERR_RUNTIME_ERROR = 19020002, + /** + * Indicates that runtime error. + * + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + ERR_RUNTIME_ERROR = 19020002, - /** Indicates the crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - ERR_CRYPTO_OPERATION = 19030001, + /** + * Indicates the crypto operation error. + * + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + ERR_CRYPTO_OPERATION = 19030001, - /* Indicates that the certificate signature verification failed. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - ERR_CERT_SIGNATURE_FAILURE = 19030002, + /* Indicates that the certificate signature verification failed. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + ERR_CERT_SIGNATURE_FAILURE = 19030002, - /* Indicates that the certificate has not taken effect. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - ERR_CERT_NOT_YET_VALID = 19030003, + /* Indicates that the certificate has not taken effect. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + ERR_CERT_NOT_YET_VALID = 19030003, - /* Indicates that the certificate has expired. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - ERR_CERT_HAS_EXPIRED = 19030004, + /* Indicates that the certificate has expired. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + ERR_CERT_HAS_EXPIRED = 19030004, - /* Indicates that we failed to obtain the certificate issuer.. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY = 19030005, + /* Indicates that we failed to obtain the certificate issuer.. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY = 19030005, - /* The key cannot be used for signing a certificate. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - ERR_KEYUSAGE_NO_CERTSIGN = 19030006, - - /* The key cannot be used for digital signature. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE = 19030007, - } + /* The key cannot be used for signing a certificate. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + ERR_KEYUSAGE_NO_CERTSIGN = 19030006, + /* The key cannot be used for digital signature. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE = 19030007 + } + + /** + * Provides the data blob type. + * + * @typedef DataBlob + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + interface DataBlob { + data: Uint8Array; + } + + /** + * Provides the data array type. + * + * @typedef DataArray + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + interface DataArray { + data: Array; + } + + /** + * Enum for supported cert encoding format. + * + * @enum { number } + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + enum EncodingFormat { /** - * Provides the data blob type. - * @typedef DataBlob + * The value of cert DER format. + * * @syscap SystemCapability.Security.Cert * @since 9 */ - interface DataBlob { - data : Uint8Array; - } + FORMAT_DER = 0, - /** - * Provides the data array type. - * @typedef DataArray + /** + * The value of cert PEM format. + * + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + FORMAT_PEM = 1 + } + + /** + * Provides the cert encoding blob type. + * + * @typedef EncodingBlob + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + interface EncodingBlob { + /** + * The data input. + * + * @type { Uint8Array } + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + data: Uint8Array; + /** + * The data encoding format. + * + * @type { EncodingFormat } + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + encodingFormat: EncodingFormat; + } + + /** + * Provides the cert chain data type. + * + * @typedef CertChainData + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + interface CertChainData { + /** + * The data input. + * + * @type { Uint8Array } * @syscap SystemCapability.Security.Cert - * @since 9 - */ - interface DataArray { - data : Array; - } - - /** - * Enum for supported cert encoding format. - * @enum {number} - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - enum EncodingFormat { - /** - * The value of cert DER format. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - FORMAT_DER = 0, - - /** - * The value of cert PEM format. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - FORMAT_PEM = 1, - } - - /** - * Provides the cert encoding blob type. - * @typedef EncodingBlob - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - interface EncodingBlob { - /** - * The data input. - * @type { Uint8Array } - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - data : Uint8Array; - /** - * The data encoding format. - * @type { EncodingFormat } - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - encodingFormat : EncodingFormat; - } - - /** - * Provides the cert chain data type. - * @typedef CertChainData - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - interface CertChainData { - /** - * The data input. - * @type { Uint8Array } - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - data: Uint8Array; - /** - * The number of certs. - * @type { number } - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - count : number; - /** - * The data encoding format. - * @type { EncodingFormat } - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - encodingFormat: EncodingFormat; - } - - /** - * Provides the x509 cert type. - * @typedef X509Cert - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - interface X509Cert { - /** - * Verify the X509 cert. - * @param { cryptoFramework.PubKey } key - public key to verify cert. - * @param { AsyncCallback } callback - the callback of verify. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - verify(key : cryptoFramework.PubKey, callback : AsyncCallback) : void; - - /** - * Verify the X509 cert. - * @param { cryptoFramework.PubKey } key - public key to verify cert. - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - verify(key : cryptoFramework.PubKey) : Promise; - - /** - * Get X509 cert encoded data. - * @param { AsyncCallback } callback - the callback of getEncoded. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getEncoded(callback : AsyncCallback) : void; - - /** - * Get X509 cert encoded data. - * @returns { Promise } the promise of X509 cert encoded data. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getEncoded() : Promise; - - /** - * Get X509 cert public key. - * @returns { cryptoFramework.PubKey } X509 cert pubKey. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getPublicKey() : cryptoFramework.PubKey; - - /** - * Check the X509 cert validity with date. - * @param date Indicates the cert date. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @throws { BusinessError } 19030003 - the certificate has not taken effect. - * @throws { BusinessError } 19030004 - the certificate has expired. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - checkValidityWithDate(date: string) : void; - - /** - * Get X509 cert version. - * @returns { number } X509 cert version. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getVersion() : number; - - /** - * Get X509 cert serial number. - * - * @returns { number } X509 cert serial number. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getSerialNumber() : number; - - /** - * Get X509 cert issuer name. - * @returns { DataBlob } X509 cert issuer name. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getIssuerName() : DataBlob; - - /** - * Get X509 cert subject name. - * @returns { DataBlob } X509 cert subject name. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getSubjectName() : DataBlob; - - /** - * Get X509 cert not before time. - * @returns { string } X509 cert not before time. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getNotBeforeTime() : string; - - /** - * Get X509 cert not after time. - * @returns { string } X509 cert not after time. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getNotAfterTime() : string; - - /** - * Get X509 cert signature. - * @returns { DataBlob } X509 cert signature. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getSignature() : DataBlob; - - /** - * Get X509 cert signature's algorithm name. - * @returns { string } X509 cert signature's algorithm name. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getSignatureAlgName() : string; - - /** - * Get X509 cert signature's algorithm oid. - * @returns { string } X509 cert signature's algorithm oid. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getSignatureAlgOid() : string; - - /** - * Get X509 cert signature's algorithm name. - * @returns { DataBlob } X509 cert signature's algorithm name. - * @throws { BusinessError } 801 - this operation is not supported. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getSignatureAlgParams() : DataBlob; - - /** - * Get X509 cert key usage. - * @returns { DataBlob } X509 cert key usage. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getKeyUsage() : DataBlob; - - /** - * Get X509 cert extended key usage. - * @returns { DataArray } X509 cert extended key usage. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getExtKeyUsage() : DataArray; - - /** - * Get X509 cert basic constraints path len. - * @returns { number } X509 cert basic constraints path len. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getBasicConstraints() : number; - - /** - * Get X509 cert subject alternative name. - * @returns { DataArray } X509 cert subject alternative name. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getSubjectAltNames() : DataArray; - - /** - * Get X509 cert issuer alternative name. - * @returns { DataArray } X509 cert issuer alternative name. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getIssuerAltNames() : DataArray; - } - - /** - * Provides the x509 cert func. - * @param { EncodingBlob } inStream - indicate the input cert data. - * @param { AsyncCallback } callback - the callback of createX509Cert. + * @since 9 + */ + data: Uint8Array; + /** + * The number of certs. + * + * @type { number } + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + count: number; + /** + * The data encoding format. + * + * @type { EncodingFormat } + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + encodingFormat: EncodingFormat; + } + + /** + * Provides the x509 cert type. + * + * @typedef X509Cert + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + interface X509Cert { + /** + * Verify the X509 cert. + * + * @param { cryptoFramework.PubKey } key - public key to verify cert. + * @param { AsyncCallback } callback - the callback of verify. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + verify(key: cryptoFramework.PubKey, callback: AsyncCallback): void; + + /** + * Verify the X509 cert. + * + * @param { cryptoFramework.PubKey } key - public key to verify cert. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + verify(key: cryptoFramework.PubKey): Promise; + + /** + * Get X509 cert encoded data. + * + * @param { AsyncCallback } callback - the callback of getEncoded. * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 801 - this operation is not supported. * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. * @syscap SystemCapability.Security.Cert * @since 9 */ - function createX509Cert(inStream : EncodingBlob, callback : AsyncCallback) : void; + getEncoded(callback: AsyncCallback): void; /** - * Provides the x509 cert func. - * @param { EncodingBlob } inStream - indicate the input cert data. - * @returns { Promise } the promise of X509 cert instance. + * Get X509 cert encoded data. + * + * @returns { Promise } the promise of X509 cert encoded data. * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 801 - this operation is not supported. * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getEncoded(): Promise; + + /** + * Get X509 cert public key. + * + * @returns { cryptoFramework.PubKey } X509 cert pubKey. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19030001 - crypto operation error. * @syscap SystemCapability.Security.Cert * @since 9 */ - function createX509Cert(inStream : EncodingBlob) : Promise; - - /** - * Interface of X509CrlEntry. - * @typedef X509CrlEntry - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - interface X509CrlEntry { - /** - * Returns the ASN of this CRL entry 1 der coding form, i.e. internal sequence. - * @param { AsyncCallback } callback - the callback of getEncoded. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getEncoded(callback : AsyncCallback) : void; - - /** - * Returns the ASN of this CRL entry 1 der coding form, i.e. internal sequence. - * @returns { Promise } the promise of crl entry blob data. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getEncoded() : Promise; - - /** - * Get the serial number from this x509crl entry. - * @returns serial number of crl entry. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getSerialNumber() : number; - - /** - * Get the issuer of the x509 certificate described by this entry. - * @returns DataBlob of issuer. - * @throws { BusinessError } 801 - this operation is not supported. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getCertIssuer() : DataBlob; - - /** - * Get the revocation date from x509crl entry. - * @returns string of revocation date. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getRevocationDate() : string; - } - - /** - * Interface of X509Crl. - * @typedef X509Crl - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - interface X509Crl { - /** - * Check if the given certificate is on this CRL. - * @param { X509Cert } cert - input cert data. - * @returns {boolean} result of Check cert is revoked or not. - * @throws { BusinessError } 401 - invalid parameters. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - isRevoked(cert : X509Cert) : boolean; - - /** - * Returns the type of this CRL. - * @returns string of crl type. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getType() : string; - - /** - * Get the der coding format. - * @param { AsyncCallback } callback - the callback of getEncoded. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getEncoded(callback : AsyncCallback) : void; - - /** - * Get the der coding format. - * @returns {Promise} the promise of crl blob data. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getEncoded() : Promise; - - /** - * Use the public key to verify the signature of CRL. - * @param { cryptoFramework.PubKey } key - input public Key. - * @param { AsyncCallback } callback - the callback of getEncoded. - * @returns verify result. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - verify(key : cryptoFramework.PubKey, callback : AsyncCallback) : void; - - /** - * Use the public key to verify the signature of CRL. - * @param { cryptoFramework.PubKey } key - input public Key. - * @returns {Promise} the promise returned by the function. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - verify(key : cryptoFramework.PubKey) : Promise; - - /** - * Get version number from CRL. - * @returns version of crl. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getVersion() : number; - - /** - * Get the issuer name from CRL. Issuer means the entity that signs and publishes the CRL. - * @returns issuer name of crl. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getIssuerName() : DataBlob; - - /** - * Get lastUpdate value from CRL. - * @returns last update of crl. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getLastUpdate() : string; - - /** - * Get nextUpdate value from CRL. - * @returns next update of crl. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getNextUpdate() : string; - - /** - * This method can be used to find CRL entries in specified CRLs. - * @param { number } serialNumber - serial number of crl. - * @returns next update of crl. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getRevokedCert(serialNumber : number) : X509CrlEntry; - - /** - * This method can be used to find CRL entries in specified cert. - * @param { X509Cert } cert - cert of x509. - * @returns X509CrlEntry instance. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getRevokedCertWithCert(cert : X509Cert) : X509CrlEntry; - - /** - * Get all entries in this CRL. - * @param { AsyncCallback> } callback - the callback of getRevokedCerts. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getRevokedCerts(callback : AsyncCallback>) : void; - - /** - * Get all entries in this CRL. - * @returns { Promise> } the promise of X509CrlEntry instance. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getRevokedCerts() : Promise>; - - /** - * Get the CRL information encoded by Der from this CRL. - * @returns DataBlob of tbs info. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getTbsInfo() : DataBlob; - - /** - * Get signature value from CRL. - * @returns DataBlob of signature. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getSignature() : DataBlob; - - /** - * Get the signature algorithm name of the CRL signature algorithm. - * @returns string of signature algorithm name. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getSignatureAlgName() : string; - - /** - * Get the signature algorithm oid string from CRL. - * @returns string of signature algorithm oid. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getSignatureAlgOid() : string; - - /** - * Get the der encoded signature algorithm parameters from the CRL signature algorithm. - * @returns DataBlob of signature algorithm params. - * @throws { BusinessError } 801 - this operation is not supported. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - getSignatureAlgParams() : DataBlob; - } - - /** - * Provides the x509 CRL func. - * @param {EncodingBlob} inStream - indicates the input CRL data. - * @param { AsyncCallback } callback - the callback of createX509Crl to return x509 CRL instance. + getPublicKey(): cryptoFramework.PubKey; + + /** + * Check the X509 cert validity with date. + * + * @param { string } date - indicates the cert date. * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @throws { BusinessError } 19030003 - the certificate has not taken effect. + * @throws { BusinessError } 19030004 - the certificate has expired. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + checkValidityWithDate(date: string): void; + + /** + * Get X509 cert version. + * + * @returns { number } X509 cert version. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getVersion(): number; + + /** + * Get X509 cert serial number. + * + * @returns { number } X509 cert serial number. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getSerialNumber(): number; + + /** + * Get X509 cert issuer name. + * + * @returns { DataBlob } X509 cert issuer name. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getIssuerName(): DataBlob; + + /** + * Get X509 cert subject name. + * + * @returns { DataBlob } X509 cert subject name. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getSubjectName(): DataBlob; + + /** + * Get X509 cert not before time. + * + * @returns { string } X509 cert not before time. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getNotBeforeTime(): string; + + /** + * Get X509 cert not after time. + * + * @returns { string } X509 cert not after time. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getNotAfterTime(): string; + + /** + * Get X509 cert signature. + * + * @returns { DataBlob } X509 cert signature. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getSignature(): DataBlob; + + /** + * Get X509 cert signature's algorithm name. + * + * @returns { string } X509 cert signature's algorithm name. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getSignatureAlgName(): string; + + /** + * Get X509 cert signature's algorithm oid. + * + * @returns { string } X509 cert signature's algorithm oid. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getSignatureAlgOid(): string; + + /** + * Get X509 cert signature's algorithm name. + * + * @returns { DataBlob } X509 cert signature's algorithm name. * @throws { BusinessError } 801 - this operation is not supported. * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getSignatureAlgParams(): DataBlob; + + /** + * Get X509 cert key usage. + * + * @returns { DataBlob } X509 cert key usage. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getKeyUsage(): DataBlob; + + /** + * Get X509 cert extended key usage. + * + * @returns { DataArray } X509 cert extended key usage. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getExtKeyUsage(): DataArray; + + /** + * Get X509 cert basic constraints path len. + * + * @returns { number } X509 cert basic constraints path len. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getBasicConstraints(): number; + + /** + * Get X509 cert subject alternative name. + * + * @returns { DataArray } X509 cert subject alternative name. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. * @syscap SystemCapability.Security.Cert * @since 9 */ - function createX509Crl(inStream : EncodingBlob, callback : AsyncCallback) : void; + getSubjectAltNames(): DataArray; /** - * Provides the x509 CRL func. - * @param {EncodingBlob} inStream - indicates the input CRL data. - * @returns { Promise } the promise of x509 CRL instance. + * Get X509 cert issuer alternative name. + * + * @returns { DataArray } X509 cert issuer alternative name. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getIssuerAltNames(): DataArray; + } + + /** + * Provides the x509 cert func. + * + * @param { EncodingBlob } inStream - indicate the input cert data. + * @param { AsyncCallback } callback - the callback of createX509Cert. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 801 - this operation is not supported. + * @throws { BusinessError } 19020001 - memory error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + function createX509Cert(inStream: EncodingBlob, callback: AsyncCallback): void; + + /** + * Provides the x509 cert func. + * + * @param { EncodingBlob } inStream - indicate the input cert data. + * @returns { Promise } the promise of X509 cert instance. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 801 - this operation is not supported. + * @throws { BusinessError } 19020001 - memory error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + function createX509Cert(inStream: EncodingBlob): Promise; + + /** + * Interface of X509CrlEntry. + * + * @typedef X509CrlEntry + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + interface X509CrlEntry { + /** + * Returns the ASN of this CRL entry 1 der coding form, i.e. internal sequence. + * + * @param { AsyncCallback } callback - the callback of getEncoded. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getEncoded(callback: AsyncCallback): void; + + /** + * Returns the ASN of this CRL entry 1 der coding form, i.e. internal sequence. + * + * @returns { Promise } the promise of crl entry blob data. * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getEncoded(): Promise; + + /** + * Get the serial number from this x509crl entry. + * + * @returns { number } serial number of crl entry. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getSerialNumber(): number; + + /** + * Get the issuer of the x509 certificate described by this entry. + * + * @returns { DataBlob } DataBlob of issuer. * @throws { BusinessError } 801 - this operation is not supported. * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getCertIssuer(): DataBlob; + + /** + * Get the revocation date from x509crl entry. + * + * @returns { string } string of revocation date. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getRevocationDate(): string; + } + + /** + * Interface of X509Crl. + * + * @typedef X509Crl + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + interface X509Crl { + /** + * Check if the given certificate is on this CRL. + * + * @param { X509Cert } cert - input cert data. + * @returns { boolean } result of Check cert is revoked or not. + * @throws { BusinessError } 401 - invalid parameters. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + isRevoked(cert: X509Cert): boolean; + + /** + * Returns the type of this CRL. + * + * @returns { string } string of crl type. * @syscap SystemCapability.Security.Cert * @since 9 */ - function createX509Crl(inStream : EncodingBlob) : Promise; - - /** - * Certification chain validator. - * @typedef CertChainValidator - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - interface CertChainValidator { - /** - * Validate the cert chain. - * @param { CertChainData } certChain - indicate the cert chain validator data. - * @param { AsyncCallback } callback - the callback of validate. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @throws { BusinessError } 19030002 - the certificate signature verification failed. - * @throws { BusinessError } 19030003 - the certificate has not taken effect. - * @throws { BusinessError } 19030004 - the certificate has expired. - * @throws { BusinessError } 19030005 - failed to obtain the certificate issuer. - * @throws { BusinessError } 19030006 - the key cannot be used for signing a certificate. - * @throws { BusinessError } 19030007 - the key cannot be used for digital signature. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - validate(certChain : CertChainData, callback : AsyncCallback) : void; - - /** - * Validate the cert chain. - * @param { CertChainData } certChain - indicate the cert chain validator data. - * @returns { Promise } the promise returned by the function. - * @throws { BusinessError } 401 - invalid parameters. - * @throws { BusinessError } 19020001 - memory error. - * @throws { BusinessError } 19020002 - runtime error. - * @throws { BusinessError } 19030001 - crypto operation error. - * @throws { BusinessError } 19030002 - the certificate signature verification failed. - * @throws { BusinessError } 19030003 - the certificate has not taken effect. - * @throws { BusinessError } 19030004 - the certificate has expired. - * @throws { BusinessError } 19030005 - failed to obtain the certificate issuer. - * @throws { BusinessError } 19030006 - the key cannot be used for signing a certificate. - * @throws { BusinessError } 19030007 - the key cannot be used for digital signature. - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - validate(certChain : CertChainData) : Promise; - - /** - * The cert chain related algorithm. - * @type { string } - * @readonly - * @syscap SystemCapability.Security.Cert - * @since 9 - */ - readonly algorithm : string; - } - - /** - * Provides the cert chain validator func. - * @param { string } algorithm - indicates the cert chain validator type. - * @returns the cert chain validator instance. + getType(): string; + + /** + * Get the der coding format. + * + * @param { AsyncCallback } callback - the callback of getEncoded. * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getEncoded(callback: AsyncCallback): void; + + /** + * Get the der coding format. + * + * @returns { Promise } the promise of crl blob data. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getEncoded(): Promise; + + /** + * Use the public key to verify the signature of CRL. + * + * @param { cryptoFramework.PubKey } key - input public Key. + * @param { AsyncCallback } callback - the callback of getEncoded. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + verify(key: cryptoFramework.PubKey, callback: AsyncCallback): void; + + /** + * Use the public key to verify the signature of CRL. + * + * @param { cryptoFramework.PubKey } key - input public Key. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + verify(key: cryptoFramework.PubKey): Promise; + + /** + * Get version number from CRL. + * + * @returns { number } version of crl. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getVersion(): number; + + /** + * Get the issuer name from CRL. Issuer means the entity that signs and publishes the CRL. + * + * @returns { DataBlob } issuer name of crl. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getIssuerName(): DataBlob; + + /** + * Get lastUpdate value from CRL. + * + * @returns { string } last update of crl. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getLastUpdate(): string; + + /** + * Get nextUpdate value from CRL. + * + * @returns { string } next update of crl. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getNextUpdate(): string; + + /** + * This method can be used to find CRL entries in specified CRLs. + * + * @param { number } serialNumber - serial number of crl. + * @returns { X509CrlEntry } next update of crl. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getRevokedCert(serialNumber: number): X509CrlEntry; + + /** + * This method can be used to find CRL entries in specified cert. + * + * @param { X509Cert } cert - cert of x509. + * @returns { X509CrlEntry } X509CrlEntry instance. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getRevokedCertWithCert(cert: X509Cert): X509CrlEntry; + + /** + * Get all entries in this CRL. + * + * @param { AsyncCallback> } callback - the callback of getRevokedCerts. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getRevokedCerts(callback: AsyncCallback>): void; + + /** + * Get all entries in this CRL. + * + * @returns { Promise> } the promise of X509CrlEntry instance. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getRevokedCerts(): Promise>; + + /** + * Get the CRL information encoded by Der from this CRL. + * + * @returns { DataBlob } DataBlob of tbs info. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getTbsInfo(): DataBlob; + + /** + * Get signature value from CRL. + * + * @returns { DataBlob } DataBlob of signature. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getSignature(): DataBlob; + + /** + * Get the signature algorithm name of the CRL signature algorithm. + * + * @returns { string } string of signature algorithm name. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getSignatureAlgName(): string; + + /** + * Get the signature algorithm oid string from CRL. + * + * @returns { string } string of signature algorithm oid. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + getSignatureAlgOid(): string; + + /** + * Get the der encoded signature algorithm parameters from the CRL signature algorithm. + * + * @returns { DataBlob } DataBlob of signature algorithm params. * @throws { BusinessError } 801 - this operation is not supported. * @throws { BusinessError } 19020001 - memory error. * @throws { BusinessError } 19020002 - runtime error. @@ -819,7 +798,108 @@ declare namespace cert { * @syscap SystemCapability.Security.Cert * @since 9 */ - function createCertChainValidator(algorithm :string) : CertChainValidator; + getSignatureAlgParams(): DataBlob; + } + + /** + * Provides the x509 CRL func. + * + * @param { EncodingBlob } inStream - indicates the input CRL data. + * @param { AsyncCallback } callback - the callback of createX509Crl to return x509 CRL instance. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 801 - this operation is not supported. + * @throws { BusinessError } 19020001 - memory error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + function createX509Crl(inStream: EncodingBlob, callback: AsyncCallback): void; + + /** + * Provides the x509 CRL func. + * + * @param { EncodingBlob } inStream - indicates the input CRL data. + * @returns { Promise } the promise of x509 CRL instance. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 801 - this operation is not supported. + * @throws { BusinessError } 19020001 - memory error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + function createX509Crl(inStream: EncodingBlob): Promise; + + /** + * Certification chain validator. + * + * @typedef CertChainValidator + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + interface CertChainValidator { + /** + * Validate the cert chain. + * + * @param { CertChainData } certChain - indicate the cert chain validator data. + * @param { AsyncCallback } callback - the callback of validate. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @throws { BusinessError } 19030002 - the certificate signature verification failed. + * @throws { BusinessError } 19030003 - the certificate has not taken effect. + * @throws { BusinessError } 19030004 - the certificate has expired. + * @throws { BusinessError } 19030005 - failed to obtain the certificate issuer. + * @throws { BusinessError } 19030006 - the key cannot be used for signing a certificate. + * @throws { BusinessError } 19030007 - the key cannot be used for digital signature. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + validate(certChain: CertChainData, callback: AsyncCallback): void; + + /** + * Validate the cert chain. + * + * @param { CertChainData } certChain - indicate the cert chain validator data. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @throws { BusinessError } 19030002 - the certificate signature verification failed. + * @throws { BusinessError } 19030003 - the certificate has not taken effect. + * @throws { BusinessError } 19030004 - the certificate has expired. + * @throws { BusinessError } 19030005 - failed to obtain the certificate issuer. + * @throws { BusinessError } 19030006 - the key cannot be used for signing a certificate. + * @throws { BusinessError } 19030007 - the key cannot be used for digital signature. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + validate(certChain: CertChainData): Promise; + + /** + * The cert chain related algorithm. + * + * @type { string } + * @readonly + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + readonly algorithm: string; + } + + /** + * Provides the cert chain validator func. + * + * @param { string } algorithm - indicates the cert chain validator type. + * @returns { CertChainValidator } the cert chain validator instance. + * @throws { BusinessError } 401 - invalid parameters. + * @throws { BusinessError } 801 - this operation is not supported. + * @throws { BusinessError } 19020001 - memory error. + * @throws { BusinessError } 19020002 - runtime error. + * @throws { BusinessError } 19030001 - crypto operation error. + * @syscap SystemCapability.Security.Cert + * @since 9 + */ + function createCertChainValidator(algorithm: string): CertChainValidator; } export default cert; -- Gitee From 46674b9c79460998c98574f1f29f349485eb8033 Mon Sep 17 00:00:00 2001 From: lanlanlan Date: Thu, 23 Mar 2023 08:07:16 +0000 Subject: [PATCH 4/4] update api/@ohos.security.cryptoFramework.d.ts. Signed-off-by: lanlanlan --- api/@ohos.security.cryptoFramework.d.ts | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/api/@ohos.security.cryptoFramework.d.ts b/api/@ohos.security.cryptoFramework.d.ts index 81ba43417f..af7a823551 100644 --- a/api/@ohos.security.cryptoFramework.d.ts +++ b/api/@ohos.security.cryptoFramework.d.ts @@ -81,6 +81,13 @@ declare namespace cryptoFramework { * @since 9 */ interface DataBlob { + /** + * Indicates the content of data blob. + * + * @type { Uint8Array } + * @syscap SystemCapability.Security.CryptoFramework + * @since 9 + */ data: Uint8Array; } @@ -165,7 +172,7 @@ declare namespace cryptoFramework { */ interface CcmParamsSpec extends ParamsSpec { /** - * Indicates the GCM algorithm parameters such as IV. + * Indicates the GCM algorithm parameters such as iv. * * @type { DataBlob } * @syscap SystemCapability.Security.CryptoFramework @@ -290,7 +297,7 @@ declare namespace cryptoFramework { } /** - * The public key class of asymmetrical key. + * The public key class of asymmetric key. * * @typedef PubKey * @syscap SystemCapability.Security.CryptoFramework @@ -299,7 +306,7 @@ declare namespace cryptoFramework { interface PubKey extends Key {} /** - * The keyPair class of asymmetrical key. Include privateKey and publickey. + * The keyPair class of asymmetric key. Include privateKey and publickey. * * @typedef KeyPair * @syscap SystemCapability.Security.CryptoFramework @@ -413,7 +420,7 @@ declare namespace cryptoFramework { generateKeyPair(): Promise; /** - * Used to convert asymmetric key pair . + * Used to convert asymmetric key data to key pair object. * * @param { DataBlob } pubKey - the public key data blob. * @param { DataBlob } priKey - the private key data blob. @@ -426,7 +433,7 @@ declare namespace cryptoFramework { convertKey(pubKey: DataBlob, priKey: DataBlob, callback: AsyncCallback): void; /** - * Used to convert asymmetric key pair. + * Used to convert asymmetric key data to key pair object. * * @param { DataBlob } pubKey - the public key data blob. * @param { DataBlob } priKey - the private key data blob. @@ -513,7 +520,7 @@ declare namespace cryptoFramework { } /** - * Provides the asymmetrical key generator instance func. + * Provides the asymmetric key generator instance func. * * @param { string } algName - indicates the algorithm name. * @returns { AsyKeyGenerator } the generator obj create by algName. @@ -1149,4 +1156,4 @@ declare namespace cryptoFramework { function createKeyAgreement(algName: string): KeyAgreement; } -export default cryptoFramework; +export default cryptoFramework; \ No newline at end of file -- Gitee