Class XmlSafeSaltedHashCodec
java.lang.Object
org.exoplatform.web.security.hash.XmlSafeSaltedHashCodec
- All Implemented Interfaces:
SaltedHashCodec
A codec able to transform a
SaltedHash to and from String.
The string representations produced by encode(SaltedHash) are granted to be valid XML element
names if the length of byte arrays returned by SaltedHash.getSalt() and SaltedHash.getHash() is divisible by
12. This important because encode(SaltedHash) uses the URL safe variant of Byte64 encoding
(see Base64) and for byte array lengths other than 12, the string encoded by Byte64 would have
to be padded with character '*' which would make the result an invalid XML name.- Author:
- Peter Palaga
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionParses the givenStringto aSaltedHash.encode(SaltedHash saltedHash) Transforms the givenSaltedHashtoString.protected byte[]protected StringtoString(byte[] bytes)
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
XmlSafeSaltedHashCodec
public XmlSafeSaltedHashCodec()
-
-
Method Details
-
encode
Description copied from interface:SaltedHashCodecTransforms the givenSaltedHashtoString.- Specified by:
encodein interfaceSaltedHashCodec- Parameters:
saltedHash-- Returns:
-
decode
Description copied from interface:SaltedHashCodecParses the givenStringto aSaltedHash.- Specified by:
decodein interfaceSaltedHashCodec- Parameters:
encodedSaltedHash-- Returns:
- Throws:
SaltedHashEncodingException
-
toString
-
toBytes
-