com.atlassian.security.password
Class PKCS5S2PasswordHashGenerator
java.lang.Object
com.atlassian.security.password.PKCS5S2PasswordHashGenerator
- All Implemented Interfaces:
- PasswordHashGenerator
public final class PKCS5S2PasswordHashGenerator
- extends Object
- implements 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
Method Summary |
byte[] |
generateHash(byte[] rawPassword,
byte[] salt)
Encodes the rawPassword bytes and salt according to their method specified
by the implementation. |
int |
getRequiredSaltLength()
Returns 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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PKCS5S2PasswordHashGenerator
public PKCS5S2PasswordHashGenerator()
generateHash
public byte[] generateHash(byte[] rawPassword,
byte[] salt)
- Description copied from interface:
PasswordHashGenerator
- Encodes 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:
generateHash
in interface PasswordHashGenerator
- 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:
PasswordHashGenerator
- Returns 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:
getRequiredSaltLength
in interface PasswordHashGenerator
Copyright © 2014 Atlassian. All Rights Reserved.