Class AbstractSignatureTokenConnection

java.lang.Object
eu.europa.esig.dss.token.AbstractSignatureTokenConnection
All Implemented Interfaces:
SignatureTokenConnection, AutoCloseable
Direct Known Subclasses:
AbstractKeyStoreTokenConnection

public abstract class AbstractSignatureTokenConnection extends Object implements SignatureTokenConnection
The abstract implementation of a remote token connection
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Default constructor
  • Method Summary

    Modifier and Type
    Method
    Description
    createPSSParam(eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgo)
    Creates java.security.spec.AlgorithmParameterSpec for the given digestAlgo
    protected eu.europa.esig.dss.model.Digest
    ensureDigestUniform(eu.europa.esig.dss.enumerations.SignatureAlgorithm signatureAlgorithm, eu.europa.esig.dss.model.Digest digest)
    This method ensures the digest value is provided in the correct format for signing according to the given signatureAlgorithm NOTE: When RSA (without PSS) is used, the digest value shall be ASN.1 DigestInfo encoded before signing
    protected Signature
    getSignatureInstance(String javaSignatureAlgorithm)
    Returns the java.security.Signature instance for the given javaSignatureAlgorithm
    initParameters(eu.europa.esig.dss.enumerations.SignatureAlgorithm signatureAlgorithm, eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm)
    This method instantiates signature parameters, when applicable
    eu.europa.esig.dss.model.SignatureValue
    sign(eu.europa.esig.dss.model.ToBeSigned toBeSigned, eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm, DSSPrivateKeyEntry keyEntry)
    This method signs the toBeSigned data with the digest digestAlgorithm and the given keyEntry.
    eu.europa.esig.dss.model.SignatureValue
    sign(eu.europa.esig.dss.model.ToBeSigned toBeSigned, eu.europa.esig.dss.enumerations.SignatureAlgorithm signatureAlgorithm, DSSPrivateKeyEntry keyEntry)
    This method signs the toBeSigned data with the pre-defined signature algorithm signatureAlgorithm, and the given keyEntry.
    eu.europa.esig.dss.model.SignatureValue
    signDigest(eu.europa.esig.dss.model.Digest digest, eu.europa.esig.dss.enumerations.SignatureAlgorithm signatureAlgorithm, DSSPrivateKeyEntry keyEntry)
    This method signs the digest data with the pre-defined signatureAlgorithm and the given keyEntry.
    eu.europa.esig.dss.model.SignatureValue
    signDigest(eu.europa.esig.dss.model.Digest digest, DSSPrivateKeyEntry keyEntry)
    This method signs the digest data with the given keyEntry.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface eu.europa.esig.dss.token.SignatureTokenConnection

    close, getKeys
  • Constructor Details

    • AbstractSignatureTokenConnection

      protected AbstractSignatureTokenConnection()
      Default constructor
  • Method Details

    • sign

      public eu.europa.esig.dss.model.SignatureValue sign(eu.europa.esig.dss.model.ToBeSigned toBeSigned, eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm, DSSPrivateKeyEntry keyEntry) throws eu.europa.esig.dss.model.DSSException
      Description copied from interface: SignatureTokenConnection
      This method signs the toBeSigned data with the digest digestAlgorithm and the given keyEntry.
      Specified by:
      sign in interface SignatureTokenConnection
      Parameters:
      toBeSigned - The data that need to be signed
      digestAlgorithm - The digest algorithm to be used before signing
      keyEntry - The private key to be used
      Returns:
      the signature value representation with the used algorithm and the binary value
      Throws:
      eu.europa.esig.dss.model.DSSException - If there is any problem during the signature process
    • sign

      public eu.europa.esig.dss.model.SignatureValue sign(eu.europa.esig.dss.model.ToBeSigned toBeSigned, eu.europa.esig.dss.enumerations.SignatureAlgorithm signatureAlgorithm, DSSPrivateKeyEntry keyEntry) throws eu.europa.esig.dss.model.DSSException
      Description copied from interface: SignatureTokenConnection
      This method signs the toBeSigned data with the pre-defined signature algorithm signatureAlgorithm, and the given keyEntry.
      Specified by:
      sign in interface SignatureTokenConnection
      Parameters:
      toBeSigned - The data that need to be signed
      signatureAlgorithm - The signature algorithm to be used before signing
      keyEntry - The private key to be used
      Returns:
      the signature value representation with the used algorithm and the binary value
      Throws:
      eu.europa.esig.dss.model.DSSException - If there is any problem during the signature process
    • signDigest

      public eu.europa.esig.dss.model.SignatureValue signDigest(eu.europa.esig.dss.model.Digest digest, DSSPrivateKeyEntry keyEntry) throws eu.europa.esig.dss.model.DSSException
      Description copied from interface: SignatureTokenConnection
      This method signs the digest data with the given keyEntry.
      Specified by:
      signDigest in interface SignatureTokenConnection
      Parameters:
      digest - The digested data that need to be signed
      keyEntry - The private key to be used
      Returns:
      the signature value representation with the used algorithm and the binary value
      Throws:
      eu.europa.esig.dss.model.DSSException - If there is any problem during the signature process
    • signDigest

      public eu.europa.esig.dss.model.SignatureValue signDigest(eu.europa.esig.dss.model.Digest digest, eu.europa.esig.dss.enumerations.SignatureAlgorithm signatureAlgorithm, DSSPrivateKeyEntry keyEntry) throws eu.europa.esig.dss.model.DSSException
      Description copied from interface: SignatureTokenConnection
      This method signs the digest data with the pre-defined signatureAlgorithm and the given keyEntry.
      Specified by:
      signDigest in interface SignatureTokenConnection
      Parameters:
      digest - The digested data that need to be signed
      signatureAlgorithm - The signature algorithm
      keyEntry - The private key to be used
      Returns:
      the signature value representation with the used algorithm and the binary value
      Throws:
      eu.europa.esig.dss.model.DSSException - If there is any problem during the signature process
    • ensureDigestUniform

      protected eu.europa.esig.dss.model.Digest ensureDigestUniform(eu.europa.esig.dss.enumerations.SignatureAlgorithm signatureAlgorithm, eu.europa.esig.dss.model.Digest digest)
      This method ensures the digest value is provided in the correct format for signing according to the given signatureAlgorithm NOTE: When RSA (without PSS) is used, the digest value shall be ASN.1 DigestInfo encoded before signing
      Parameters:
      signatureAlgorithm - SignatureAlgorithm to be used on signing
      digest - Digest to verify
      Returns:
      Digest containing an encoded digest value, when needed
    • initParameters

      protected AlgorithmParameterSpec initParameters(eu.europa.esig.dss.enumerations.SignatureAlgorithm signatureAlgorithm, eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm)
      This method instantiates signature parameters, when applicable
      Parameters:
      signatureAlgorithm - SignatureAlgorithm used on signing
      digestAlgorithm - DigestAlgorithm used to compute the digest value
      Returns:
      AlgorithmParameterSpec
    • getSignatureInstance

      protected Signature getSignatureInstance(String javaSignatureAlgorithm) throws NoSuchAlgorithmException
      Returns the java.security.Signature instance for the given javaSignatureAlgorithm
      Parameters:
      javaSignatureAlgorithm - String representing the Java name of a signature algorithm
      Returns:
      Signature
      Throws:
      NoSuchAlgorithmException - if the algorithm is not found
    • createPSSParam

      protected AlgorithmParameterSpec createPSSParam(eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgo)
      Creates java.security.spec.AlgorithmParameterSpec for the given digestAlgo
      Parameters:
      digestAlgo - DigestAlgorithm
      Returns:
      AlgorithmParameterSpec