Groovy Documentation

com.ace.mws.plugins
[Java] Interface ISslService


public interface ISslService

This service is used to aid in loading certificates for SSL communication with other APIs. Each method generates a SSLSocketFactory instance that uses the specified client and/or server certificate(s). This socket factory may be used to generate a SSL based Socket or may be used in combination with other communication libraries (such as the HttpsURLConnection).

Methods are provided for loading and using a client certificate file with an optional password as well as overriding the trust store to use specified server or chain certificates. Certificate files may be in the PEM file format and do not need to be converted in DER as is typical of Java.

It should be noted that this service is not needed when performing SSL communications with known and trusted certificates, such as when communicating with HTTPS enabled websites that do not have a self-signed certificate.

Authors:
bsaville


Method Summary
HostnameVerifier getLenientHostnameVerifier()

Generates a hostname verifier that automatically trusts all host names.

SSLSocketFactory getLenientSocketFactory()

Generates a socket factory that automatically trusts all server certificates.

SSLSocketFactory getSocketFactory(String clientCertificate, String clientCertAlias)

Generates a socket factory for the specified options.

SSLSocketFactory getSocketFactory(String clientCertificate, String clientCertAlias, String clientPrivateKey, String clientKeyPassword)

Generates a socket factory for the specified options.

SSLSocketFactory getSocketFactory(String serverCertificate)

Generates a socket factory for the specified options.

SSLSocketFactory getSocketFactory(String clientCertificate, String clientCertAlias, String serverCertificate)

Generates a socket factory for the specified options.

SSLSocketFactory getSocketFactory(String clientCertificate, String clientCertAlias, String clientPrivateKey, String clientKeyPassword, String serverCertificate)

Generates a socket factory for the specified options.

 

Method Detail

getLenientHostnameVerifier

public HostnameVerifier getLenientHostnameVerifier()
Generates a hostname verifier that automatically trusts all host names.
WARNING: If this hostname verifier is used, it may present a large security risk. Use only during development and only when the risks are understood.
Returns:
A HostnameVerifier instance that may be used in the communication library of choice


getLenientSocketFactory

public SSLSocketFactory getLenientSocketFactory()
Generates a socket factory that automatically trusts all server certificates.
WARNING: If this socket factory is used, it may present a large security risk. Use only during development and only when the risks are understood.
throws:
Exception On error initializing the SSL context
Returns:
An SSLSocketFactory instance that may be used in the communication library of choice


getSocketFactory

public SSLSocketFactory getSocketFactory(String clientCertificate, String clientCertAlias)
Generates a socket factory for the specified options.

If the certificate file is a relative path (no leading '/'), it will be loaded from the MWS certificates directory as documented.

throws:
Exception On error initializing the SSL context or if the certificate(s) are invalid
Parameters:
clientCertificate - The client certificate file to use
clientCertAlias - The alias of the client certificate to use for socket communication, may be null to use the given certificate's alias
Returns:
An SSLSocketFactory instance that may be used in the communication library of choice


getSocketFactory

public SSLSocketFactory getSocketFactory(String clientCertificate, String clientCertAlias, String clientPrivateKey, String clientKeyPassword)
Generates a socket factory for the specified options.

If the certificate file or private key is a relative path (no leading '/'), it will be loaded from the MWS certificates directory as documented.

throws:
Exception On error initializing the SSL context or if the certificate(s) are invalid
Parameters:
clientCertificate - The client certificate file to use
clientCertAlias - The alias of the client certificate to use for socket communication, may be null to use the given certificate's alias
clientPrivateKey - The client private key file to use
clientKeyPassword - The password to decrypt the client certificate private key, may be null to use an unencrypted certificate
Returns:
An SSLSocketFactory instance that may be used in the communication library of choice


getSocketFactory

public SSLSocketFactory getSocketFactory(String serverCertificate)
Generates a socket factory for the specified options.

If the client, private key, or server certificate file is a relative path (no leading '/'), it will be loaded from the MWS certificates directory as documented.

throws:
Exception On error initializing the SSL context or if the certificate(s) are invalid
Parameters:
serverCertificate - The server certificate(s) or chain certificate to use (multiple certificates may be present in this file)
Returns:
An SSLSocketFactory instance that may be used in the communication library of choice


getSocketFactory

public SSLSocketFactory getSocketFactory(String clientCertificate, String clientCertAlias, String serverCertificate)
Generates a socket factory for the specified options.

If the client or server certificate file is a relative path (no leading '/'), it will be loaded from the MWS certificates directory as documented.

throws:
Exception On error initializing the SSL context or if the certificate(s) are invalid
Parameters:
clientCertificate - The client certificate file to use
clientCertAlias - The alias of the client certificate to use for socket communication, may be null to use the given certificate's alias
serverCertificate - The server certificate(s) or chain certificate to use (multiple certificates may be present in this file)
Returns:
An SSLSocketFactory instance that may be used in the communication library of choice


getSocketFactory

public SSLSocketFactory getSocketFactory(String clientCertificate, String clientCertAlias, String clientPrivateKey, String clientKeyPassword, String serverCertificate)
Generates a socket factory for the specified options.

If the client, private key, or server certificate file is a relative path (no leading '/'), it will be loaded from the MWS certificates directory as documented.

throws:
Exception On error initializing the SSL context or if the certificate(s) are invalid
Parameters:
clientCertificate - The client certificate file to use
clientCertAlias - The alias of the client certificate to use for socket communication, may be null to use the given certificate's alias
clientPrivateKey - The client private key file to use
clientKeyPassword - The password to decrypt the client certificate private key, may be null to use an unencrypted certificate
serverCertificate - The server certificate(s) or chain certificate to use (multiple certificates may be present in this file)
Returns:
An SSLSocketFactory instance that may be used in the communication library of choice


 

Groovy Documentation