public abstract class CipherCodec extends Object
RedisCodec that that allows transparent encryption/decryption of values. This codec uses Cipher
instances provided by CipherCodec.CipherSupplier to process encryption and decryption.
This codec supports various encryption keys by encoding the key name and used key version in the value that is stored in
Redis. The message format for encryption is:
$<key name>+<key version>$<cipher text>
Each value is prefixed with the key message that is enclosed with dollar ($) signs and using the plus sign
(+) to denote the key version. Decryption decodes the key name and requests a Cipher from
CipherCodec.CipherSupplier to decrypt values with an appropriate key/Cipher.
This codec does not provide re-wrapping or key rotation features.CipherCodec.CipherSupplier,
CipherCodec.KeyDescriptor| Modifier and Type | Class and Description |
|---|---|
static interface |
CipherCodec.CipherSupplier
Represents a supplier of
Cipher. |
static class |
CipherCodec.KeyDescriptor
Descriptor to determine which crypto key to use.
|
| Modifier and Type | Method and Description |
|---|---|
static <K,V> RedisCodec<K,V> |
forValues(RedisCodec<K,V> delegate,
CipherCodec.CipherSupplier encrypt,
CipherCodec.CipherSupplier decrypt)
A
RedisCodec that compresses values from a delegating RedisCodec. |
public static <K,V> RedisCodec<K,V> forValues(RedisCodec<K,V> delegate, CipherCodec.CipherSupplier encrypt, CipherCodec.CipherSupplier decrypt)
RedisCodec that compresses values from a delegating RedisCodec.K - Key type.V - Value type.delegate - codec used for key-value encoding/decoding, must not be null.encrypt - the CipherCodec.CipherSupplier of encryption Cipher to use.decrypt - the CipherCodec.CipherSupplier of decryption Cipher to use.Copyright © 2021 lettuce.io. All rights reserved.