Class Signature

  • All Implemented Interfaces:
    Digest

    public class Signature
    extends Object
    implements Digest
    The Signature class is used for simplification of the digital signature creation and verification.
    • Field Detail

      • ALGORITHM_NONE_RSA

        public static final String ALGORITHM_NONE_RSA
        RSA signature algorithm with no digest algorithm specified.
        Value is: "NONEwithRSA".
        See Also:
        Constant Field Values
      • ALGORITHM_MD2_RSA

        @Deprecated
        public static final String ALGORITHM_MD2_RSA
        Deprecated.
        It is strongly recommended not to use this algorithm for signature purposes as stated here RFC6149 - Section 6.
        RSA signature algorithm with MD2 digest algorithm.
        Value is: "MD2withRSA".
        See Also:
        Constant Field Values
      • ALGORITHM_MD5_RSA

        @Deprecated
        public static final String ALGORITHM_MD5_RSA
        Deprecated.
        It is strongly recommended not to use this algorithm for signature purposes as stated here RFC6149 - Section 2.
        RSA signature algorithm with MD5 digest algorithm.
        Value is: "MD5withRSA".
        See Also:
        Constant Field Values
      • ALGORITHM_SHA1_RSA

        public static final String ALGORITHM_SHA1_RSA
        RSA signature algorithm with SHA1 digest algorithm.
        Value is: "SHA1withRSA".
        See Also:
        Constant Field Values
      • ALGORITHM_SHA224_RSA

        public static final String ALGORITHM_SHA224_RSA
        RSA signature algorithm with SHA224 digest algorithm.
        Value is: "SHA224withRSA".
        See Also:
        Constant Field Values
      • ALGORITHM_SHA256_RSA

        public static final String ALGORITHM_SHA256_RSA
        RSA signature algorithm with SHA256 digest algorithm.
        Value is: "SHA256withRSA".
        See Also:
        Constant Field Values
      • ALGORITHM_SHA384_RSA

        public static final String ALGORITHM_SHA384_RSA
        RSA signature algorithm with SHA384 digest algorithm.
        Value is: "SHA384withRSA".
        See Also:
        Constant Field Values
      • ALGORITHM_SHA512_RSA

        public static final String ALGORITHM_SHA512_RSA
        RSA signature algorithm with SHA512 digest algorithm.
        Value is: "SHA512withRSA".
        See Also:
        Constant Field Values
      • ALGORITHM_SHA512_224_RSA

        public static final String ALGORITHM_SHA512_224_RSA
        RSA signature algorithm with SHA512/224 digest algorithm.
        Value is: "SHA512/224withRSA".
        See Also:
        Constant Field Values
      • ALGORITHM_SHA512_256_RSA

        public static final String ALGORITHM_SHA512_256_RSA
        RSA signature algorithm with SHA512/256 digest algorithm.
        Value is: "SHA512/256withRSA".
        See Also:
        Constant Field Values
      • ALGORITHM_NONE_ECDSA

        public static final String ALGORITHM_NONE_ECDSA
        Elliptic curve digital signature algorithm with no digest algorithm.
        Value is: "NONEwithECDSA".
        See Also:
        Constant Field Values
      • ALGORITHM_SHA1_ECDSA

        public static final String ALGORITHM_SHA1_ECDSA
        Elliptic curve digital signature algorithm with SHA1 digest algorithm.
        Value is: "SHA1withECDSA".
        See Also:
        Constant Field Values
      • ALGORITHM_SHA224_ECDSA

        public static final String ALGORITHM_SHA224_ECDSA
        Elliptic curve digital signature algorithm with SHA224 digest algorithm.
        Value is: "SHA224withECDSA".
        See Also:
        Constant Field Values
      • ALGORITHM_SHA256_ECDSA

        public static final String ALGORITHM_SHA256_ECDSA
        Elliptic curve digital signature algorithm with SHA256 digest algorithm.
        Value is: "SHA256withECDSA".
        See Also:
        Constant Field Values
      • ALGORITHM_SHA384_ECDSA

        public static final String ALGORITHM_SHA384_ECDSA
        Elliptic curve digital signature algorithm with SHA384 digest algorithm.
        Value is: "SHA384withECDSA".
        See Also:
        Constant Field Values
      • ALGORITHM_SHA512_ECDSA

        public static final String ALGORITHM_SHA512_ECDSA
        Elliptic curve digital signature algorithm with SHA512 digest algorithm.
        Value is: "SHA512withECDSA".
        See Also:
        Constant Field Values
    • Method Detail

      • builder

        public static Signature.Builder builder()
        Create a new builder.
        Returns:
        new builder
      • digest

        public Base64Value digest​(Base64Value value)
        Description copied from interface: Digest
        Create digest of the value.
        Specified by:
        digest in interface Digest
        Parameters:
        value - value to make digest from
        Returns:
        digest of the value
      • verify

        public boolean verify​(Base64Value toVerify,
                              Base64Value digestToVerify)
        Description copied from interface: Digest
        Verify the digest of the value against the provided digest.
        Specified by:
        verify in interface Digest
        Parameters:
        toVerify - value to create digest from
        digestToVerify - digest which needs to be verified
        Returns:
        whether both digests are the same