Package com.atlassian.security.password
Class PKCS5S2PasswordHashGenerator
java.lang.Object
com.atlassian.security.password.PKCS5S2PasswordHashGenerator
- All Implemented Interfaces:
PasswordHashGenerator
Encodes passwords using PKCS 5 version 2, as published by RSA and implemented in BouncyCastle.
The iteration count is 10000 and the provided salt must be exactly 16 bytes. The generated hash
will be 256 bits (32 bytes) long.
Clients should not use this class directly, but pass an instance to DefaultPasswordEncoder.
This generator is safe for use on multiple threads because it creates a new instance of
the underlying generator for each call to generateHash(byte[], byte[]).
- See Also:
-
- RSA specification
PKCS5S2ParametersGenerator
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]generateHash(byte[] rawPassword, byte[] salt) Encodes the rawPassword bytes and salt according to their method specified by the implementation.intReturns the required salt length for this hash generator, zero if this generator does not require a salt or -1 if the generator accepts salts of varying length.
-
Constructor Details
-
PKCS5S2PasswordHashGenerator
public PKCS5S2PasswordHashGenerator()
-
-
Method Details
-
generateHash
public byte[] generateHash(byte[] rawPassword, byte[] salt) Description copied from interface:PasswordHashGeneratorEncodes the rawPassword bytes and salt according to their method specified by the implementation. The encoded bytes should be returned without including the salt.- Specified by:
generateHashin interfacePasswordHashGenerator- Parameters:
rawPassword- the password to be encodedsalt- a salt which may be used by some algorithms- Returns:
- the encoded password bytes (without appending or prepending the salt)
-
getRequiredSaltLength
public int getRequiredSaltLength()Description copied from interface:PasswordHashGeneratorReturns the required salt length for this hash generator, zero if this generator does not require a salt or -1 if the generator accepts salts of varying length.- Specified by:
getRequiredSaltLengthin interfacePasswordHashGenerator
-