Package org.projecthusky.xua.pki.impl
Class PkiManagerImpl
java.lang.Object
org.projecthusky.xua.pki.impl.PkiManagerImpl
- All Implemented Interfaces:
PkiManager
Implementation class of PkiManager
Implementations Klasse von PkiManager
-
Field Summary
Fields inherited from interface org.projecthusky.xua.pki.PkiManager
TYPE_JCEKS, TYPE_JKS, TYPE_PKCS12
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addClientKeyAndCert
(File privateKeyPemPath, File clientCertPemPath, String alias, KeyStore keyStore, String aKeyPassword) void
addPublicCert
(File publiCertPath, String alias, KeyStore keyStore) Method to add a certificate to a keystore. Methode um ein öffentliches Zertifikat im Key Store zu registrieren.createNewStore
(String storeType) Method to create a newKeyStore
.listCertificateAliases
(KeyStore keyStore) Method to list all registered certificates. Methode zum Auflisten der registrierten Zertifikate.listCertificates
(KeyStore keyStore) Method to list all registered certificates. Methode zum Auflisten der registrierten Zerifikate.loadStore
(InputStream storeInputStream, String storePassword, String storeType) void
removeCert
(String alias, KeyStore keyStore) void
storeStore
(KeyStore keyStore, OutputStream storeOutputStream, String storePassword)
-
Constructor Details
-
PkiManagerImpl
public PkiManagerImpl()
-
-
Method Details
-
addClientKeyAndCert
public void addClientKeyAndCert(File privateKeyPemPath, File clientCertPemPath, String alias, KeyStore keyStore, String aKeyPassword) throws KeyStoreException Method to registers a Client Key/Certificate in theKeyStore
.Methode um ein ClientKey/Zertifikat imKeyStore
zu registrieren.- Specified by:
addClientKeyAndCert
in interfacePkiManager
- Parameters:
privateKeyPemPath
-the path of the file with the private keyder Pfad des Ffiles mit dem privaten SchlüsselclientCertPemPath
-the path of the pem file of the certificateder Pfad des pem Files des Zertifikatesalias
-the alias the key and cert should be referenced withder Alias unter dem der Schlüssel und das Zertifikat referenziert werden sollkeyStore
-the keystore the client key/certificate should be addded toDer keystore in dem Schlüssel/Zertifikat hinzugefügt werden sollaKeyPassword
-the password of the keydas Passwort des Keys- Throws:
KeyStoreException
-will be thrown when an error occures storing the KeyStore to filesystemwird geworfen wenn ein Fehler beim Speichern des KeyStores ins Filesystem auftritt- See Also:
-
addPublicCert
public void addPublicCert(File publiCertPath, String alias, KeyStore keyStore) throws KeyStoreException Method to add a certificate to a keystore.Methode um ein öffentliches Zertifikat im Key Store zu registrieren.- Specified by:
addPublicCert
in interfacePkiManager
- Parameters:
publiCertPath
-the path of the file the certificate is stored inder Pfad des Files des Zertifikatesalias
-the alias the cert should be referenced withder Alias unter dem das Zertifikat referenziert werden sollkeyStore
-the keystore the certificate should be addded toDer Keystore dem das Zertifikat hinzugefügt werden soll- Throws:
KeyStoreException
-will be thrown when an error occures storing the KeyStore to filesystemwird geworfen wenn ein Fehler beim Speichern des KeyStores ins Filesystem auftritt- See Also:
-
createNewStore
Method to create a newKeyStore
. The Keystore is not saved.Methode um einen neuenKeyStore
zu erstellen. Der Keystore wird nicht gespeichert.- Specified by:
createNewStore
in interfacePkiManager
- Parameters:
storeType
-the type of the key store (seePkiManager.TYPE_JKS
, @link #TYPE_JCEKS}, @link #TYPE_PKCS12}).- Returns:
- the
KeyStore
loaded from file.derKeyStore
geladen vom File. - Throws:
KeyStoreException
-will be thrown when an error occures loading the KeyStore from filesystem.wird geworfen wenn ein Fehler beim Laden des KeyStores aus dem Filesystem auftritt- See Also:
-
listCertificateAliases
Method to list all registered certificates.Methode zum Auflisten der registrierten Zertifikate.- Specified by:
listCertificateAliases
in interfacePkiManager
- Parameters:
keyStore
-the keystoreDer Keystore- Returns:
- a
List
of all certificate aliasesEineList
von allen Zertifikat Aliases - Throws:
KeyStoreException
-will be thrown when an error occures storing the KeyStore to filesystemwird geworfen wenn ein Fehler beim Speichern des KeyStores ins Filesystem auftritt- See Also:
-
listCertificates
Method to list all registered certificates.Methode zum Auflisten der registrierten Zerifikate.- Specified by:
listCertificates
in interfacePkiManager
- Parameters:
keyStore
-the keystoreDer Keystore- Returns:
- a
List
of all certificatesEineList
von allen Zertifikaten - Throws:
KeyStoreException
-will be thrown when an error occures storing the KeyStore to filesystemwird geworfen wenn ein Fehler beim Speichern des KeyStores ins Filesystem auftritt- See Also:
-
loadStore
public KeyStore loadStore(InputStream storeInputStream, String storePassword, String storeType) throws KeyStoreException - Specified by:
loadStore
in interfacePkiManager
- Parameters:
storeInputStream
-the InputStream of theKeyStore
file.der InputStream desKeyStore
Files.storePassword
-the password of theKeyStore
das Passwort desKeyStore
storeType
-the type of the key store (seePkiManager.TYPE_JKS
, @link #TYPE_JCEKS}, @link #TYPE_PKCS12}).- Returns:
- the
KeyStore
loaded from file.derKeyStore
geladen vom File. - Throws:
KeyStoreException
-will be thrown when an error occures loading the KeyStorewird geworfen wenn ein Fehler beim Laden des KeyStores auftritt- See Also:
-
removeCert
Removes an Entry from theKeyStore
referenced by an alias.Entfernt ein Eintrag referenziert durch den Alias aus demKeyStore
.- Specified by:
removeCert
in interfacePkiManager
- Parameters:
alias
-the alias the key and cert should be referenced withder Alias unter dem der Schlüssel und das Zertifikat referenziert werden sollkeyStore
-the keystore the certificate should be removed fromDer Keystore dem das Zertifikat entfernt werden soll- Throws:
KeyStoreException
-will be thrown when an error occures storing the KeyStore to filesystemwird geworfen wenn ein Fehler beim Speichern des KeyStores ins Filesystem auftritt- See Also:
-
storeStore
public void storeStore(KeyStore keyStore, OutputStream storeOutputStream, String storePassword) throws KeyStoreException - Specified by:
storeStore
in interfacePkiManager
- Parameters:
keyStore
-the keystore the certificate should be addded toDer Keystore dem das Zertifikat hinzugefügt werden sollstoreOutputStream
-the OutputStream of the file the keystore to be stored inder OutputStream des Files in dem der Keystore gespeichert wirdstorePassword
-the password of theKeyStore
das Passwort desKeyStore
- Throws:
KeyStoreException
-will be thrown when an error occures storing the KeyStore to filesystemwird geworfen wenn ein Fehler beim Speichern des KeyStores ins Filesystem auftritt- See Also:
-