interface IKeyManager
cangjie
public interface IKeyManager功能:定义密钥创建、查询与撤销的管理接口。
成员概览
| 成员 | 功能 |
|---|---|
| func createNewKey(DateTime, DateTime) | 创建新密钥并持久化到底层存储。 |
| func getAllKeys() | 从底层存储加载全部密钥。 |
| func createEncryptorInstance(IKey) | 为指定密钥创建认证加密器实例。 |
| func revokeKey(KeyIdentifier, String) | 撤销指定密钥并持久化撤销状态。 |
| func revokeAllKeys(DateTime, String) | 撤销指定日期之前创建的所有密钥并持久化。 |
| func getCacheExpirationToken() | 获取当前缓存失效令牌。 |
func createNewKey(DateTime, DateTime)
cangjie
func createNewKey(activationDate: DateTime, expirationDate: DateTime): IKey功能:创建新密钥并持久化到底层存储。
参数:
- activationDate:
DateTime- 密钥可用于加密的起始时间。 - expirationDate:
DateTime- 密钥不再接受新加密操作的截止时间。
返回值:
- IKey - 返回新创建的密钥。
func getAllKeys()
cangjie
func getAllKeys(): ReadOnlyList<IKey>功能:从底层存储加载全部密钥。
返回值:
- ReadOnlyList<IKey> - 返回包含全部密钥的只读列表。
func createEncryptorInstance(IKey)
cangjie
func createEncryptorInstance(key: IKey): IAuthenticatedEncryptor功能:为指定密钥创建认证加密器实例。
参数:
- key: IKey - 需要创建加密器的密钥。
返回值:
- IAuthenticatedEncryptor - 返回认证加密器实例。
func revokeKey(KeyIdentifier, String)
cangjie
func revokeKey(keyId: KeyIdentifier, reason: String): Unit功能:撤销指定密钥并持久化撤销状态。
参数:
- keyId: KeyIdentifier - 要撤销的密钥标识。
- reason:
String- 用于审计的撤销原因。
返回值:
Unit
func revokeAllKeys(DateTime, String)
cangjie
func revokeAllKeys(revocationDate: DateTime, reason: String): Unit功能:撤销指定日期之前创建的所有密钥并持久化。
参数:
- revocationDate:
DateTime- 撤销截止日期。 - reason:
String- 用于审计的撤销原因。
返回值:
Unit
func getCacheExpirationToken()
cangjie
func getCacheExpirationToken(): IKeyExpirationToken功能:获取当前缓存失效令牌。
返回值:
- IKeyExpirationToken - 返回当前缓存失效令牌。