Package org.somda.sdc.dpws.crypto
Class CryptoConfigurator
java.lang.Object
org.somda.sdc.dpws.crypto.CryptoConfigurator
Supports generation of server and client SSL configurations.
Can either generate default configurations or derive configurations based on CryptoSettings objects.
-
Method Summary
Modifier and TypeMethodDescriptioncreateSslContextFromCryptoConfig(CachingCryptoSettings cryptoSettings) Accepts aCachingCryptoSettingsobject and creates an SSLContext object or retrieves it from the cache.createSslContextFromCryptoConfig(CryptoSettings cryptoSettings) Accepts aCryptoSettingsobject and creates an SSLContext object.Creates a default SSLContext object based on system properties.getCertificates(CryptoSettings cryptoSettings) Accepts aCryptoSettingsobject and extracts all certificates from the keystore.
-
Method Details
-
createSslContextFromCryptoConfig
public SSLContext createSslContextFromCryptoConfig(CachingCryptoSettings cryptoSettings) throws KeyStoreException, UnrecoverableKeyException, CertificateException, NoSuchAlgorithmException, IOException, KeyManagementException Accepts aCachingCryptoSettingsobject and creates an SSLContext object or retrieves it from the cache.- Parameters:
cryptoSettings- the crypto settings.- Returns:
- an SSlContext matching the given crypto settings.
- Throws:
KeyStoreExceptionUnrecoverableKeyExceptionCertificateExceptionNoSuchAlgorithmExceptionIOExceptionKeyManagementException
-
createSslContextFromCryptoConfig
public SSLContext createSslContextFromCryptoConfig(CryptoSettings cryptoSettings) throws KeyStoreException, UnrecoverableKeyException, CertificateException, NoSuchAlgorithmException, IOException, KeyManagementException Accepts aCryptoSettingsobject and creates an SSLContext object.- Parameters:
cryptoSettings- the crypto settings.- Returns:
- an SSlContext matching the given crypto settings.
- Throws:
KeyStoreExceptionUnrecoverableKeyExceptionCertificateExceptionNoSuchAlgorithmExceptionIOExceptionKeyManagementException
-
getCertificates
Accepts aCryptoSettingsobject and extracts all certificates from the keystore.- Parameters:
cryptoSettings- the crypto settings. Please note that key store files take precedence over key store streams.- Returns:
- a list of all X509 certificates from the keystore or an empty list.
-
createSslContextFromSystemProperties
Creates a default SSLContext object based on system properties.- Returns:
- an SSLContext with default crypto settings.
-