Package org.gluu.oxtrust.util
Class KeystoreWrapper
java.lang.Object
org.gluu.oxtrust.util.KeystoreWrapper
Provides utility methods for JKS KeyStores.
- Author:
- Dmitry Ognyannikov, 2016
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionKeystoreWrapper(String filepath, String password, String type) Open existing keystore or create new if don't exist. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCertificate(X509Certificate cert, String alias) voidAdd key.voiddeleteCertificate(String alias) voidsave()void
-
Field Details
-
KEYSTORE_PKCS12
Every implementation of the Java platform is required to support the following standard KeyStore type: PKCS12- See Also:
-
KEYSTORE_JKS
Oracle JDK / OpenJDK specific- See Also:
-
KEYSTORE_JCEKS
Oracle JDK / OpenJDK specific- See Also:
-
-
Constructor Details
-
KeystoreWrapper
public KeystoreWrapper(String filepath, String password, String type) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException Open existing keystore or create new if don't exist.- Parameters:
filepath-password-type-- Throws:
KeyStoreExceptionIOExceptionNoSuchAlgorithmExceptionCertificateException
-
-
Method Details
-
save
public void save() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException -
saveAs
public void saveAs(String filepath, String password) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException -
listCertificates
- Throws:
KeyStoreException
-
deleteCertificate
- Throws:
KeyStoreException
-
addCertificate
- Throws:
KeyStoreException
-
addKey
Add key. Use JCEKS keystore type to add symmetric key.- Parameters:
key-alias-password-- Throws:
KeyStoreException
-