Class SignatureEncoding


  • public final class SignatureEncoding
    extends Object
    • Method Detail

      • fromAsn1Der

        public static byte[] fromAsn1Der​(byte[] asn1DerSignature,
                                         String algorithm)
                                  throws NoSuchAlgorithmException
        Converts an ASN.1 DER encoded ECDSA signature to a raw signature in the form R|S
        Parameters:
        asn1DerSignature - An ASN.1 DER encoded signature
        algorithm - The algorithm used to produce the given ASN.1 DER encoded signature
        Returns:
        The raw format of the given ASN.1 DER encoded signature in the form R|S
        Throws:
        NoSuchAlgorithmException
      • fromAsn1Der

        public static byte[] fromAsn1Der​(byte[] asn1DerSignature,
                                         Ecdsa algorithm)
        Converts an ASN.1 DER encoded ECDSA signature to a raw signature in the form R|S
        Parameters:
        asn1DerSignature - An ASN.1 DER encoded signature
        algorithm - The algorithm used to produce the given ASN.1 DER encoded signature
        Returns:
        The raw format of the given ASN.1 DER encoded signature in the form R|S
      • toAsn1Der

        public static byte[] toAsn1Der​(byte[] signature,
                                       String algorithm)
                                throws NoSuchAlgorithmException
        Converts a raw ECDSA signature in the form R|S to an ASN.1 DER encoded signature.
        Parameters:
        signature - A raw ECDSA signature in the form R|S.
        algorithm - The algorithm used to produce the given signature.
        Returns:
        The ASN.1 DER encoded signature of the given signature.
        Throws:
        NoSuchAlgorithmException
      • toAsn1Der

        public static byte[] toAsn1Der​(byte[] signature,
                                       Ecdsa algorithm)
        Converts a raw ECDSA signature in the form R|S to an ASN.1 DER encoded signature.
        Parameters:
        signature - A raw ECDSA signature in the form R|S.
        algorithm - The algorithm used to produce the given signature.
        Returns:
        The ASN.1 DER encoded signature of the given signature.