mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-11-27 09:22:53 +00:00
update api/@system.cipher.d.ts.
Signed-off-by: lanlanlan <jinliang9@huawei.com>
This commit is contained in:
parent
e4bcd2ef02
commit
2b20c57c8d
109
api/@system.cipher.d.ts
vendored
109
api/@system.cipher.d.ts
vendored
@ -15,24 +15,31 @@
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @type { string }
|
||||
* @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 +47,11 @@ export interface CipherRsaOptions {
|
||||
* The options are as follows:
|
||||
* encrypt: Encrypts data.
|
||||
* decrypt: Decrypts data.
|
||||
* @since 3
|
||||
*
|
||||
* @permission N/A
|
||||
* @type { string }
|
||||
* @syscap SystemCapability.Security.Cipher
|
||||
* @since 3
|
||||
*/
|
||||
action: string;
|
||||
|
||||
@ -52,8 +62,11 @@ 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
|
||||
* @type { string }
|
||||
* @syscap SystemCapability.Security.Cipher
|
||||
* @since 3
|
||||
*/
|
||||
text: string;
|
||||
|
||||
@ -61,46 +74,63 @@ 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
|
||||
* @type { string }
|
||||
* @syscap SystemCapability.Security.Cipher
|
||||
* @since 3
|
||||
*/
|
||||
key: string;
|
||||
|
||||
/**
|
||||
* RSA algorithm padding.
|
||||
* The default value is RSA/None/OAEPWithSHA256AndMGF1Padding.
|
||||
* @since 3
|
||||
*
|
||||
* @permission N/A
|
||||
* @type { ?string }
|
||||
* @syscap SystemCapability.Security.Cipher
|
||||
* @since 3
|
||||
*/
|
||||
transformation?: string;
|
||||
|
||||
/**
|
||||
* Called when data is encrypted or decrypted successfully.
|
||||
* @since 3
|
||||
*
|
||||
* @permission N/A
|
||||
* @type { (data: CipherResponse) => void }
|
||||
* @syscap SystemCapability.Security.Cipher
|
||||
* @since 3
|
||||
*/
|
||||
success: (data: CipherResponse) => void;
|
||||
|
||||
/**
|
||||
* Called when data fails to be encrypted or decrypted.
|
||||
* @since 3
|
||||
*
|
||||
* @permission N/A
|
||||
* @type { (data: string, code: number) => void }
|
||||
* @syscap SystemCapability.Security.Cipher
|
||||
* @since 3
|
||||
*/
|
||||
fail: (data: string, code: number) => void;
|
||||
|
||||
/**
|
||||
* Called when the execution is completed.
|
||||
* @since 3
|
||||
*
|
||||
* @permission N/A
|
||||
* @type { () => void }
|
||||
* @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 +138,9 @@ export interface CipherAesOptions {
|
||||
* The options are as follows:
|
||||
* encrypt: Encrypts data.
|
||||
* decrypt: Decrypts data.
|
||||
*
|
||||
* @permission N/A
|
||||
* @type { string }
|
||||
* @syscap SystemCapability.Security.Cipher
|
||||
* @since 3
|
||||
*/
|
||||
@ -118,6 +151,9 @@ 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
|
||||
* @type { string }
|
||||
* @syscap SystemCapability.Security.Cipher
|
||||
* @since 3
|
||||
*/
|
||||
@ -125,6 +161,9 @@ export interface CipherAesOptions {
|
||||
|
||||
/**
|
||||
* Key used for encryption or decryption, which is a character string encrypted using Base64.
|
||||
*
|
||||
* @permission N/A
|
||||
* @type { string }
|
||||
* @syscap SystemCapability.Security.Cipher
|
||||
* @since 3
|
||||
*/
|
||||
@ -133,6 +172,9 @@ export interface CipherAesOptions {
|
||||
/**
|
||||
* Encryption mode and padding of the AES algorithm.
|
||||
* The default value is AES/CBC/PKCS5Padding.
|
||||
*
|
||||
* @permission N/A
|
||||
* @type { ?string }
|
||||
* @syscap SystemCapability.Security.Cipher
|
||||
* @since 3
|
||||
*/
|
||||
@ -142,6 +184,9 @@ 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
|
||||
* @type { ?string }
|
||||
* @syscap SystemCapability.Security.Cipher
|
||||
* @since 3
|
||||
*/
|
||||
@ -150,6 +195,9 @@ export interface CipherAesOptions {
|
||||
/**
|
||||
* Offset of the initial vector for AES-based encryption and decryption.
|
||||
* The default value is 0.
|
||||
*
|
||||
* @permission N/A
|
||||
* @type { ?string }
|
||||
* @syscap SystemCapability.Security.Cipher
|
||||
* @since 3
|
||||
*/
|
||||
@ -158,6 +206,9 @@ export interface CipherAesOptions {
|
||||
/**
|
||||
* Length of the initial vector for AES-based encryption and decryption.
|
||||
* The default value is 16.
|
||||
*
|
||||
* @permission N/A
|
||||
* @type { ?string }
|
||||
* @syscap SystemCapability.Security.Cipher
|
||||
* @since 3
|
||||
*/
|
||||
@ -165,6 +216,9 @@ export interface CipherAesOptions {
|
||||
|
||||
/**
|
||||
* Called when data is encrypted or decrypted successfully.
|
||||
*
|
||||
* @permission N/A
|
||||
* @type { (data: CipherResponse) => void }
|
||||
* @syscap SystemCapability.Security.Cipher
|
||||
* @since 3
|
||||
*/
|
||||
@ -172,6 +226,9 @@ export interface CipherAesOptions {
|
||||
|
||||
/**
|
||||
* Called when data fails to be encrypted or decrypted.
|
||||
*
|
||||
* @permission N/A
|
||||
* @type { (data: string, code: number) => void }
|
||||
* @syscap SystemCapability.Security.Cipher
|
||||
* @since 3
|
||||
*/
|
||||
@ -179,6 +236,9 @@ export interface CipherAesOptions {
|
||||
|
||||
/**
|
||||
* Called when the execution is completed.
|
||||
*
|
||||
* @permission N/A
|
||||
* @type { () => void }
|
||||
* @syscap SystemCapability.Security.Cipher
|
||||
* @since 3
|
||||
*/
|
||||
@ -187,26 +247,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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user