Class KeyStoreManager
java.lang.Object
org.kopi.ebics.certificate.KeyStoreManager
Key store loader. This class loads a key store from
a given path and allow to get private keys and certificates
for a given alias.
The PKCS12 key store type is recommended to be used
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal X509CertificategetCertificate(String alias) Loads a certificate for a given aliasReturns the certificates contained in the key store.final PrivateKeygetPrivateKey(String alias) Loads a private key for a given aliasgetPublicKey(InputStream input) Returns the public key of a given certificate.getPublicKey(BigInteger publicExponent, BigInteger modulus) voidLoads a key store from a given path and passwordread(InputStream input, Provider provider) Reads a certificate from an input stream for a given providerReads all certificate existing in a given key storevoidsave(OutputStream output) Saves the key store to a given output stream.voidsetCertificateEntry(String alias, InputStream input) Writes the given certificate into the key store.
-
Constructor Details
-
KeyStoreManager
public KeyStoreManager()
-
-
Method Details
-
getCertificate
Loads a certificate for a given alias- Parameters:
alias- the certificate alias- Returns:
- the certificate
- Throws:
KeyStoreException
-
getPrivateKey
Loads a private key for a given alias- Parameters:
alias- the certificate alias- Returns:
- the private key
- Throws:
GeneralSecurityException
-
load
Loads a key store from a given path and password- Parameters:
path- the key store pathpassword- the key store password- Throws:
GeneralSecurityExceptionIOException
-
read
Reads a certificate from an input stream for a given provider- Parameters:
input- the input streamprovider- the certificate provider- Returns:
- the certificate
- Throws:
CertificateException
-
getPublicKey
Returns the public key of a given certificate.- Parameters:
input- the given certificate- Returns:
- The RSA public key of the given certificate
- Throws:
GeneralSecurityException
-
getPublicKey
-
setCertificateEntry
public void setCertificateEntry(String alias, InputStream input) throws GeneralSecurityException, IOException Writes the given certificate into the key store.- Parameters:
alias- the certificate aliasinput- the given certificate.- Throws:
GeneralSecurityExceptionIOException
-
save
Saves the key store to a given output stream.- Parameters:
output- the output stream.- Throws:
GeneralSecurityExceptionIOException
-
getCertificates
Returns the certificates contained in the key store.- Returns:
- the certificates contained in the key store.
-
read
Reads all certificate existing in a given key store- Parameters:
keyStore- the key store- Returns:
- A
Mapof certificate, the key of the map is the certificate alias - Throws:
KeyStoreException
-