Package eu.europa.esig.dss.spi.x509
Class KeyStoreCertificateSource
java.lang.Object
eu.europa.esig.dss.spi.x509.CommonCertificateSource
eu.europa.esig.dss.spi.x509.KeyStoreCertificateSource
- All Implemented Interfaces:
CertificateSource
,Serializable
Implements a CertificateSource using a KeyStore (PKCS12, JKS,...).
- See Also:
-
Field Summary
Fields inherited from class eu.europa.esig.dss.spi.x509.CommonCertificateSource
certificateMatcher
-
Constructor Summary
ConstructorDescriptionKeyStoreCertificateSource
(File ksFile, String ksType, char[] ksPassword) Constructor for KeyStoreCertificateSource withCertificatePool
.KeyStoreCertificateSource
(InputStream ksStream, String ksType, char[] ksPassword) The default constructor for KeyStoreCertificateSource.KeyStoreCertificateSource
(String ksType, char[] ksPassword) Constructor for KeyStoreCertificateSource.KeyStoreCertificateSource
(String ksFilePath, String ksType, char[] ksPassword) Constructor for KeyStoreCertificateSource. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAllCertificatesToKeyStore
(List<CertificateToken> certificates) This method allows to add a list of certificates to the keystoreaddCertificate
(CertificateToken certificateToAdd) This method adds an external certificate to the source.void
addCertificateToKeyStore
(CertificateToken certificateToken) This method allows to add a certificate in the keystore.void
This method allows to remove all certificates from the keystorevoid
This method allows to remove a certificate from the keystoregetCertificate
(String alias) This method allows to retrieve a certificate by its aliasvoid
store
(OutputStream os) This method allows to store the keystore in the OutputStreamMethods inherited from class eu.europa.esig.dss.spi.x509.CommonCertificateSource
doesCertificateReferenceMatch, findTokensFromCertRef, getByCertificateDigest, getByPublicKey, getBySignerIdentifier, getBySki, getBySubject, getCertificates, getCertificateSourceType, getEntities, getNumberOfCertificates, getNumberOfEntities, isAllSelfSigned, isCertificateSourceEqual, isCertificateSourceEquivalent, isKnown, isTrusted, removeCertificate, reset
-
Constructor Details
-
KeyStoreCertificateSource
Constructor for KeyStoreCertificateSource. This constructor allows to create a new empty keystore.- Parameters:
ksType
- the keystore typeksPassword
- the keystore password
-
KeyStoreCertificateSource
public KeyStoreCertificateSource(String ksFilePath, String ksType, char[] ksPassword) throws IOException Constructor for KeyStoreCertificateSource.- Parameters:
ksFilePath
- the keystore filepathksType
- the keystore typeksPassword
- the keystore password- Throws:
IOException
- if the file not exists
-
KeyStoreCertificateSource
Constructor for KeyStoreCertificateSource withCertificatePool
.- Parameters:
ksFile
- the keystore fileksType
- the keystore typeksPassword
- the keystore password- Throws:
IOException
- if the file not exists
-
KeyStoreCertificateSource
The default constructor for KeyStoreCertificateSource.- Parameters:
ksStream
- the inputstream with the keystore (can be null to create a new keystore)ksType
- the keystore typeksPassword
- the keystore password
-
-
Method Details
-
getCertificate
This method allows to retrieve a certificate by its alias- Parameters:
alias
- the certificate alias in the keystore- Returns:
- the certificate
-
addAllCertificatesToKeyStore
This method allows to add a list of certificates to the keystore- Parameters:
certificates
- the list of certificates
-
addCertificateToKeyStore
This method allows to add a certificate in the keystore. The generated alias will be the DSS ID.- Parameters:
certificateToken
- the certificate to be added in the keystore
-
addCertificate
Description copied from class:CommonCertificateSource
This method adds an external certificate to the source. If the public is already known, the certificate is merged in theCertificateSourceEntity
- Specified by:
addCertificate
in interfaceCertificateSource
- Overrides:
addCertificate
in classCommonCertificateSource
- Parameters:
certificateToAdd
- the certificate to be added- Returns:
- the corresponding certificate token
-
deleteCertificateFromKeyStore
This method allows to remove a certificate from the keystore- Parameters:
alias
- the certificate alias
-
clearAllCertificates
public void clearAllCertificates()This method allows to remove all certificates from the keystore -
store
This method allows to store the keystore in the OutputStream- Parameters:
os
- the OutputStream where to store the keystore
-