liveBook · Manning

Pbkdf2PasswordEncoder

As explained in Spring Security in Action, Second Edition

Pbkdf2PasswordEncoder is a Spring Security PasswordEncoder implementation that derives password representations using PBKDF2.

Pbkdf2PasswordEncoder is a Spring Security PasswordEncoder implementation that derives password representations with the password-based key derivation function 2 (PBKDF2). section 4.1.3

Spring Security provides several PasswordEncoder choices:

  • Pbkdf2PasswordEncoder uses PBKDF2. section 4.1.3
  • BCryptPasswordEncoder and SCryptPasswordEncoder use bcrypt and scrypt respectively; StandardPasswordEncoder uses SHA-256 and is deprecated, while NoOpPasswordEncoder leaves passwords in cleartext for examples only. section 4.1.3

Parameterized construction

PasswordEncoder p = new Pbkdf2PasswordEncoder("secret", 16, 310000, Pbkdf2PasswordEncoder.SecretKeyFactoryAlgorithm.PBKDF2WithHmacSHA256); section 4.1.3

PasswordEncoder p = 
  new Pbkdf2PasswordEncoder("secret", 16, 310000, Pbkdf2PasswordEncoder. SecretKeyFactoryAlgorithm.PBKDF2WithHmacSHA256);

Inspect the complete parameterized Pbkdf2PasswordEncoder declaration. section 4.1.3

How Spring Security in Action, Second Edition covers it

How deep it goes
Defines PBKDF2's role and shows a parameterized constructor call, but does not explain derivation internals or verification.
Examples
Uses a constructor call with a secret, 16, 310000, and PBKDF2WithHmacSHA256.
What you can do after
Apply via Spring Security's PasswordEncoder API by instantiating Pbkdf2PasswordEncoder with explicit parameters.
How it connects
Connects PBKDF2 with PasswordEncoder, BCryptPasswordEncoder, SCryptPasswordEncoder, StandardPasswordEncoder, and NoOpPasswordEncoder.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring Security in Action, Second Edition. The section links point to the parts of the book it draws on.