Interface DigestPassword

    • Field Detail

      • ALGORITHM_DIGEST_SHA_256

        static final String ALGORITHM_DIGEST_SHA_256
        The algorithm name "digest-sha-256".
        See Also:
        Constant Field Values
      • ALGORITHM_DIGEST_SHA_384

        static final String ALGORITHM_DIGEST_SHA_384
        The algorithm name "digest-sha-384".
        See Also:
        Constant Field Values
      • ALGORITHM_DIGEST_SHA_512

        static final String ALGORITHM_DIGEST_SHA_512
        The algorithm name "digest-sha-512".
        See Also:
        Constant Field Values
      • ALGORITHM_DIGEST_SHA_512_256

        static final String ALGORITHM_DIGEST_SHA_512_256
        The algorithm name "digest-sha-512-256". (Using SHA-512/256)
        See Also:
        Constant Field Values
    • Method Detail

      • getUsername

        String getUsername()
        Get the username this Password is associated with.

        Generally a Password should not need to know this information but this is an integral part of how the representation of this Password is created.

        Returns:
        the username this Password is associated with
      • getRealm

        String getRealm()
        Get the realm this Password is associated with.

        Note: This is independent of the name of the realm used to obtain the Password representation, this is the value used to generate the digest.

        Returns:
        the realm this Password is associated with
      • getDigest

        byte[] getDigest()
        Get the digest represented by this Password.
        Returns:
        the digest represented by this Password
      • getParameterSpec

        default DigestPasswordAlgorithmSpec getParameterSpec()
        Description copied from interface: Password
        Get the applicable algorithm parameter specification for this password type.
        Specified by:
        getParameterSpec in interface Password
        Returns:
        the algorithm parameter specification, or null if this password type does not support algorithms
      • impliesParameters

        default boolean impliesParameters​(AlgorithmParameterSpec parameterSpec)
        Description copied from interface: Password
        Determine if this password is matched by the given parameter specification.
        Specified by:
        impliesParameters in interface Password
        Parameters:
        parameterSpec - the parameter specification (must not be null)
        Returns:
        true if the password is matched by the parameters, false otherwise
      • createRaw

        static DigestPassword createRaw​(String algorithm,
                                        String username,
                                        String realm,
                                        byte[] digest)
        Create a raw implementation of this password type. No validation of the content is performed, and the password must be "adopted" in to a PasswordFactory (via the PasswordFactory.translate(Password) method) before it can be validated and used to verify guesses.
        Parameters:
        algorithm - the algorithm name
        username - the user name
        realm - the realm
        digest - the digest
        Returns:
        the raw password implementation