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

KeyVaultKey 类

  • java.lang.Object
    • Closeable
      • IKey
        • com.microsoft.azure.keyvault.extensions.KeyVaultKey

public class KeyVaultKey implements IKey

执行加密操作的密钥保管库密钥。

构造函数摘要

构造函数 说明
KeyVaultKey(KeyVaultClient client, KeyBundle keyBundle)

方法摘要

修饰符和类型 方法和描述
void close()
ListenableFuture<byte[]> decryptAsync(byte[] ciphertext, byte[] iv, byte[] authenticationData, byte[] authenticationTag, String algorithm)

解密指定的密码文本。 请注意,并非所有算法都需要或支持所有参数。

ListenableFuture<Triple<byte[], byte[], String>> encryptAsync(byte[] plaintext, byte[] iv, byte[] authenticationData, String algorithm)

加密指定的纯文本。 请注意,并非所有算法都需要或支持所有参数。

String getDefaultEncryptionAlgorithm()

此密钥的默认加密算法,使用 Json Web 密钥算法中的表示形式,RFC7513。

String getDefaultKeyWrapAlgorithm()

此密钥的默认密钥换行算法,使用 Json Web 密钥算法中的表示形式,RFC7513。

String getDefaultSignatureAlgorithm()

此密钥的默认签名算法,使用 Json Web 密钥算法中的表示形式,RFC7513。

String getKid()

此密钥的唯一密钥标识符。

ListenableFuture<Pair<byte[], String>> signAsync(byte[] digest, String algorithm)

使用指定的算法对指定的摘要进行签名,如果未指定算法,则为键 DefaultSignatureAlgorithm 签名。

ListenableFuture<byte[]> unwrapKeyAsync(byte[] ciphertext, String algorithm)

解包 (解密) 指定的加密密钥材料。

ListenableFuture<Boolean> verifyAsync(byte[] digest, byte[] signature, String algorithm)

使用提供的摘要和算法验证提供的签名值。

ListenableFuture<Pair<byte[], String>> wrapKeyAsync(byte[] plaintext, String algorithm)

包装 (使用指定的算法) 指定的对称密钥材料进行加密,如果未指定,则包装默认密钥WrapAlgorithm。

构造函数详细信息

KeyVaultKey

protected KeyVaultKey(KeyVaultClient client, KeyBundle keyBundle)

Parameters:

client
keyBundle

方法详细信息

close

public void close()

decryptAsync

public ListenableFuture decryptAsync(byte[] ciphertext, byte[] iv, byte[] authenticationData, byte[] authenticationTag, String algorithm)

解密指定的密码文本。 请注意,并非所有算法都需要或支持所有参数。

Overrides:

KeyVaultKey.decryptAsync(byte[] ciphertext, byte[] iv, byte[] authenticationData, byte[] authenticationTag, String algorithm)

Parameters:

ciphertext - 要解密的密码文本
iv - 初始化向量 (可选的某些算法)
authenticationData - 其他身份验证数据 (可选的某些算法)
authenticationTag - 加密操作中的身份验证标记 (可选,某些算法)
algorithm - 必须提供要使用的加密算法

Returns:

包含纯文本的 ListenableFuture

Throws:

NoSuchAlgorithmException - 算法无效

encryptAsync

public ListenableFuture<>> encryptAsync(byte[] plaintext, byte[] iv, byte[] authenticationData, String algorithm)

加密指定的纯文本。 请注意,并非所有算法都需要或支持所有参数。

Overrides:

KeyVaultKey.encryptAsync(byte[] plaintext, byte[] iv, byte[] authenticationData, String algorithm)

Parameters:

plaintext - 要加密的纯文本
iv - 初始化向量 (可选的某些算法)
authenticationData - 其他身份验证数据 (可选的某些算法)
algorithm - 要使用的加密算法,默认为密钥 DefaultEncryptionAlgorithm

Returns:

包含密码文本、身份验证标记和所用算法的 ListenableFuture

Throws:

NoSuchAlgorithmException - 算法无效

getDefaultEncryptionAlgorithm

public String getDefaultEncryptionAlgorithm()

此密钥的默认加密算法,使用 Json Web 密钥算法中的表示形式,RFC7513。

Overrides:

KeyVaultKey.getDefaultEncryptionAlgorithm()

Returns:

此密钥的默认加密算法。

getDefaultKeyWrapAlgorithm

public String getDefaultKeyWrapAlgorithm()

此密钥的默认密钥换行算法,使用 Json Web 密钥算法中的表示形式,RFC7513。

Overrides:

KeyVaultKey.getDefaultKeyWrapAlgorithm()

Returns:

此密钥的默认密钥换行算法。

getDefaultSignatureAlgorithm

public String getDefaultSignatureAlgorithm()

此密钥的默认签名算法,使用 Json Web 密钥算法中的表示形式,RFC7513。

Overrides:

KeyVaultKey.getDefaultSignatureAlgorithm()

Returns:

此密钥的默认签名算法。

getKid

public String getKid()

此密钥的唯一密钥标识符。

Overrides:

KeyVaultKey.getKid()

Returns:

密钥标识符

signAsync

public ListenableFuture<>> signAsync(byte[] digest, String algorithm)

使用指定的算法对指定的摘要进行签名,如果未指定算法,则为键 DefaultSignatureAlgorithm 签名。

Overrides:

KeyVaultKey.signAsync(byte[] digest, String algorithm)

Parameters:

digest - 要签名的摘要
algorithm - 要使用的签名算法

Returns:

包含签名和所用算法的 ListenableFuture。

Throws:

NoSuchAlgorithmException - 算法无效

unwrapKeyAsync

public ListenableFuture unwrapKeyAsync(byte[] ciphertext, String algorithm)

解包 (解密) 指定的加密密钥材料。

Overrides:

KeyVaultKey.unwrapKeyAsync(byte[] ciphertext, String algorithm)

Parameters:

encryptedKey - 要解密的加密密钥
algorithm - 必须提供要使用的算法

Returns:

包含未包装密钥的 ListenableFuture

Throws:

NoSuchAlgorithmException - 算法无效

verifyAsync

public ListenableFuture verifyAsync(byte[] digest, byte[] signature, String algorithm)

使用提供的摘要和算法验证提供的签名值。

Overrides:

KeyVaultKey.verifyAsync(byte[] digest, byte[] signature, String algorithm)

Parameters:

digest - 摘要输入
signature - 要验证的签名
algorithm - 必须提供要使用的算法

Returns:

包含签名和所用算法的 ListenableFuture。

Throws:

NoSuchAlgorithmException - 算法无效

wrapKeyAsync

public ListenableFuture<>> wrapKeyAsync(byte[] plaintext, String algorithm)

包装 (使用指定的算法) 指定的对称密钥材料进行加密,如果未指定,则包装默认密钥WrapAlgorithm。

Overrides:

KeyVaultKey.wrapKeyAsync(byte[] plaintext, String algorithm)

Parameters:

key - 要包装的对称密钥
algorithm - 要使用的包装算法,默认为键 DefaultKeyWrapAlgorithm

Returns:

ListenableFuture 包含加密密钥和使用的算法

Throws:

NoSuchAlgorithmException - 算法无效

适用于