AsymmetricCipherContextBuilder
为构建非对称加密操作的上下文提供支持。
扩展
BaseCryptoClass
扩展自
构造函数
new AsymmetricCipherContextBuilder()
new AsymmetricCipherContextBuilder(): AsymmetricCipherContextBuilder
返回值
AsymmetricCipherContextBuilder
方法
buildDecryptionContext()
buildDecryptionContext(key: PrivateKey): DecryptionContext
使用给定的私钥构建解密上下文。此上下文可用于解密由对应公钥加密的数据。
参数
key
用于解密的私钥。
抛出
- 如果密钥缺少用途。
返回值
DecryptionContext 解密上下文。
buildEncryptionContext()
buildEncryptionContext(key: PublicKey): EncryptionContext
使用给定的公钥构建加密上下文。此上下文可用于加密只有对应私钥的持有者才能解密的数据。
参数
key
用于加密的公钥。
抛出
- 如果密钥缺少用途。
返回值
EncryptionContext 加密上下文。
buildWrappingContext()
buildWrappingContext(pubKey: PublicKey, privKey: PrivateKey, scheme: WrappingScheme): WrappingContext
使用给定的公钥/私钥和封装方案构建封装上下文。此上下文可用于密钥封装操作,包括对加密密钥进行加密。
参数
pubKey
公钥。封装操作必需。
privKey
私钥。解封操作必需。
scheme
要使用的封装方案。
抛出
- 在以下情况下抛出:
- 提供了公钥,但该密钥缺少用途。
- 提供了私钥,但该密钥缺少用途。
- 如果该实现不支持封装操作。
返回值
WrappingContext 封装上下文。
Last updated: 2026年7月22日

