org.jasypt.util.password

## Class BasicPasswordEncryptor

- Object
- - org.jasypt.util.password.BasicPasswordEncryptor

- All Implemented Interfaces:
    PasswordEncryptor

      public final class BasicPasswordEncryptor
      extends Object
      implements PasswordEncryptor

  Utility class for easily performing password digesting and checking.

  This class internally holds a `StandardStringDigester` configured this way:

  - Algorithm: `MD5`.
  - Salt size: `8 bytes`.
  - Iterations: `1000`.

  The required steps to use it are:

  1. Create an instance (using `new`).
  2. Perform the desired ``encryptPassword(String)`` or ``checkPassword(String, String)`` operations.

  This class is thread-safe

  Since:
    1.2 (class existed as org.jasypt.util.PasswordEncryptor since 1.0)
  Author:
    Daniel Fernández

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicPasswordEncryptor()` Creates a new instance of `BasicPasswordEncryptor`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `checkPassword(String plainPassword, String encryptedPassword)` Checks an unencrypted (plain) password against an encrypted one (a digest) to see if they match.
    `String` | `encryptPassword(String password)` Encrypts (digests) a password.

    - ### Methods inherited from class Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BasicPasswordEncryptor

          public BasicPasswordEncryptor()

      Creates a new instance of `BasicPasswordEncryptor`

  - ### Method Detail

    - #### encryptPassword

          public String encryptPassword(String password)

      Encrypts (digests) a password.
      Specified by:
        `encryptPassword` in interface `PasswordEncryptor`
      Parameters:
        `password` - the password to be encrypted.
      Returns:
        the resulting digest.
      See Also:
        `StandardStringDigester.digest(String)`

    - #### checkPassword

          public boolean checkPassword(String plainPassword,
                                       String encryptedPassword)

      Checks an unencrypted (plain) password against an encrypted one (a digest) to see if they match.
      Specified by:
        `checkPassword` in interface `PasswordEncryptor`
      Parameters:
        `plainPassword` - the plain password to check.
        `encryptedPassword` - the digest against which to check the password.
      Returns:
        true if passwords match, false if not.
      See Also:
        `StandardStringDigester.matches(String, String)`

Copyright © 2019 The JASYPT team. All rights reserved.