class AuthenticatedEncryptor
cangjie
public class AuthenticatedEncryptor <: IAuthenticatedEncryptor功能:提供认证加密器默认实现。
父类型:
成员概览
| 成员 | 功能 |
|---|---|
| init(ISecret, AuthenticatedEncryptorConfiguration) | 创建认证加密器实例。 |
| func decrypt(Array<Byte>, Array<Byte>) | 解密并验证指定密文。 |
| func encrypt(Array<Byte>, Array<Byte>) | 加密指定明文并附加认证信息。 |
init(ISecret, AuthenticatedEncryptorConfiguration)
cangjie
public init(secret: ISecret, configuration: AuthenticatedEncryptorConfiguration)功能:创建认证加密器实例。
参数:
- secret: ISecret - 认证加密器使用的机密材料。
- configuration: AuthenticatedEncryptorConfiguration - 认证加密器算法配置。
func decrypt(Array<Byte>, Array<Byte>)
cangjie
public func decrypt(ciphertext: Array<Byte>, additionalAuthenticatedData: Array<Byte>): Array<Byte>功能:解密并验证指定密文。
参数:
- ciphertext:
Array<Byte>- 需要解密的密文字节数组。 - additionalAuthenticatedData:
Array<Byte>- 参与认证的附加数据。
返回值:
Array<Byte>- 返回解密后的明文字节数组。
异常:
UnsupportedException- 当密文格式非法或认证失败时抛出。
func encrypt(Array<Byte>, Array<Byte>)
cangjie
public func encrypt(plaintext: Array<Byte>, additionalAuthenticatedData: Array<Byte>): Array<Byte>功能:加密指定明文并附加认证信息。
参数:
- plaintext:
Array<Byte>- 需要加密的明文字节数组。 - additionalAuthenticatedData:
Array<Byte>- 参与认证的附加数据。
返回值:
Array<Byte>- 返回加密后的密文字节数组。