public final class CcXOR extends Object implements Codec
The class is immutable and thread-safe.
Constructor and Description |
---|
CcXOR(Codec codec,
byte[] key)
Ctor.
|
CcXOR(Codec codec,
String key)
Ctor.
|
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 CcXOR(Codec codec, String key)
codec
- Original codeckey
- Secret key for encodingpublic CcXOR(Codec codec, byte[] key)
codec
- Original codeckey
- Secret key for encodingpublic 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 Take. All rights reserved.