Modifier and Type | Field and Description |
---|---|
static String |
FORMAT_AUTODETECT
Automatically detects the keystore format.
|
static String |
FORMAT_FALLBACK
The fallback keystore format to use.
|
Modifier and Type | Method and Description |
---|---|
static String |
detectFormat(String format,
String name)
Detects the keystore format from the given keystore file name.
|
static KeyManagerFactory |
loadKeyManagerFactory(String keyStoreFormat,
Resource keyStore,
String keyStorePassword)
|
static TrustManagerFactory |
loadTrustManagerFactory(String trustStoreFormat,
Resource trustStore,
String trustStorePassword)
|
public static final String FORMAT_AUTODETECT
public static final String FORMAT_FALLBACK
public static String detectFormat(String format, String name)
format
- The format to base the decision on.name
- The filename of the keystore.public static KeyManagerFactory loadKeyManagerFactory(String keyStoreFormat, Resource keyStore, String keyStorePassword) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnrecoverableKeyException
keyStoreFormat
- The format of the keystore.keyStore
- The resource containing the keystore.keyStorePassword
- The password for the keystore. May be empty or null.KeyStoreException
- If the keystore format isn't supported.IOException
- If there is an I/O or format problem with the keystore data, if a password is required but
not given, or if the given password was incorrect. If the error is due to a wrong password, the
cause
of the IOException
should be an
UnrecoverableKeyException
NoSuchAlgorithmException
- If the algorithm used to check the integrity of the keystore cannot be foundCertificateException
- If any of the certificates in the keystore could not be loadedUnrecoverableKeyException
- If the key cannot be recovered(e.g. the given password is wrong).public static TrustManagerFactory loadTrustManagerFactory(String trustStoreFormat, Resource trustStore, String trustStorePassword) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException
trustStoreFormat
- The format of the truststore.trustStore
- The resource containing the truststore.trustStorePassword
- The password for the truststore. May be empty or null.KeyStoreException
- If the keystore format isn't supported.IOException
- If there is an I/O or format problem with the keystore data, if a password is required but
not given, or if the given password was incorrect. If the error is due to a wrong password, the
cause
of the IOException
should be an
UnrecoverableKeyException
NoSuchAlgorithmException
- If the algorithm used to check the integrity of the keystore cannot be foundCertificateException
- If any of the certificates in the keystore could not be loaded