Class CadesSigner

  • All Implemented Interfaces:
    Signer

    public class CadesSigner
    extends java.lang.Object
    implements Signer
    CAdES signatures must be compliant to the regulations set by ETSI 319 122. https://www.etsi.org/deliver/etsi_en/319100_319199/31912201/01.00.00_20/en_31912201v010000a.pdf https://tools.ietf.org/html/rfc5126
    • Constructor Summary

      Constructors 
      Constructor Description
      CadesSigner​(java.lang.String keyId, java.security.PrivateKey privateKey, java.security.cert.X509Certificate certificate)
      Creates a new signer for CAdES signatures.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getAlgorithm()
      Returns the algorithm for the Key used for signing.
      java.lang.String getKeyId()
      Returns the Key ID used for signing.
      java.lang.String sign​(com.google.protobuf.Message message)
      Signs protobuf message.
      java.lang.String sign​(java.lang.String payload)
      Used for testing, signs the payload with the test key.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • CadesSigner

        public CadesSigner​(java.lang.String keyId,
                           java.security.PrivateKey privateKey,
                           java.security.cert.X509Certificate certificate)
        Creates a new signer for CAdES signatures.
        Parameters:
        keyId - keyId
        privateKey - privateKey
        certificate - certificate
    • Method Detail

      • getKeyId

        public java.lang.String getKeyId()
        Description copied from interface: Signer
        Returns the Key ID used for signing.
        Specified by:
        getKeyId in interface Signer
        Returns:
        the key id
      • getAlgorithm

        public java.lang.String getAlgorithm()
        Description copied from interface: Signer
        Returns the algorithm for the Key used for signing.
        Specified by:
        getAlgorithm in interface Signer
        Returns:
        the algorithm
      • sign

        public java.lang.String sign​(com.google.protobuf.Message message)
        Description copied from interface: Signer
        Signs protobuf message. The message is converted to normalized json and the json gets signed.
        Specified by:
        sign in interface Signer
        Parameters:
        message - payload to sign
        Returns:
        signature as hex encoded string
      • sign

        public java.lang.String sign​(java.lang.String payload)
        Description copied from interface: Signer
        Used for testing, signs the payload with the test key.
        Specified by:
        sign in interface Signer
        Parameters:
        payload - payload to sign
        Returns:
        signature as hex encoded string