你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

AttestationClient class

证明客户端类。

AttestationClient 类允许访问证明相关的 API:

  • 获取OpenIdMetadata
  • getAttestationSigners
  • attestSgxEnclave
  • attestOpenEnclave
  • attestTpm

构造函数

AttestationClient(string, AttestationClientOptions)

创建 AttestationClient 实例。

示例用法:

import { AttestationClient } from "@azure/attestation";

const client = new AttestationClient(
   "<service endpoint>"
);
AttestationClient(string, TokenCredential, AttestationClientOptions)

使用选项和凭据创建 AttestationClient 实例。

示例用法:

import { AttestationClient } from "@azure/attestation";

const client = new AttestationClient(
   "<service endpoint>",
   new TokenCredential("<>"),
   { tokenValidationOptions: { validateToken: false } }
);

请注意,调用 attestTpm API 需要凭据。

方法

attestOpenEnclave(Uint8Array | Buffer | Blob, AttestOpenEnclaveOptions)

证明使用 OpenEnclave SDK 从 SGX Enclave 生成的 OpenEnclave 报表。

attestSgxEnclave(Uint8Array | Buffer | Blob, AttestSgxEnclaveOptions)

证明使用 Intel SDK 从 SGX Enclave 生成的引号。

attestTpm(string, AttestTpmOptions)

证明基于 TPM 的 enclave。

有关详细信息,请参阅 TPM 证明协议参考

示例

例如,TPM 证明作的初始调用为:

const encodedPayload = JSON.stringify({ payload: { type: "aikcert" } });
const result = await client.attestTpm(encodedPayload);

其中 stringToBytes 将字符串转换为 UTF8。

请注意,attestTpm 需要一个使用身份验证凭据配置的证明客户端。

getAttestationSigners(AttestationClientOperationOptions)

返回可用于对证明服务令牌进行签名的证明签名者列表。

getOpenIdMetadata(AttestationClientOperationOptions)

返回证明服务实例的 OpenID 元数据发现文档。

构造函数详细信息

AttestationClient(string, AttestationClientOptions)

创建 AttestationClient 实例。

示例用法:

import { AttestationClient } from "@azure/attestation";

const client = new AttestationClient(
   "<service endpoint>"
);
new AttestationClient(endpoint: string, options?: AttestationClientOptions)

参数

endpoint

string

证明实例基 URI,例如 https://mytenant.attest.azure.net

options
AttestationClientOptions

用于配置证明客户端的选项。

AttestationClient(string, TokenCredential, AttestationClientOptions)

使用选项和凭据创建 AttestationClient 实例。

示例用法:

import { AttestationClient } from "@azure/attestation";

const client = new AttestationClient(
   "<service endpoint>",
   new TokenCredential("<>"),
   { tokenValidationOptions: { validateToken: false } }
);

请注意,调用 attestTpm API 需要凭据。

new AttestationClient(endpoint: string, credentials: TokenCredential, options?: AttestationClientOptions)

参数

endpoint

string

证明实例基 URI,例如 https://mytenant.attest.azure.net

credentials
TokenCredential

用于配置证明客户端的凭据。

方法详细信息

attestOpenEnclave(Uint8Array | Buffer | Blob, AttestOpenEnclaveOptions)

证明使用 OpenEnclave SDK 从 SGX Enclave 生成的 OpenEnclave 报表。

function attestOpenEnclave(report: Uint8Array | Buffer | Blob, options?: AttestOpenEnclaveOptions): Promise<AttestationResponse<AttestationResult>>

参数

report

Uint8Array | Buffer | Blob

由 SGX enclave 生成的 OpenEnclave 报表。

options
AttestOpenEnclaveOptions

attestOpenEnclave API 调用的作选项。

返回

返回一个 AttestationResponse,其正文是一个证明Result,描述证明服务返回的声明。

attestSgxEnclave(Uint8Array | Buffer | Blob, AttestSgxEnclaveOptions)

证明使用 Intel SDK 从 SGX Enclave 生成的引号。

function attestSgxEnclave(quote: Uint8Array | Buffer | Blob, options?: AttestSgxEnclaveOptions): Promise<AttestationResponse<AttestationResult>>

参数

quote

Uint8Array | Buffer | Blob

SGX enclave 生成的 SGX 引号。

options
AttestSgxEnclaveOptions

attestOpenEnclave API 调用的作选项。

返回

返回一个 AttestationResponse,其正文是一个证明Result,描述证明服务返回的声明。

attestTpm(string, AttestTpmOptions)

证明基于 TPM 的 enclave。

有关详细信息,请参阅 TPM 证明协议参考

示例

例如,TPM 证明作的初始调用为:

const encodedPayload = JSON.stringify({ payload: { type: "aikcert" } });
const result = await client.attestTpm(encodedPayload);

其中 stringToBytes 将字符串转换为 UTF8。

请注意,attestTpm 需要一个使用身份验证凭据配置的证明客户端。

function attestTpm(request: string, options?: AttestTpmOptions): Promise<string>

参数

request

string

发送到 TPM 证明服务的传入请求(已编码 Utf8)。

options
AttestTpmOptions

TPM 证明请求的管道选项。

返回

Promise<string>

包含 TPM 证明(Utf8 编码)响应的结构。

注解

对 TPM 证明 API 的传入请求是字符串化的 JSON 对象。

getAttestationSigners(AttestationClientOperationOptions)

返回可用于对证明服务令牌进行签名的证明签名者列表。

function getAttestationSigners(options?: AttestationClientOperationOptions): Promise<AttestationSigner[]>

参数

options
AttestationClientOperationOptions

客户端作选项。

返回

Promise<AttestationSigner[]>

可用于对证明令牌进行签名的证明Signers 集。

getOpenIdMetadata(AttestationClientOperationOptions)

返回证明服务实例的 OpenID 元数据发现文档。

function getOpenIdMetadata(options?: AttestationClientOperationOptions): Promise<Record<string, unknown>>

参数

options
AttestationClientOperationOptions

客户端作选项。

返回

Promise<Record<string, unknown>>

证明服务的 OpenID 元数据发现文档。