Package org.somda.sdc.dpws.crypto
Class CryptoConfigurator
- java.lang.Object
-
- org.somda.sdc.dpws.crypto.CryptoConfigurator
-
public class CryptoConfigurator extends Object
Supports generation of server and client SSL configurations.Can either generate default configurations or derive configurations based on
CryptoSettingsobjects.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SSLContextcreateSslContextFromCryptoConfig(CryptoSettings cryptoSettings)Accepts aCryptoSettingsobject and creates an SSLContext object.SSLContextcreateSslContextFromSystemProperties()Creates a default SSLContext object based on system properties.List<X509Certificate>getCertificates(CryptoSettings cryptoSettings)Accepts aCryptoSettingsobject and extracts all certificates from the keystore.
-
-
-
Method Detail
-
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
public List<X509Certificate> getCertificates(@Nullable CryptoSettings cryptoSettings)
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
public SSLContext createSslContextFromSystemProperties()
Creates a default SSLContext object based on system properties.- Returns:
- an SSLContext with default crypto settings.
-
-