Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
3138e0f8
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
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看板
未验证
提交
3138e0f8
编写于
8月 18, 2023
作者:
O
openharmony_ci
提交者:
Gitee
8月 18, 2023
浏览文件
操作
浏览文件
下载
差异文件
!22426 [翻译完成】#I7OYGG
Merge pull request !22426 from Annie_wang/PR21556
上级
ef5460fc
1f1ffc16
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
50 addition
and
4 deletion
+50
-4
en/application-dev/reference/apis/js-apis-cert.md
en/application-dev/reference/apis/js-apis-cert.md
+47
-1
en/application-dev/security/cert-guidelines.md
en/application-dev/security/cert-guidelines.md
+3
-3
未找到文件。
en/application-dev/reference/apis/js-apis-cert.md
浏览文件 @
3138e0f8
...
...
@@ -553,12 +553,16 @@ cryptoCert.createX509Cert(encodingBlob, function (error, x509Cert) {
});
```
### getSerialNumber
### getSerialNumber
<sup>(deprecated)</sup>
getSerialNumber() : number
Obtains the X.509 certificate serial number.
> **NOTE**
>
> This API is supported since API version 9 and deprecated since API version 10. You are advised to use [getCertSerialNumber](#getcertserialnumber10).
**System capability**
: SystemCapability.Security.Cert
**Return value**
...
...
@@ -589,6 +593,48 @@ cryptoCert.createX509Cert(encodingBlob, function (error, x509Cert) {
});
```
### getCertSerialNumber<sup>10+</sup>
getCertSerialNumber() : bigint
Obtains the X.509 certificate serial number.
**System capability**
: SystemCapability.Security.Cert
**Return value**
| Type | Description |
| ------ | ------------------ |
| bigint | X.509 certificate serial number obtained.|
**Error codes**
| ID| Error Message |
| -------- | ------------------------------------------------- |
| 19020002 | runtime error. |
**Example**
```
js
import
cryptoCert
from
'
@ohos.security.cert
'
;
// Certificate binary data, which must be set based on the service.
let
encodingData
=
null
;
let
encodingBlob
=
{
data
:
encodingData
,
// Set the encoding format, which can be FORMAT_PEM or FORMAT_DER.
encodingFormat
:
cryptoCert
.
EncodingFormat
.
FORMAT_PEM
};
cryptoCert
.
createX509Cert
(
encodingBlob
,
function
(
error
,
x509Cert
)
{
if
(
error
!=
null
)
{
console
.
log
(
"
createX509Cert failed, errCode:
"
+
error
.
code
+
"
, errMsg:
"
+
error
.
message
);
}
else
{
console
.
log
(
"
createX509Cert success
"
);
let
serialNumber
=
x509Cert
.
getCertSerialNumber
();
}
});
```
### getIssuerName
getIssuerName() : DataBlob
...
...
en/application-dev/security/cert-guidelines.md
浏览文件 @
3138e0f8
...
...
@@ -34,7 +34,7 @@ The table below describes the APIs used in this guide.
| X509Cert | getPublicKey() : cryptoFramework.PubKey | Obtains the certificate public key. |
| X509Cert | checkValidityWithDate(date: string) : void | Checks the certificate validity period. |
| X509Cert | getVersion() : number | Obtains the certificate version. |
| X509Cert
| getSerialNumber() : number | Obtains the certificate serial number.
|
| X509Cert
| getCertSerialNumber() : bigint
<sup>
10+
</sup>
| Obtains the certificate serial number.
|
| X509Cert | getIssuerName() : DataBlob | Obtains the certificate issuer. |
| X509Cert | getSubjectName() : DataBlob | Obtains the certificate subject. |
| X509Cert | getNotBeforeTime() : string | Obtains the time from which the certificate takes effect. |
...
...
@@ -489,7 +489,7 @@ function certChainValidatorSample() {
data
:
encodingData
,
// Number of certificates. It is 2 in this example.
count
:
2
,
// Certificate format. PEM and DER are supported. In this example, the certificate is in PEM format.
// Certificate format.
Only
PEM and DER are supported. In this example, the certificate is in PEM format.
encodingFormat
:
cryptoCert
.
EncodingFormat
.
FORMAT_PEM
};
...
...
@@ -572,4 +572,4 @@ function crlEntrySample() {
}
});
}
```
```
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录