JDBCHashStrategy

Determines how the hashing is computed in the implementation

You can implement this to provide a different hashing strategy to the default.

package

Default

Methods

__construct

__construct() 

Compute the hashed password given the unhashed password and the salt

computeHash( $arg0,  $arg1,  $arg2) : string

Arguments

$arg0

string

$arg1

string

$arg2

integer

Response

string

the hashed password

Implements a Hashing Strategy as per https://www.owasp.org/index.php/Password_Storage_Cheat_Sheet (2018-01-17).

createPBKDF2( $arg0) : \io\vertx\jphp\ext\auth\jdbc\JDBCHashStrategy
static

New deployments should use this strategy instead of the default one (which was the previous OWASP recommendation).

The work factor can be updated by using the nonces json array.

Arguments

$arg0

Vertx

Response

\io\vertx\jphp\ext\auth\jdbc\JDBCHashStrategy

the implementation.

This is the current backwards compatible hashing implementation, new applications should prefer the PBKDF2 implementation, unless the tradeoff between security and CPU usage is an option.

createSHA512( $arg0) : \io\vertx\jphp\ext\auth\jdbc\JDBCHashStrategy
static

Arguments

$arg0

Vertx

Response

\io\vertx\jphp\ext\auth\jdbc\JDBCHashStrategy

the implementation.

Compute a random salt.

generateSalt() : string

Response

string

a non null salt value

Retrieve the hashed password from the result of the authentication query

getHashedStoredPwd( $arg0) : string

Arguments

$arg0

array

Response

string

the hashed password

Retrieve the salt from the result of the authentication query

getSalt( $arg0) : string

Arguments

$arg0

array

Response

string

the salt

Time constant string comparision to avoid timming attacks.

isEqual( $arg0,  $arg1) : boolean
static

Arguments

$arg0

string

$arg1

string

Response

boolean

true if equal

Sets a ordered list of nonces where each position corresponds to a version.

setNonces( $arg0) : void

The nonces are supposed not to be stored in the underlying jdbc storage but to be provided as a application configuration. The idea is to add one extra variable to the hash function in order to make breaking the passwords using rainbow tables or precomputed hashes harder. Leaving the attacker only with the brute force approach.

Nonces are dependent on the implementation. E.g.: for the SHA512 they are extra salt used during the hashing, for the PBKDF2 they map the number of iterations the algorithm should take

Arguments

$arg0

array