Package no.difi.asic

Class SignatureHelper

java.lang.Object
no.difi.asic.SignatureHelper

public class SignatureHelper extends Object
Helper class to assist when creating a signature.

Not thread safe

Author:
steinar Date: 11.07.15 Time: 22.53
  • Field Details

    • DEFAULT_KEY_STORE_TYPE

      public static final KeyStoreType DEFAULT_KEY_STORE_TYPE
    • provider

      protected final Provider provider
    • jcaDigestCalculatorProviderBuilder

      protected final org.bouncycastle.operator.jcajce.JcaDigestCalculatorProviderBuilder jcaDigestCalculatorProviderBuilder
    • x509Certificate

      protected X509Certificate x509Certificate
    • certificateChain

      protected Certificate[] certificateChain
    • keyPair

      protected KeyPair keyPair
    • jcaContentSignerBuilder

      protected org.bouncycastle.operator.jcajce.JcaContentSignerBuilder jcaContentSignerBuilder
  • Constructor Details

    • SignatureHelper

      public SignatureHelper(File keyStoreFile, String keyStorePassword, String keyPassword) throws IOException
      Loads the keystore and obtains the private key, the public key and the associated certificate
      Throws:
      IOException
    • SignatureHelper

      public SignatureHelper(File keyStoreFile, String keyStorePassword, String keyAlias, String keyPassword) throws IOException
      Loads the keystore and obtains the private key, the public key and the associated certificate referenced by the alias.
      Parameters:
      keyStoreFile - file holding the JKS keystore.
      keyStorePassword - password of the key store itself
      keyAlias - the alias referencing the private and public key pair.
      keyPassword - password protecting the private key
      Throws:
      IOException
    • SignatureHelper

      public SignatureHelper(InputStream keyStoreStream, String keyStorePassword, String keyAlias, String keyPassword)
      Loading keystore and fetching key
      Parameters:
      keyStoreStream - Stream for keystore
      keyStorePassword - Password to open keystore
      keyAlias - Key alias, uses first key if set to null
      keyPassword - Key password
    • SignatureHelper

      public SignatureHelper(File keyStoreFile, String keyStorePassword, KeyStoreType keyStoreType, String keyAlias, String keyPassword) throws IOException
      Loads the keystore and obtains the private key, the public key and the associated certificate referenced by the alias.
      Parameters:
      keyStoreFile - file holding the JKS keystore.
      keyStorePassword - password of the key store itself
      keyStoreType - key store type
      keyAlias - the alias referencing the private and public key pair.
      keyPassword - password protecting the private key
      Throws:
      IOException
    • SignatureHelper

      public SignatureHelper(InputStream keyStoreStream, String keyStorePassword, KeyStoreType keyStoreType, String keyAlias, String keyPassword)
      Loading keystore and fetching key
      Parameters:
      keyStoreStream - Stream for keystore
      keyStorePassword - Password to open keystore
      keyStoreType - key store type
      keyAlias - Key alias, uses first key if set to null
      keyPassword - Key password
    • SignatureHelper

      public SignatureHelper(KeyStore keyStore, String keyAlias, String keyPassword)
      Obtains the private key, the public key and the associated certificate referenced by the alias from the given keystore
      Parameters:
      keyStore - Loaded keystore
      keyAlias - Key alias, uses first key if set to null
      keyPassword - Key password
    • SignatureHelper

      protected SignatureHelper(Provider provider)
  • Method Details