Package no.difi.asic
Class SignatureHelper
java.lang.Object
no.difi.asic.SignatureHelper
Helper class to assist when creating a signature.
Not thread safe
- Author:
- steinar Date: 11.07.15 Time: 22.53
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Certificate[]static final KeyStoreTypeprotected org.bouncycastle.operator.jcajce.JcaContentSignerBuilderprotected final org.bouncycastle.operator.jcajce.JcaDigestCalculatorProviderBuilderprotected KeyPairprotected final Providerprotected X509Certificate -
Constructor Summary
ConstructorsModifierConstructorDescriptionSignatureHelper(File keyStoreFile, String keyStorePassword, String keyPassword) Loads the keystore and obtains the private key, the public key and the associated certificateSignatureHelper(File keyStoreFile, String keyStorePassword, String keyAlias, String keyPassword) Loads the keystore and obtains the private key, the public key and the associated certificate referenced by the alias.SignatureHelper(File keyStoreFile, String keyStorePassword, KeyStoreType keyStoreType, String keyAlias, String keyPassword) Loads the keystore and obtains the private key, the public key and the associated certificate referenced by the alias.SignatureHelper(InputStream keyStoreStream, String keyStorePassword, String keyAlias, String keyPassword) Loading keystore and fetching keySignatureHelper(InputStream keyStoreStream, String keyStorePassword, KeyStoreType keyStoreType, String keyAlias, String keyPassword) Loading keystore and fetching keySignatureHelper(KeyStore keyStore, String keyAlias, String keyPassword) Obtains the private key, the public key and the associated certificate referenced by the alias from the given keystoreprotectedSignatureHelper(Provider provider) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidloadCertificate(KeyStore keyStore, String keyAlias, String keyPassword) protected KeyStoreloadKeyStore(InputStream keyStoreStream, String keyStorePassword, KeyStoreType keyStoreType)
-
Field Details
-
DEFAULT_KEY_STORE_TYPE
-
provider
-
jcaDigestCalculatorProviderBuilder
protected final org.bouncycastle.operator.jcajce.JcaDigestCalculatorProviderBuilder jcaDigestCalculatorProviderBuilder -
x509Certificate
-
certificateChain
-
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 itselfkeyAlias- 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 keystorekeyStorePassword- Password to open keystorekeyAlias- Key alias, uses first key if set to nullkeyPassword- 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 itselfkeyStoreType- key store typekeyAlias- 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 keystorekeyStorePassword- Password to open keystorekeyStoreType- key store typekeyAlias- Key alias, uses first key if set to nullkeyPassword- Key password
-
SignatureHelper
Obtains the private key, the public key and the associated certificate referenced by the alias from the given keystore- Parameters:
keyStore- Loaded keystorekeyAlias- Key alias, uses first key if set to nullkeyPassword- Key password
-
SignatureHelper
-
-
Method Details
-
loadKeyStore
protected KeyStore loadKeyStore(InputStream keyStoreStream, String keyStorePassword, KeyStoreType keyStoreType) -
loadCertificate
-