public final class LightTokenEncoder extends Object
Modifier and Type | Field and Description |
---|---|
static int |
MAX_PARTS
Maximum number of parts for the tokenizer.
|
static int |
MAX_TOKEN_SIZE
Maximum size for BASE64 encoded token, but applies for the unencoded one also
|
Constructor and Description |
---|
LightTokenEncoder() |
Modifier and Type | Method and Description |
---|---|
protected static byte[] |
calculateDigest(eu.eidas.auth.commons.light.ILightToken lightToken,
String secret,
String algorithm)
Calclates a Digest for the supplied LightToken
|
static BinaryLightToken |
decode(byte[] bytes,
String secret,
String algorithm)
Decodes an array to a BinaryLightToken encapsulating the logical LightToken.
|
static BinaryLightToken |
decodeBase64(byte[] bytes,
String secret,
String algorithm)
Same as
decode(byte[], String, String) , but it performs a safe BASE64 deocding as well |
static BinaryLightToken |
encode(eu.eidas.auth.commons.light.ILightToken token,
String secret,
String algorithm)
This method created a BinaryLightToken from the supplied LightToken, with the supplied parameters.
|
public static final int MAX_TOKEN_SIZE
public static final int MAX_PARTS
@Nonnull public static BinaryLightToken encode(eu.eidas.auth.commons.light.ILightToken token, String secret, String algorithm) throws NoSuchAlgorithmException
token
- the logical to LightToken to be encodedsecret
- secret for creating the digestalgorithm
- digest algorithm (SHA256 is recommended)NoSuchAlgorithmException
- when digest algorithm could not be found.@Nonnull public static BinaryLightToken decodeBase64(@Nonnull byte[] bytes, @Nonnull String secret, @Nonnull String algorithm) throws NoSuchAlgorithmException, SecurityEIDASException
decode(byte[], String, String)
, but it performs a safe BASE64 deocding as wellbytes
- the byte arraysecret
- the secretalgorithm
- the algorithmBinaryLightToken
NoSuchAlgorithmException
- when digest algorithm could not be found.SecurityEIDASException
- when token cannot be parsed@Nonnull public static BinaryLightToken decode(@Nonnull byte[] bytes, @Nonnull String secret, @Nonnull String algorithm) throws NoSuchAlgorithmException, SecurityEIDASException
bytes
- array to be decodedsecret
- secret for checking the digestalgorithm
- digest algorithm (SHA256 is recommended)BinaryLightToken
NoSuchAlgorithmException
- when digest algorithm could not be found.SecurityEIDASException
- when token cannot be parsedprotected static byte[] calculateDigest(@Nonnull eu.eidas.auth.commons.light.ILightToken lightToken, @Nonnull String secret, @Nonnull String algorithm) throws NoSuchAlgorithmException
lightToken
- logical LightTokensecret
- secret for the digestalgorithm
- algorithm for the digestNoSuchAlgorithmException
- when digest algorithm could not be found.Copyright © 2020. All Rights Reserved.