From af4db220ada88ab8fe06adf656804f7ffc405d9a Mon Sep 17 00:00:00 2001 From: kang1024 Date: Sat, 9 Aug 2025 17:01:21 +0800 Subject: [PATCH] =?UTF-8?q?arkts=E9=9D=99=E6=80=81=E5=8C=96Cipher=E7=9A=84?= =?UTF-8?q?update=E5=92=8CdoFinal=E6=8E=A5=E5=8F=A3=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E8=BF=94=E5=9B=9Enull?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: kang1024 --- api/@ohos.security.cryptoFramework.d.ts | 132 +++++++++++++++++++++--- 1 file changed, 120 insertions(+), 12 deletions(-) diff --git a/api/@ohos.security.cryptoFramework.d.ts b/api/@ohos.security.cryptoFramework.d.ts index 986d48c70b..af323fc4cc 100644 --- a/api/@ohos.security.cryptoFramework.d.ts +++ b/api/@ohos.security.cryptoFramework.d.ts @@ -3589,11 +3589,29 @@ declare namespace cryptoFramework { * @syscap SystemCapability.Security.CryptoFramework.Cipher * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ 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. + * @param { AsyncCallback } callback - the callback of the update function. + * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17620001 - memory operation failed. + * @throws { BusinessError } 17620002 - failed to convert parameters between arkts and c. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework.Cipher + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + 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. @@ -3637,11 +3655,29 @@ declare namespace cryptoFramework { * @syscap SystemCapability.Security.CryptoFramework.Cipher * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ update(data: DataBlob): 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. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17620001 - memory operation failed. + * @throws { BusinessError } 17620002 - failed to convert parameters between arkts and c. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework.Cipher + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + update(data: DataBlob): 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. @@ -3656,11 +3692,29 @@ declare namespace cryptoFramework { * @syscap SystemCapability.Security.CryptoFramework.Cipher * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ updateSync(data: DataBlob): DataBlob; + /** + * 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 { DataBlob | null } cipherText when encrypted or plainText when decrypted. + * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17620001 - memory operation failed. + * @throws { BusinessError } 17620002 - failed to convert parameters between arkts and c. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework.Cipher + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + updateSync(data: DataBlob): DataBlob | null; + /** * 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. @@ -3751,11 +3805,29 @@ declare namespace cryptoFramework { * @syscap SystemCapability.Security.CryptoFramework.Cipher * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ doFinal(data: DataBlob | null, 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 | null } data - indicates the data to be finally encrypted or decrypted. + * @param { AsyncCallback } callback - the callback of the doFinal function. + * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17620001 - memory operation failed. + * @throws { BusinessError } 17620002 - failed to convert parameters between arkts and c. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework.Cipher + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + doFinal(data: DataBlob | null, 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. @@ -3846,11 +3918,29 @@ declare namespace cryptoFramework { * @syscap SystemCapability.Security.CryptoFramework.Cipher * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ doFinal(data: DataBlob | null): 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 | null } data - indicates the data to be finally encrypted or decrypted. + * @returns { Promise } the promise returned by the function. + * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17620001 - memory operation failed. + * @throws { BusinessError } 17620002 - failed to convert parameters between arkts and c. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework.Cipher + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + doFinal(data: DataBlob | null): 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. @@ -3865,11 +3955,29 @@ declare namespace cryptoFramework { * @syscap SystemCapability.Security.CryptoFramework.Cipher * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ doFinalSync(data: DataBlob | null): DataBlob; + /** + * 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 | null } data - indicates the data to be finally encrypted or decrypted. + * @returns { DataBlob | null } cipherText when encrypted or plainText when decrypted. + * @throws { BusinessError } 401 - invalid parameters. Possible causes: 1. Mandatory parameters are left unspecified; + *
2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 17620001 - memory operation failed. + * @throws { BusinessError } 17620002 - failed to convert parameters between arkts and c. + * @throws { BusinessError } 17630001 - crypto operation error. + * @syscap SystemCapability.Security.CryptoFramework.Cipher + * @crossplatform + * @atomicservice + * @since 20 + * @arkts 1.2 + */ + doFinalSync(data: DataBlob | null): DataBlob | null; + /** * Set the specified parameter to the cipher object. * Currently, only the OAEP_MGF1_PSRC_UINT8ARR parameter in RSA is supported. -- Gitee