Package eu.europa.esig.dss.token
Class KeyStoreSignatureTokenConnection
java.lang.Object
eu.europa.esig.dss.token.AbstractSignatureTokenConnection
eu.europa.esig.dss.token.AbstractKeyStoreTokenConnection
eu.europa.esig.dss.token.KeyStoreSignatureTokenConnection
- All Implemented Interfaces:
SignatureTokenConnection
,AutoCloseable
- Direct Known Subclasses:
JKSSignatureToken
,Pkcs12SignatureToken
Connection to a key store
-
Constructor Summary
ConstructorDescriptionKeyStoreSignatureTokenConnection
(byte[] ksBytes, String ksType, KeyStore.PasswordProtection ksPassword) Constructor from keyStore's binariesKeyStoreSignatureTokenConnection
(File ksFile, String ksType, KeyStore.PasswordProtection ksPassword) Constructor from a fileKeyStoreSignatureTokenConnection
(InputStream ksStream, String ksType, KeyStore.PasswordProtection password) Construct a KeyStoreSignatureTokenConnection object.KeyStoreSignatureTokenConnection
(String filepath, String ksType, KeyStore.PasswordProtection ksPassword) Constructor with a path to KeyStore -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
protected KeyStore.PasswordProtection
Gets the password protectionprotected KeyStore
Gets the key storeMethods inherited from class eu.europa.esig.dss.token.AbstractKeyStoreTokenConnection
getKey, getKey, getKeys, setKeyEntryPredicate
Methods inherited from class eu.europa.esig.dss.token.AbstractSignatureTokenConnection
createPSSParam, getSignatureInstance, sign, sign, sign, signDigest, signDigest, signDigest
-
Constructor Details
-
KeyStoreSignatureTokenConnection
public KeyStoreSignatureTokenConnection(byte[] ksBytes, String ksType, KeyStore.PasswordProtection ksPassword) Constructor from keyStore's binaries- Parameters:
ksBytes
- byte array representing the keyStoreksType
-String
type of the keyStoreksPassword
-KeyStore.PasswordProtection
-
KeyStoreSignatureTokenConnection
public KeyStoreSignatureTokenConnection(String filepath, String ksType, KeyStore.PasswordProtection ksPassword) throws IOException Constructor with a path to KeyStore- Parameters:
filepath
-String
path to the KeyStoreksType
-String
type of the keyStoreksPassword
-KeyStore.PasswordProtection
- Throws:
IOException
- if an exception occurs
-
KeyStoreSignatureTokenConnection
public KeyStoreSignatureTokenConnection(File ksFile, String ksType, KeyStore.PasswordProtection ksPassword) throws IOException Constructor from a file- Parameters:
ksFile
-File
to the KeyStoreksType
-String
type of the keyStoreksPassword
-KeyStore.PasswordProtection
- Throws:
IOException
- if an exception occurs
-
KeyStoreSignatureTokenConnection
public KeyStoreSignatureTokenConnection(InputStream ksStream, String ksType, KeyStore.PasswordProtection password) Construct a KeyStoreSignatureTokenConnection object. Please note that the keystore password will also be used to retrieve the private key. For each keystore entry (identifiable by alias) the same private key password will be used. If you want to specify a separate private key password use theAbstractKeyStoreTokenConnection.getKey(String, PasswordProtection)
method.- Parameters:
ksStream
- the inputstream which contains the keystoreksType
- the keystore typepassword
- the keystore password
-
-
Method Details
-
getKeyStore
Description copied from class:AbstractKeyStoreTokenConnection
Gets the key store- Specified by:
getKeyStore
in classAbstractKeyStoreTokenConnection
- Returns:
KeyStore
-
getKeyProtectionParameter
Description copied from class:AbstractKeyStoreTokenConnection
Gets the password protection- Specified by:
getKeyProtectionParameter
in classAbstractKeyStoreTokenConnection
- Returns:
KeyStore.PasswordProtection
-
close
public void close()
-