public class KeyStoreBuilder extends Object
Modifier and Type | Class and Description |
---|---|
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,
byte[] privateKey,
char[] jksPassword,
char[] keyPassword) |
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[] jksPass,
char[] keyPass) |
(package private) static KeyStoreBuilder.BuildResult |
parse(byte[] stuff,
char[] jksPass,
char[] keyPass,
boolean forTrustMaterial) |
private static X509Certificate[] |
toChain(Collection certs) |
private static KeyStoreBuilder.BuildResult |
tryJKS(String keystoreType,
ByteArrayInputStream in,
char[] jksPassword,
char[] keyPassword,
boolean forTrustMaterial) |
static KeyStoreBuilder.BuildResult |
validate(KeyStore jks,
char[] keyPass) |
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 KeyStore build(byte[] jksOrCerts, byte[] privateKey, char[] jksPassword, char[] keyPassword) 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 KeyStoreBuilder.BuildResult validate(KeyStore jks, char[] keyPass) throws CertificateException, KeyStoreException, NoSuchAlgorithmException, InvalidKeyException, NoSuchProviderException, UnrecoverableKeyException
public static KeyStoreBuilder.BuildResult parse(byte[] stuff, char[] jksPass, char[] keyPass) throws IOException, CertificateException, KeyStoreException, ProbablyBadPasswordException
static KeyStoreBuilder.BuildResult parse(byte[] stuff, char[] jksPass, char[] keyPass, boolean forTrustMaterial) throws IOException, CertificateException, KeyStoreException, ProbablyBadPasswordException
private static KeyStoreBuilder.BuildResult tryJKS(String keystoreType, ByteArrayInputStream in, char[] jksPassword, char[] keyPassword, boolean forTrustMaterial) throws ProbablyBadPasswordException
ProbablyBadPasswordException
private static X509Certificate[] toChain(Collection certs)