Package dk.netarkivet.common.utils
Class BasicTwoWaySSLProvider
- java.lang.Object
-
- dk.netarkivet.common.utils.BasicTwoWaySSLProvider
-
public class BasicTwoWaySSLProvider extends Object
Class for loading certificates and keys from a key- and truststore and configuring an Apache HTTP Registry to use these. To enable SSL for an HTTPClient using this class follow the below steps: - ConfigureCommonSettings.ACCESS_TRUSTSTORE_PATH
to point at a Java KeyStore file containing your trusted certificates (e.g. the standard truststore provided by Java located by default at /etc/ssl/certs/java/cacerts). - ConfigureCommonSettings.TRUSTSTORE_PASSWORD
with the truststore password (default truststore pw is 'changeit'). - Instantiate this class with a provided keyfile to use for authentication. - Configure the HTTPClient's connection socket to use the SSLContext provided throughgetSSLContext()
.
-
-
Constructor Summary
Constructors Constructor Description BasicTwoWaySSLProvider(String privateKeyFile)
Constructor that initializes the SSLContext for use.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SSLContext
getSSLContext()
-
-
-
Constructor Detail
-
BasicTwoWaySSLProvider
public BasicTwoWaySSLProvider(String privateKeyFile)
Constructor that initializes the SSLContext for use. - Creates keystore object from truststore - Loads private key and certificate - Sets up SSLContext- Parameters:
privateKeyFile
- The path to the private key file to use for authentication. Expects file in PEM format.
-
-
Method Detail
-
getSSLContext
public SSLContext getSSLContext()
-
-