org.apache.commons.ssl
public class KeyStoreBuilder extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
KeyStoreBuilder.BuildResult |
Modifier and Type | Field and Description |
---|---|
private static String |
PKCS7_ENCRYPTED |
Constructor and Description |
---|
KeyStoreBuilder() |
Modifier and Type | Method and Description |
---|---|
static KeyStore |
build(byte[] jksOrCerts,
byte[] privateKey,
char[] password) |
static KeyStore |
build(byte[] jksOrCerts,
char[] password) |
static X509Certificate |
buildChain(Key key,
Certificate[] chain)
Builds the chain up such that chain[ 0 ] contains the public key
corresponding to the supplied private key.
|
static void |
main(String[] args) |
static KeyStoreBuilder.BuildResult |
parse(byte[] stuff,
char[] password) |
private static X509Certificate[] |
toChain(Collection certs) |
private static KeyStoreBuilder.BuildResult |
tryJKS(String keystoreType,
ByteArrayInputStream in,
char[] password) |
static void |
validate(KeyStore jks,
char[] password) |
private static final String PKCS7_ENCRYPTED
public KeyStoreBuilder()
public static KeyStore build(byte[] jksOrCerts, char[] password) throws IOException, CertificateException, KeyStoreException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, ProbablyBadPasswordException, UnrecoverableKeyException
public static KeyStore build(byte[] jksOrCerts, byte[] privateKey, char[] password) throws IOException, CertificateException, KeyStoreException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, ProbablyBadPasswordException, UnrecoverableKeyException
public static X509Certificate buildChain(Key key, Certificate[] chain) throws CertificateException, KeyStoreException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException
key
- private keychain
- array of certificates to build chain fromKeyStoreException
- no certificates correspond to private keyCertificateException
- java libraries complainingNoSuchAlgorithmException
- java libraries complainingInvalidKeyException
- java libraries complainingNoSuchProviderException
- java libraries complainingpublic static void validate(KeyStore jks, char[] password) throws CertificateException, KeyStoreException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, UnrecoverableKeyException
public static KeyStoreBuilder.BuildResult parse(byte[] stuff, char[] password) throws IOException, CertificateException, KeyStoreException, ProbablyBadPasswordException
private static KeyStoreBuilder.BuildResult tryJKS(String keystoreType, ByteArrayInputStream in, char[] password) throws GeneralSecurityException, IOException
GeneralSecurityException
IOException
private static X509Certificate[] toChain(Collection certs)