Class BasicPasswordSpecEncoding
- java.lang.Object
-
- org.wildfly.security.password.spec.BasicPasswordSpecEncoding
-
public final class BasicPasswordSpecEncoding extends Object
Provide methods for encoding and decoding ofPasswordSpec
.- Author:
- David M. Lloyd, Pedro Igor
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static PasswordSpec
decode(byte[] encoded)
Decode the given byte array and create aPasswordSpec
from it.static byte[]
encode(Password password)
Encode the givenPassword
to a byte array.static byte[]
encode(Password password, Supplier<Provider[]> providers)
Encode the givenPassword
to a byte array.static byte[]
encode(PasswordSpec passwordSpec)
Encode the givenPasswordSpec
to a byte array.
-
-
-
Method Detail
-
encode
public static byte[] encode(PasswordSpec passwordSpec) throws NoSuchAlgorithmException, InvalidKeySpecException
Encode the givenPasswordSpec
to 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:
NoSuchAlgorithmException
InvalidKeySpecException
-
encode
public static byte[] encode(Password password) throws NoSuchAlgorithmException, InvalidKeySpecException
Encode the givenPassword
to 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:
NoSuchAlgorithmException
InvalidKeySpecException
-
encode
public static byte[] encode(Password password, Supplier<Provider[]> providers) throws NoSuchAlgorithmException, InvalidKeySpecException
Encode the givenPassword
to 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:
NoSuchAlgorithmException
InvalidKeySpecException
-
decode
public static PasswordSpec decode(byte[] encoded)
Decode the given byte array and create aPasswordSpec
from it.- Parameters:
encoded
- the byte array representing the encoded password- Returns:
- a
PasswordSpec
instance created from the encoded password or null if no decoder was capable to decode the given format.
-
-