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

KeyVaultClient.EncryptWithHttpMessagesAsync 方法

定义

使用存储在密钥保管库中的加密密钥加密任意字节序列。

public System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<Microsoft.Azure.KeyVault.Models.KeyOperationResult>> EncryptWithHttpMessagesAsync (string vaultBaseUrl, string keyName, string keyVersion, string algorithm, byte[] value, System.Collections.Generic.Dictionary<string,System.Collections.Generic.List<string>> customHeaders = default, System.Threading.CancellationToken cancellationToken = default);
abstract member EncryptWithHttpMessagesAsync : string * string * string * string * byte[] * System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<Microsoft.Azure.KeyVault.Models.KeyOperationResult>>
override this.EncryptWithHttpMessagesAsync : string * string * string * string * byte[] * System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Rest.Azure.AzureOperationResponse<Microsoft.Azure.KeyVault.Models.KeyOperationResult>>
Public Function EncryptWithHttpMessagesAsync (vaultBaseUrl As String, keyName As String, keyVersion As String, algorithm As String, value As Byte(), Optional customHeaders As Dictionary(Of String, List(Of String)) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of AzureOperationResponse(Of KeyOperationResult))

参数

vaultBaseUrl
String

保管库名称,例如 https://myvault.vault.azure.net

keyName
String

键的名称。

keyVersion
String

密钥的版本。

algorithm
String

算法标识符。 可能的值包括:“RSA-OAEP”、“RSA-OAEP-256”、“RSA1_5”

value
Byte[]
customHeaders
Dictionary<String,List<String>>

将添加到请求的标头。

cancellationToken
CancellationToken

取消标记。

返回

实现

例外

当操作返回无效状态代码时引发

无法反序列化响应时引发

当所需参数为 null 时引发

当所需参数为 null 时引发

注解

ENCRYPT 操作使用 Azure 密钥保管库中存储的加密密钥来加密任意字节序列。 请注意,ENCRYPT 操作仅支持单个数据块,该数据块的大小取决于要使用的目标密钥和加密算法。 只需要对 Azure 密钥保管库中存储的对称密钥严格执行 ENCRYPT 操作,因为可以使用密钥的公共部分执行非对称密钥保护。 非对称密钥支持此操作,这是为了给具有密钥引用,但无权访问公钥材料的调用方提供方便。 此操作需要 keys/encypt 权限。

适用于