public class CertificateUtils
extends java.lang.Object
Constructor and Description |
---|
CertificateUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
addPKCS12ToKeyStore(java.security.cert.Certificate[] certChain,
java.security.Key key,
java.security.KeyStore ks) |
static void |
addPKCS12ToKeyStore(java.io.File file,
java.security.KeyStore ks,
char[] password) |
static void |
addToKeyStore(java.io.File file,
java.security.KeyStore ks)
Adds the X509Certficate in the file to the KeyStore.
|
static void |
addToKeyStore(java.security.cert.X509Certificate cert,
java.security.KeyStore ks)
Adds an X509Certificate to the KeyStore.
|
static void |
dump(java.security.cert.Certificate cert,
java.io.PrintStream out)
Writes the certificate in base64 encoded from to the print stream.
|
static void |
dumpPKCS12(java.lang.String alias,
java.io.File file,
java.security.KeyStore ks,
char[] password) |
static boolean |
inKeyStores(java.security.cert.X509Certificate c,
java.security.KeyStore[] keyStores)
Checks whether an X509Certificate is already in one of the keystores
|
public static final void addToKeyStore(java.io.File file, java.security.KeyStore ks) throws java.security.cert.CertificateException, java.io.IOException, java.security.KeyStoreException
file
- file with certificateks
- keystore to save tojava.security.cert.CertificateException
- if certificate is wrongjava.io.IOException
- if IO failsjava.security.KeyStoreException
- if keystore failspublic static final void addToKeyStore(java.security.cert.X509Certificate cert, java.security.KeyStore ks) throws java.security.KeyStoreException
cert
- certificate to importks
- keystore to save tojava.security.KeyStoreException
- if keystore failspublic static void addPKCS12ToKeyStore(java.io.File file, java.security.KeyStore ks, char[] password) throws java.lang.Exception
java.lang.Exception
public static void addPKCS12ToKeyStore(java.security.cert.Certificate[] certChain, java.security.Key key, java.security.KeyStore ks) throws java.security.KeyStoreException
java.security.KeyStoreException
public static final boolean inKeyStores(java.security.cert.X509Certificate c, java.security.KeyStore[] keyStores)
c
- the certificatekeyStores
- the KeyStores to check inpublic static void dump(java.security.cert.Certificate cert, java.io.PrintStream out) throws java.io.IOException, java.security.cert.CertificateException
cert
- sertifcate to exportout
- stream to print it tojava.io.IOException
- if io failsjava.security.cert.CertificateException
- if certificate failspublic static void dumpPKCS12(java.lang.String alias, java.io.File file, java.security.KeyStore ks, char[] password) throws java.lang.Exception
java.lang.Exception