Class IdentifierWithHMAC

    • Constructor Detail

      • IdentifierWithHMAC

        public IdentifierWithHMAC​(byte[] value,
                                  SecretKey hmacKey)
        Creates a new identifier protected with a SHA-256 based HMAC.
        Parameters:
        value - The identifier value. Must not empty or null.
        hmacKey - The HMAC key. Must be at least 128 bits long.
      • IdentifierWithHMAC

        public IdentifierWithHMAC​(SecretKey hmacKey)
        Generates a new 128-bite secure random identifier and protects it with a SHA-256 based HMAC.
        Parameters:
        hmacKey - The HMAC key. Must be at least 128 bits long.
        Throws:
        RuntimeException - If HMAC computation failed.
    • Method Detail

      • equals

        public boolean equals​(Object object)
        Description copied from class: BaseIdentifier
        Overrides Object.equals().
        Specified by:
        equals in class BaseIdentifier
        Parameters:
        object - The object to compare to.
        Returns:
        true if the objects have the same value, otherwise false.
      • parse

        public static com.nimbusds.jose.util.Base64URL[] parse​(String value)
                                                        throws InvalidIdentifierException
        Parses the specified identifier with HMAC protection.
        Parameters:
        value - The identifier value to parse and validate. Must not be null.
        Returns:
        The identifier parts.
        Throws:
        InvalidIdentifierException - If the identifier format is illegal.
      • parseUnchecked

        public static com.nimbusds.jose.util.Base64URL[] parseUnchecked​(String value)
        Parses the specified identifier with HMAC protection.
        Parameters:
        value - The identifier value to parse and validate. Must not be null.
        Returns:
        The identifier parts.
        Throws:
        RuntimeException - If the identifier format is illegal.