Package org.apache.ofbiz.base.util
Class KeyStoreUtil
- java.lang.Object
-
- org.apache.ofbiz.base.util.KeyStoreUtil
-
public final class KeyStoreUtil extends java.lang.Object
KeyStoreUtil - Utilities for getting KeyManagers and TrustManagers
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
module
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
certToString(java.security.cert.Certificate cert)
static java.util.Map<java.lang.String,java.lang.String>
getCertX500Map(java.security.cert.X509Certificate cert)
static java.util.Map<java.lang.String,java.lang.String>
getCertX500Map(javax.security.cert.X509Certificate cert)
static java.security.KeyStore
getComponentKeyStore(java.lang.String componentName, java.lang.String keyStoreName)
static java.security.KeyStore
getStore(java.net.URL url, java.lang.String password)
static java.security.KeyStore
getStore(java.net.URL url, java.lang.String password, java.lang.String type)
static java.security.KeyStore
getSystemTrustStore()
static java.util.Map<java.lang.String,java.lang.String>
getX500Map(java.security.Principal x500)
static void
importPKCS8CertChain(java.security.KeyStore ks, java.lang.String alias, byte[] keyBytes, java.lang.String keyPass, byte[] certChain)
static java.security.cert.Certificate
pemToCert(java.io.File certFile)
static java.security.cert.Certificate
pemToCert(java.io.InputStream is)
static java.security.cert.Certificate
pemToCert(java.io.Reader r)
static java.security.cert.Certificate
pemToCert(java.lang.String certString)
static java.lang.String
pemToPkHex(java.lang.String certString)
static java.security.cert.X509Certificate
readCertificate(byte[] certChain)
static void
storeComponentKeyStore(java.lang.String componentName, java.lang.String keyStoreName, java.security.KeyStore store)
-
-
-
Method Detail
-
storeComponentKeyStore
public static void storeComponentKeyStore(java.lang.String componentName, java.lang.String keyStoreName, java.security.KeyStore store) throws java.io.IOException, GenericConfigException, java.security.NoSuchAlgorithmException, java.security.cert.CertificateException, java.security.KeyStoreException
- Throws:
java.io.IOException
GenericConfigException
java.security.NoSuchAlgorithmException
java.security.cert.CertificateException
java.security.KeyStoreException
-
getComponentKeyStore
public static java.security.KeyStore getComponentKeyStore(java.lang.String componentName, java.lang.String keyStoreName) throws java.io.IOException, java.security.GeneralSecurityException, GenericConfigException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
GenericConfigException
-
getStore
public static java.security.KeyStore getStore(java.net.URL url, java.lang.String password) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
getStore
public static java.security.KeyStore getStore(java.net.URL url, java.lang.String password, java.lang.String type) throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
getSystemTrustStore
public static java.security.KeyStore getSystemTrustStore() throws java.io.IOException, java.security.GeneralSecurityException
- Throws:
java.io.IOException
java.security.GeneralSecurityException
-
readCertificate
public static java.security.cert.X509Certificate readCertificate(byte[] certChain) throws java.security.cert.CertificateException
- Throws:
java.security.cert.CertificateException
-
getCertX500Map
public static java.util.Map<java.lang.String,java.lang.String> getCertX500Map(java.security.cert.X509Certificate cert)
-
getCertX500Map
public static java.util.Map<java.lang.String,java.lang.String> getCertX500Map(javax.security.cert.X509Certificate cert)
-
getX500Map
public static java.util.Map<java.lang.String,java.lang.String> getX500Map(java.security.Principal x500)
-
importPKCS8CertChain
public static void importPKCS8CertChain(java.security.KeyStore ks, java.lang.String alias, byte[] keyBytes, java.lang.String keyPass, byte[] certChain) throws java.security.spec.InvalidKeySpecException, java.security.NoSuchAlgorithmException, java.security.cert.CertificateException, java.security.KeyStoreException
- Throws:
java.security.spec.InvalidKeySpecException
java.security.NoSuchAlgorithmException
java.security.cert.CertificateException
java.security.KeyStoreException
-
certToString
public static java.lang.String certToString(java.security.cert.Certificate cert) throws java.security.cert.CertificateEncodingException
- Throws:
java.security.cert.CertificateEncodingException
-
pemToCert
public static java.security.cert.Certificate pemToCert(java.lang.String certString) throws java.io.IOException, java.security.cert.CertificateException
- Throws:
java.io.IOException
java.security.cert.CertificateException
-
pemToCert
public static java.security.cert.Certificate pemToCert(java.io.File certFile) throws java.io.IOException, java.security.cert.CertificateException
- Throws:
java.io.IOException
java.security.cert.CertificateException
-
pemToCert
public static java.security.cert.Certificate pemToCert(java.io.InputStream is) throws java.io.IOException, java.security.cert.CertificateException
- Throws:
java.io.IOException
java.security.cert.CertificateException
-
pemToCert
public static java.security.cert.Certificate pemToCert(java.io.Reader r) throws java.io.IOException, java.security.cert.CertificateException
- Throws:
java.io.IOException
java.security.cert.CertificateException
-
pemToPkHex
public static java.lang.String pemToPkHex(java.lang.String certString) throws java.io.IOException, java.security.cert.CertificateException
- Throws:
java.io.IOException
java.security.cert.CertificateException
-
-