diff --git a/api/@ohos.security.huks.d.ts b/api/@ohos.security.huks.d.ts index eb00b60114a25b2e5eff1eac1c97dbcc8d392796..414606f606ab7b9e2ade441441bf696141ce0062 100755 --- a/api/@ohos.security.huks.d.ts +++ b/api/@ohos.security.huks.d.ts @@ -23,6 +23,7 @@ import {AsyncCallback} from './basic'; declare namespace huks { /** * Generate Key. + * @Deprecated * @since 8 * @syscap SystemCapability.Security.Huks * @param keyAlias Indicates the key's name. @@ -31,8 +32,20 @@ declare namespace huks { function generateKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback) : void; function generateKey(keyAlias: string, options: HuksOptions) : Promise; + /** + * Generate Key. + * @param {string} keyAlias - Indicates the key's name. + * @param {HuksOptions} options - Indicates the properties of the key. + * @throws {BusinessError} if the type of params is wrong. + * @syscap SystemCapability.Security.Huks + * @since 9 + */ + function generateKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback) : void; + function generateKeyItem(keyAlias: string, options: HuksOptions) : Promise; + /** * Delete Key. + * @Deprecated * @since 8 * @syscap SystemCapability.Security.Huks * @param keyAlias Indicates the key's name. @@ -41,8 +54,20 @@ declare namespace huks { function deleteKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback) : void; function deleteKey(keyAlias: string, options: HuksOptions) : Promise; + /** + * Delete Key. + * @param {string} keyAlias - Indicates the key's name. + * @param {HuksOptions} options - Indicates the properties of the key. + * @throws {BusinessError} if the type of params is wrong. + * @syscap SystemCapability.Security.Huks + * @since 9 + */ + function deleteKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback) : void; + function deleteKeyItem(keyAlias: string, options: HuksOptions) : Promise; + /** * Import Key. + * @Deprecated * @since 8 * @syscap SystemCapability.Security.Huks * @param keyAlias Indicates the key's name. @@ -52,18 +77,31 @@ declare namespace huks { function importKey(keyAlias: string, options: HuksOptions) : Promise; /** - * Import Wrapped Key. + * Import Key. + * @param {string} keyAlias - Indicates the key's name. + * @param {HuksOptions} options - Indicates the properties of the key. + * @throws {BusinessError} if the type of params is wrong. + * @syscap SystemCapability.Security.Huks * @since 9 + */ + function importKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback) : void; + function importKeyItem(keyAlias: string, options: HuksOptions) : Promise; + + /** + * Import Wrapped Key. + * @param {string} keyAlias - Indicates the name of key to be imported. + * @param {string} wrappingKeyAlias - Indicates the name of key for wrapping the key to be imported + * @param {HuksOptions} options - Indicates the properties of the key. + * @throws {BusinessError} if the type of params is wrong. * @syscap SystemCapability.Security.Huks - * @param keyAlias Indicates the name of key to be imported. - * @param wrappingKeyAlias Indicates the name of key for wrapping the key to be imported - * @param options Indicates the properties of the key. + * @since 9 */ - function importWrappedKey(keyAlias: string, wrappingKeyAlias: string, options: HuksOptions, callback: AsyncCallback) : void; - function importWrappedKey(keyAlias: string, wrappingKeyAlias: string, options: HuksOptions) : Promise; + function importWrappedKey(keyAlias: string, wrappingKeyAlias: string, options: HuksOptions, callback: AsyncCallback) : void; + function importWrappedKey(keyAlias: string, wrappingKeyAlias: string, options: HuksOptions) : Promise; /** * Export Key. + * @Deprecated * @since 8 * @syscap SystemCapability.Security.Huks * @param keyAlias Indicates the key's name. @@ -72,8 +110,20 @@ declare namespace huks { function exportKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback) : void; function exportKey(keyAlias: string, options: HuksOptions) : Promise; + /** + * Export Key. + * @param {string} keyAlias - Indicates the key's name. + * @param {HuksOptions} options - Indicates the properties of the key. + * @throws {BusinessError} if the type of params is wrong. + * @syscap SystemCapability.Security.Huks + * @since 9 + */ + function exportKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback) : void; + function exportKeyItem(keyAlias: string, options: HuksOptions) : Promise; + /** * Get properties of the key. + * @Deprecated * @since 8 * @syscap SystemCapability.Security.Huks * @param keyAlias Indicates the key's name. @@ -82,8 +132,20 @@ declare namespace huks { function getKeyProperties(keyAlias: string, options: HuksOptions, callback: AsyncCallback) : void; function getKeyProperties(keyAlias: string, options: HuksOptions) : Promise; + /** + * Get properties of the key. + * @param {string} keyAlias - Indicates the key's name. + * @param {HuksOptions} options - Indicates the properties of the key. + * @throws {BusinessError} if the type of params is wrong. + * @syscap SystemCapability.Security.Huks + * @since 9 + */ + function getKeyItemProperties(keyAlias: string, options: HuksOptions, callback: AsyncCallback) : void; + function getKeyItemProperties(keyAlias: string, options: HuksOptions) : Promise; + /** * Check whether the key exists. + * @Deprecated * @since 8 * @syscap SystemCapability.Security.Huks * @param keyAlias Indicates the key's name. @@ -92,8 +154,20 @@ declare namespace huks { function isKeyExist(keyAlias: string, options: HuksOptions, callback: AsyncCallback) : void; function isKeyExist(keyAlias: string, options: HuksOptions) : Promise; + /** + * Check whether the key exists. + * @param {string} keyAlias - Indicates the key's name. + * @param {HuksOptions} options - Indicates the properties of the key. + * @throws {BusinessError} if the type of params is wrong. + * @syscap SystemCapability.Security.Huks + * @since 9 + */ + function isKeyItemExist(keyAlias: string, options: HuksOptions, callback: AsyncCallback) : void; + function isKeyItemExist(keyAlias: string, options: HuksOptions) : Promise; + /** * Init Operation. + * @Deprecated * @since 8 * @syscap SystemCapability.Security.Huks * @param keyAlias Indicates the key's name. @@ -103,8 +177,20 @@ declare namespace huks { function init(keyAlias: string, options: HuksOptions, callback: AsyncCallback) : void; function init(keyAlias: string, options: HuksOptions) : Promise; + /** + * Init Operation. + * @param {string} keyAlias - Indicates the key's name. + * @param {HuksOptions} options - Indicates the properties of the key. + * @throws {BusinessError} if the type of params is wrong. + * @syscap SystemCapability.Security.Huks + * @since 9 + */ + function doInit(keyAlias: string, options: HuksOptions, callback: AsyncCallback) : void; + function doInit(keyAlias: string, options: HuksOptions) : Promise; + /** * Update Operation. + * @Deprecated * @since 8 * @syscap SystemCapability.Security.Huks * @param handle Indicates the handle of the init operation. @@ -116,18 +202,20 @@ declare namespace huks { /** * Update Operation. - * @since 9 + * @param {number} handle - Indicates the handle of the init operation. + * @param {HuksOptions} options - Indicates the properties of the update operation. + * @param {Uint8Array} token - Indicates the value of AuthToken from USER IAM service. + * @throws {BusinessError} if the type of params is wrong. * @syscap SystemCapability.Security.Huks - * @param handle Indicates the handle of the init operation. - * @param options Indicates the properties of the update operation. - * @param token Indicates the value of token. + * @since 9 */ - function update(handle: number, options: HuksOptions, callback: AsyncCallback) : void; - function update(handle: number, options: HuksOptions, token: Uint8Array, callback: AsyncCallback) : void; - function update(handle: number, options: HuksOptions, token?: Uint8Array) : Promise; + function doUpdate(handle: number, options: HuksOptions, callback: AsyncCallback) : void; + function doUpdate(handle: number, options: HuksOptions, token: Uint8Array, callback: AsyncCallback) : void; + function doUpdate(handle: number, options: HuksOptions, token?: Uint8Array) : Promise; /** * Finish Operation. + * @Deprecated * @since 8 * @syscap SystemCapability.Security.Huks * @param handle Indicates the handle of the init operation. @@ -138,17 +226,20 @@ declare namespace huks { /** * Finish Operation. - * @since 9 + * @param {number} handle - Indicates the handle of the init operation. + * @param {HuksOptions} options - Indicates the properties of the finish operation. + * @param {Uint8Array} token - Indicates the value of AuthToken from USER IAM service. + * @throws {BusinessError} if the type of params is wrong. * @syscap SystemCapability.Security.Huks - * @param handle Indicates the handle of the init operation. - * @param options Indicates the properties of the finish operation. - * @param token Indicates the value of token. + * @since 9 */ - function finish(handle: number, options: HuksOptions, token: Uint8Array, callback: AsyncCallback) : void; - function finish(handle: number, options: HuksOptions, token?: Uint8Array) : Promise; + function doFinish(handle: number, options: HuksOptions, callback: AsyncCallback) : void; + function doFinish(handle: number, options: HuksOptions, token: Uint8Array, callback: AsyncCallback) : void; + function doFinish(handle: number, options: HuksOptions, token?: Uint8Array) : Promise; /** * Abort Operation. + * @Deprecated * @since 8 * @syscap SystemCapability.Security.Huks * @param handle Indicates the handle of the init operation. @@ -157,16 +248,28 @@ declare namespace huks { function abort(handle: number, options: HuksOptions, callback: AsyncCallback) : void; function abort(handle: number, options: HuksOptions) : Promise; + /** + * Abort Operation. + * @param {number} handle - Indicates the handle of the init operation. + * @param {HuksOptions} options - Indicates the properties of the abort operation. + * @throws {BusinessError} if the type of params is wrong. + * @syscap SystemCapability.Security.Huks + * @since 9 + */ + function doAbort(handle: number, options: HuksOptions, callback: AsyncCallback) : void; + function doAbort(handle: number, options: HuksOptions) : Promise; + /** * Key Attestation. - * @since 9 + * @param {string} keyAlias - Indicates the key's name. + * @param {HuksOptions} options - Indicates the properties of the key attestation operation. + * @throws {BusinessError} if the type of params is wrong. * @syscap SystemCapability.Security.Huks - * @param keyAlias Indicates the key's name. - * @param options Indicates the properties of the key attestation operation. + * @since 9 */ - function attestKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback) : void; - function attestKey(keyAlias: string, options: HuksOptions) : Promise; + function attestKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback) : void; + function attestKeyItem(keyAlias: string, options: HuksOptions) : Promise; /** * Get the sdk version. @@ -189,6 +292,7 @@ declare namespace huks { /** * Interface of huks handle. + * @Deprecated * @since 8 * @syscap SystemCapability.Security.Huks */ @@ -198,6 +302,16 @@ declare namespace huks { token?: Uint8Array; } + /** + * Interface of huks handle. + * @since 9 + * @syscap SystemCapability.Security.Huks + */ + export interface HuksSessionHandle { + handle: number; + challenge?: Uint8Array; + } + /** * Interface of huks option. * @since 8 @@ -210,6 +324,7 @@ declare namespace huks { /** * Interface of huks result. + * @Deprecated * @since 8 * @syscap SystemCapability.Security.Huks */ @@ -220,8 +335,20 @@ declare namespace huks { certChains?: Array; } + /** + * Interface of huks result. + * @since 9 + * @syscap SystemCapability.Security.Huks + */ + export interface HuksReturnResult { + outData?: Uint8Array; + properties?: Array; + certChains?: Array; + } + /** * @name HuksErrorCode + * @Deprecated * @since 8 * @syscap SystemCapability.Security.Huks */ @@ -344,6 +471,31 @@ declare namespace huks { HUKS_ERROR_UNKNOWN_ERROR = -1000, } + /** + * @name HuksExceptionErrCode + * @since 9 + * @syscap SystemCapability.Security.Huks + */ + export enum HuksExceptionErrCode { + HUKS_ERR_CODE_PERMISSION_FAIL = 201, + HUKS_ERR_CODE_ILLEGAL_ARGUMENT = 401, + HUKS_ERR_CODE_NOT_SUPPORTED_API = 801, + + HUKS_ERR_CODE_FEATURE_NOT_SUPPORTED = 12000001, + HUKS_ERR_CODE_MISSING_CRYPTO_ALG_ARGUMENT = 12000002, + HUKS_ERR_CODE_INVALID_CRYPTO_ALG_ARGUMENT = 12000003, + HUKS_ERR_CODE_FILE_OPERATION_FAIL = 12000004, + HUKS_ERR_CODE_COMMUNICATION_FAIL = 12000005, + HUKS_ERR_CODE_CRYPTO_FAIL = 12000006, + HUKS_ERR_CODE_KEY_AUTH_PERMANENTLY_INVALIDATED = 12000007, + HUKS_ERR_CODE_KEY_AUTH_VERIFY_FAILED = 12000008, + HUKS_ERR_CODE_KEY_AUTH_TIME_OUT = 12000009, + HUKS_ERR_CODE_SESSION_LIMIT = 12000010, + HUKS_ERR_CODE_ITEM_NOT_EXIST = 12000011, + HUKS_ERR_CODE_INTERNAL_ERROR = 12000012, + HUKS_ERR_CODE_CREDENTIAL_NOT_EXIST = 12000013, + } + /** * @name HuksKeyPurpose * @since 8 diff --git a/api/@system.cipher.d.ts b/api/@system.cipher.d.ts index 11f0cfb9f5ec691855575920d970e9a1077dea4d..71e1f6a6ffc0235c118cd9e515b0e438dee8299e 100644 --- a/api/@system.cipher.d.ts +++ b/api/@system.cipher.d.ts @@ -194,6 +194,7 @@ export interface CipherAesOptions { export default class Cipher { /** * Encrypts or decrypts data using RSA. + * @Deprecated * @param options RSA options * @syscap SystemCapability.Security.Cipher */ @@ -201,6 +202,7 @@ export default class Cipher { /** * Encrypts or decrypts data using AES. + * @Deprecated * @param options AES options * @syscap SystemCapability.Security.Cipher */