Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
3f78e74e
D
Docs
项目概览
OpenHarmony
/
Docs
接近 2 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
3f78e74e
编写于
6月 25, 2023
作者:
X
xwb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
js API change throws to since 9, and add changelog
Signed-off-by:
N
xwb
<
xuwanbing1@huawei.com
>
上级
09373573
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
292 addition
and
17 deletion
+292
-17
zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md
...application-dev/reference/apis/js-apis-cryptoFramework.md
+13
-17
zh-cn/release-notes/changelogs/OpenHarmony_4.0.8.5/changelogs-security.md
...tes/changelogs/OpenHarmony_4.0.8.5/changelogs-security.md
+279
-0
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md
浏览文件 @
3f78e74e
...
@@ -369,10 +369,6 @@ getEncoded(): DataBlob
...
@@ -369,10 +369,6 @@ getEncoded(): DataBlob
**错误码:**
**错误码:**
> **说明:**
>
> 从API version 10开始,该接口支持抛出错误码。
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| -------- | ---------------------- |
| -------- | ---------------------- |
| 801 | this operation is not supported. |
| 801 | this operation is not supported. |
...
@@ -794,8 +790,8 @@ createAsyKeyGenerator(algName: string): AsyKeyGenerator
...
@@ -794,8 +790,8 @@ createAsyKeyGenerator(algName: string): AsyKeyGenerator
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| -------- | ---------------------- |
| -------- | ---------------------- |
| 401 | invalid parameters. |
| 401 | invalid parameters. |
| 801
<sup>
10+
</sup>
| this operation is not supported. |
| 801 | this operation is not supported. |
| 17620001
<sup>
10+
</sup>
| memory error. |
| 17620001 | memory error. |
**示例:**
**示例:**
...
@@ -837,7 +833,7 @@ generateKeyPair(callback: AsyncCallback\<KeyPair>): void
...
@@ -837,7 +833,7 @@ generateKeyPair(callback: AsyncCallback\<KeyPair>): void
| -------- | ---------------------- |
| -------- | ---------------------- |
| 401 | invalid parameters. |
| 401 | invalid parameters. |
| 17620001 | memory error. |
| 17620001 | memory error. |
| 17630001
<sup>
10+
</sup>
| crypto operation error. |
| 17630001 | crypto operation error. |
**示例:**
**示例:**
...
@@ -874,7 +870,7 @@ generateKeyPair(): Promise\<KeyPair>
...
@@ -874,7 +870,7 @@ generateKeyPair(): Promise\<KeyPair>
| -------- | ---------------------- |
| -------- | ---------------------- |
| 401 | invalid parameters. |
| 401 | invalid parameters. |
| 17620001 | memory error. |
| 17620001 | memory error. |
| 17630001
<sup>
10+
</sup>
| crypto operation error. |
| 17630001 | crypto operation error. |
**示例:**
**示例:**
...
@@ -912,7 +908,7 @@ convertKey(pubKey: DataBlob, priKey: DataBlob, callback: AsyncCallback\<KeyPair\
...
@@ -912,7 +908,7 @@ convertKey(pubKey: DataBlob, priKey: DataBlob, callback: AsyncCallback\<KeyPair\
| -------- | ---------------------- |
| -------- | ---------------------- |
| 401 | invalid parameters. |
| 401 | invalid parameters. |
| 17620001 | memory error. |
| 17620001 | memory error. |
| 17630001
<sup>
10+
</sup>
| crypto operation error. |
| 17630001 | crypto operation error. |
**示例:**
**示例:**
...
@@ -960,7 +956,7 @@ convertKey(pubKey: DataBlob, priKey: DataBlob): Promise\<KeyPair>
...
@@ -960,7 +956,7 @@ convertKey(pubKey: DataBlob, priKey: DataBlob): Promise\<KeyPair>
| -------- | ---------------------- |
| -------- | ---------------------- |
| 401 | invalid parameters. |
| 401 | invalid parameters. |
| 17620001 | memory error. |
| 17620001 | memory error. |
| 17630001
<sup>
10+
</sup>
| crypto operation error. |
| 17630001 | crypto operation error. |
**示例:**
**示例:**
...
@@ -1315,7 +1311,7 @@ createCipher(transformation: string): Cipher
...
@@ -1315,7 +1311,7 @@ createCipher(transformation: string): Cipher
| -------- | ---------------------- |
| -------- | ---------------------- |
| 401 | invalid parameters. |
| 401 | invalid parameters. |
| 801 | this operation is not supported. |
| 801 | this operation is not supported. |
| 17620001
<sup>
10+
</sup>
| memory error. |
| 17620001 | memory error. |
**示例:**
**示例:**
...
@@ -1837,8 +1833,8 @@ Sign实例生成。<br/>支持的规格详见框架概述“[签名验签规格]
...
@@ -1837,8 +1833,8 @@ Sign实例生成。<br/>支持的规格详见框架概述“[签名验签规格]
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| -------- | ---------------------- |
| -------- | ---------------------- |
| 401 | invalid parameters. |
| 401 | invalid parameters. |
| 801
<sup>
10+
</sup>
| this operation is not supported. |
| 801 | this operation is not supported. |
| 17620001
<sup>
10+
</sup>
| memory error. |
| 17620001 | memory error. |
**示例:**
**示例:**
...
@@ -2224,8 +2220,8 @@ Verify实例生成。<br/>支持的规格详见框架概述“[签名验签规
...
@@ -2224,8 +2220,8 @@ Verify实例生成。<br/>支持的规格详见框架概述“[签名验签规
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| -------- | ---------------------- |
| -------- | ---------------------- |
| 401 | invalid parameters. |
| 401 | invalid parameters. |
| 801
<sup>
10+
</sup>
| this operation is not supported. |
| 801 | this operation is not supported. |
| 17620001
<sup>
10+
</sup>
| memory error. |
| 17620001 | memory error. |
**示例:**
**示例:**
...
@@ -2570,8 +2566,8 @@ KeyAgreement实例生成。<br/>支持的规格详见框架概述“[密钥协
...
@@ -2570,8 +2566,8 @@ KeyAgreement实例生成。<br/>支持的规格详见框架概述“[密钥协
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| -------- | ---------------------- |
| -------- | ---------------------- |
| 401 | invalid parameters. |
| 401 | invalid parameters. |
| 801
<sup>
10+
</sup>
| this operation is not supported. |
| 801 | this operation is not supported. |
| 17620001
<sup>
10+
</sup>
| memory error. |
| 17620001 | memory error. |
**示例:**
**示例:**
...
...
zh-cn/release-notes/changelogs/OpenHarmony_4.0.8.5/changelogs-security.md
0 → 100644
浏览文件 @
3f78e74e
# security子系统ChangeLog
## cl.security.1 对API9中已经抛出的异常,补写throws标签
对于在API9中已经抛出异常而JS DOC中漏写throws标签的接口,在since 9的注释中补上throws标签。
**变更影响**
对于已发布的JS接口,可能影响异常处理流程,包括同步异常和异步异常。应用需要根据最新的throws标签,排查是否有遗漏的异常处理流程,结合实际情况进行适配。
**关键的接口/组件变更**
修改前的接口原型:
```
ts
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
;
}
interface
AsyKeyGenerator
{
/**
* Used to generate asymmetric key pair.
*
* @param { AsyncCallback<KeyPair> } 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
<
KeyPair
>
):
void
;
/**
* Used to generate asymmetric key pair.
*
* @returns { Promise<KeyPair> } the promise used to return keypair.
* @throws { BusinessError } 401 - invalid parameters.
* @throws { BusinessError } 17620001 - memory error.
* @syscap SystemCapability.Security.CryptoFramework
* @since 9
*/
generateKeyPair
():
Promise
<
KeyPair
>
;
/**
* 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.
* @param { AsyncCallback<KeyPair> } 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
<
KeyPair
>
):
void
;
/**
* 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.
* @returns { Promise<KeyPair> } 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
<
KeyPair
>
;
}
/**
* Provides the asymmetric 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 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
;
/**
* 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
;
/**
* 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
;
```
修改后的接口原型:
```
ts
interface
Key
{
/**
* Encode the key object to binary data.
*
* @returns { DataBlob } the binary data of the key object.
* @throws { BusinessError } 801 - this operation is not supported.
* @throws { BusinessError } 17620001 - memory error.
* @throws { BusinessError } 17630001 - crypto operation error.
* @syscap SystemCapability.Security.CryptoFramework
* @since 9
*/
getEncoded
():
DataBlob
;
}
interface
AsyKeyGenerator
{
/**
* Used to generate asymmetric keypair.
*
* @param { AsyncCallback<KeyPair> } callback - the callback used to return keypair.
* @throws { BusinessError } 401 - invalid parameters.
* @throws { BusinessError } 17620001 - memory error.
* @throws { BusinessError } 17630001 - crypto operation error.
* @syscap SystemCapability.Security.CryptoFramework
* @since 9
*/
generateKeyPair
(
callback
:
AsyncCallback
<
KeyPair
>
):
void
;
/**
* Used to generate asymmetric keypair.
*
* @returns { Promise<KeyPair> } the promise used to return keypair.
* @throws { BusinessError } 401 - invalid parameters.
* @throws { BusinessError } 17620001 - memory error.
* @throws { BusinessError } 17630001 - crypto operation error.
* @syscap SystemCapability.Security.CryptoFramework
* @since 9
*/
generateKeyPair
():
Promise
<
KeyPair
>
;
/**
* Used to convert asymmetric key data to keypair object.
*
* @param { DataBlob } pubKey - the public key data blob.
* @param { DataBlob } priKey - the private key data blob.
* @param { AsyncCallback<KeyPair> } callback - the callback used to return keypair.
* @throws { BusinessError } 401 - invalid parameters.
* @throws { BusinessError } 17620001 - memory error.
* @throws { BusinessError } 17630001 - crypto operation error.
* @syscap SystemCapability.Security.CryptoFramework
* @since 9
*/
convertKey
(
pubKey
:
DataBlob
,
priKey
:
DataBlob
,
callback
:
AsyncCallback
<
KeyPair
>
):
void
;
/**
* Used to convert asymmetric key data to keypair object.
*
* @param { DataBlob } pubKey - the public key data blob.
* @param { DataBlob } priKey - the private key data blob.
* @returns { Promise<KeyPair> } the promise used to return keypair.
* @throws { BusinessError } 401 - invalid parameters.
* @throws { BusinessError } 17620001 - memory error.
* @throws { BusinessError } 17630001 - crypto operation error.
* @syscap SystemCapability.Security.CryptoFramework
* @since 9
*/
convertKey
(
pubKey
:
DataBlob
,
priKey
:
DataBlob
):
Promise
<
KeyPair
>
;
}
/**
* Create the asymmetric key generator instance according to the given algorithm name.
*
* @param { string } algName - indicates the algorithm name.
* @returns { AsyKeyGenerator } the asymmetric key generator instance.
* @throws { BusinessError } 401 - invalid parameters.
* @throws { BusinessError } 801 - this operation is not supported.
* @throws { BusinessError } 17620001 - memory error.
* @syscap SystemCapability.Security.CryptoFramework
* @since 9
*/
function
createAsyKeyGenerator
(
algName
:
string
):
AsyKeyGenerator
;
/**
* 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.
* @throws { BusinessError } 17620001 - memory error.
* @syscap SystemCapability.Security.CryptoFramework
* @since 9
*/
function
createCipher
(
transformation
:
string
):
Cipher
;
/**
* Create a sign object for generating signatures.
*
* @param { string } algName - indicates the algorithm name and params.
* @returns { Sign } the sign class.
* @throws { BusinessError } 401 - invalid parameters.
* @throws { BusinessError } 801 - this operation is not supported.
* @throws { BusinessError } 17620001 - memory error.
* @syscap SystemCapability.Security.CryptoFramework
* @since 9
*/
function
createSign
(
algName
:
string
):
Sign
;
/**
* Create a verify object for verifying signatures.
*
* @param { string } algName - indicates the algorithm name and the parameters.
* @returns { Verify } the verify class.
* @throws { BusinessError } 401 - invalid parameters.
* @throws { BusinessError } 801 - this operation is not supported.
* @throws { BusinessError } 17620001 - memory error.
* @syscap SystemCapability.Security.CryptoFramework
* @since 9
*/
function
createVerify
(
algName
:
string
):
Verify
;
/**
* Create a key agreement object.
*
* @param { string } algName - indicates the algorithm name and params.
* @returns { KeyAgreement } the key agreement object.
* @throws { BusinessError } 401 - invalid parameters.
* @throws { BusinessError } 801 - this operation is not supported.
* @throws { BusinessError } 17620001 - memory error.
* @syscap SystemCapability.Security.CryptoFramework
* @since 9
*/
function
createKeyAgreement
(
algName
:
string
):
KeyAgreement
;
```
**适配指导**
由于漏标的throws异常发生在较少见的情况下,应用可以结合实际情况,排查漏标的throws标签是否需要专门适配。
-
对于同步方法,如createSign等,请使用try/catch方式处理错误信息。
-
对于异步方法,如convertKey等,请使用try/catch方式处理同步的参数错误,使用error对象的方式获取异步的参数错误和业务执行错误。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录