public final class CcAes extends Object implements Codec
It's recommended to use it in conjunction with CcSigned
codec,
which can be applied
before or after
encryption.
The class is immutable and thread-safe.
Constructor and Description |
---|
CcAes(Codec codec,
byte[] key)
Constructor for the class.
|
CcAes(Codec codec,
SecureRandom random,
Key key)
Constructor for the class.
|
CcAes(Codec codec,
String key)
Constructor for the class.
|
Modifier and Type | Method and Description |
---|---|
Identity |
decode(byte[] bytes)
Decode identity from text (or throw
DecodingException ). |
byte[] |
encode(Identity identity)
Encode identity into bytes.
|
public CcAes(Codec codec, String key)
codec
- Original codeckey
- The encryption keypublic CcAes(Codec codec, byte[] key)
codec
- Original codeckey
- The encryption keypublic CcAes(Codec codec, SecureRandom random, Key key)
codec
- Original codecrandom
- Random generatorkey
- The encryption keypublic byte[] encode(Identity identity) throws IOException
Codec
encode
in interface Codec
identity
- The identityIOException
- If failspublic Identity decode(byte[] bytes) throws IOException
Codec
DecodingException
).
This method may throw
DecodingException
, if it's not
possible to decode the incoming byte array. This exception will mean
that the user can't be authenticated and Identity.ANONYMOUS
object will be identified.
decode
in interface Codec
bytes
- TextIOException
- If failsCopyright © 2015–2019 Take. All rights reserved.