Package io.lettuce.core.codec
Class CipherCodec.KeyDescriptor
- java.lang.Object
-
- io.lettuce.core.codec.CipherCodec.KeyDescriptor
-
- Enclosing class:
- CipherCodec
public static class CipherCodec.KeyDescriptor extends Object
Descriptor to determine which crypto key to use. Allows versioning and usage of named keys. Key names must not contain dollar$
or plus+
characters as these characters are used within the message format to encode key name and key version.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CipherCodec.KeyDescriptor
create(String name)
Create a namedCipherCodec.KeyDescriptor
without version.static CipherCodec.KeyDescriptor
create(String name, int version)
Create a named and versionedCipherCodec.KeyDescriptor
.static CipherCodec.KeyDescriptor
create(String name, int version, Charset charset)
Create a named and versionedCipherCodec.KeyDescriptor
usingCharset
to encodename
to its binary representation.String
getName()
Returns the keyname
by decoding name bytes using thedefault charset
.String
getName(Charset charset)
Returns the keyname
by decoding name bytes using the givenCharset
.int
getVersion()
static CipherCodec.KeyDescriptor
unnamed()
Returns the defaultCipherCodec.KeyDescriptor
that has no specified name.
-
-
-
Method Detail
-
unnamed
public static CipherCodec.KeyDescriptor unnamed()
Returns the defaultCipherCodec.KeyDescriptor
that has no specified name.- Returns:
- the default
CipherCodec.KeyDescriptor
.
-
create
public static CipherCodec.KeyDescriptor create(String name)
Create a namedCipherCodec.KeyDescriptor
without version. Version defaults to zero.- Parameters:
name
- the key name. Must not contain plus or dollar character.- Returns:
- the
CipherCodec.KeyDescriptor
forname
.
-
create
public static CipherCodec.KeyDescriptor create(String name, int version)
Create a named and versionedCipherCodec.KeyDescriptor
.- Parameters:
name
- the key name. Must not contain plus or dollar character.version
- the key version.- Returns:
- the
CipherCodec.KeyDescriptor
forname
.
-
create
public static CipherCodec.KeyDescriptor create(String name, int version, Charset charset)
Create a named and versionedCipherCodec.KeyDescriptor
usingCharset
to encodename
to its binary representation.- Parameters:
name
- the key name. Must not contain plus or dollar character.version
- the key version.charset
- must not benull
.- Returns:
- the
CipherCodec.KeyDescriptor
forname
.
-
getVersion
public int getVersion()
-
getName
public String getName()
Returns the keyname
by decoding name bytes using thedefault charset
.- Returns:
- the key name.
-
-