Class BasicPasswordSpecEncoding
java.lang.Object
org.wildfly.security.password.spec.BasicPasswordSpecEncoding
Provide methods for encoding and decoding of
PasswordSpec.- Author:
- David M. Lloyd, Pedro Igor
-
Method Summary
Modifier and TypeMethodDescriptionstatic PasswordSpecdecode(byte[] encoded) Decode the given byte array and create aPasswordSpecfrom it.static byte[]Encode the givenPasswordto a byte array.static byte[]Encode the givenPasswordto a byte array.static byte[]encode(PasswordSpec passwordSpec) Encode the givenPasswordSpecto a byte array.
-
Method Details
-
encode
public static byte[] encode(PasswordSpec passwordSpec) throws NoSuchAlgorithmException, InvalidKeySpecException Encode the givenPasswordSpecto a byte array.- Parameters:
passwordSpec- the password spec to encode- Returns:
- a byte array representing the encoded password or null if no encoder was capable to encode the given password
- Throws:
NoSuchAlgorithmExceptionInvalidKeySpecException
-
encode
public static byte[] encode(Password password) throws NoSuchAlgorithmException, InvalidKeySpecException Encode the givenPasswordto a byte array.- Parameters:
password- the password to encode- Returns:
- a byte array representing the encoded password or null if no encoder was capable to encode the given password
- Throws:
NoSuchAlgorithmExceptionInvalidKeySpecException
-
encode
public static byte[] encode(Password password, Supplier<Provider[]> providers) throws NoSuchAlgorithmException, InvalidKeySpecException Encode the givenPasswordto a byte array.- Parameters:
password- the password to encodeproviders- providers to use with the underlyingPasswordFactory- Returns:
- a byte array representing the encoded password or null if no encoder was capable to encode the given password
- Throws:
NoSuchAlgorithmExceptionInvalidKeySpecException
-
decode
Decode the given byte array and create aPasswordSpecfrom it.- Parameters:
encoded- the byte array representing the encoded password- Returns:
- a
PasswordSpecinstance created from the encoded password or null if no decoder was capable to decode the given format.
-