SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

net.java.sip.communicator.service.gui
Interface CertificateVerificationService

All Known Implementing Classes:
CertificateVerificationServiceImpl

public interface CertificateVerificationService

A service which implementors will ask the user for permission for the certificates which are for some reason not valid and not globally trusted.

Author:
Damian Minkov

Field Summary
static String ALWAYS_TRUST_MODE_ENABLED_PROP_NAME
          Property for always trust mode.
static int DO_NOT_TRUST
          Result of user interaction.
static int TRUST_ALWAYS
          Result of user interaction.
static int TRUST_THIS_SESSION_ONLY
          Result of user interaction.
 
Method Summary
 SSLContext getSSLContext(String toHost, int toPort)
          Returns SSLContext instance initialized with the custom trust manager, which will try verify the certificate and if verification fails will query the user for acceptance.
 X509TrustManager getTrustManager(String toHost, int toPort)
          Obtain custom trust manager, which will try verify the certificate and if verification fails will query the user for acceptance.
 int verify(X509Certificate[] chain, String toHost, int toPort)
          Checks does the user trust the supplied chain of certificates, when connecting to the server and port.
 

Field Detail

ALWAYS_TRUST_MODE_ENABLED_PROP_NAME

static final String ALWAYS_TRUST_MODE_ENABLED_PROP_NAME
Property for always trust mode. When enabled certificate check is skipped.

See Also:
Constant Field Values

DO_NOT_TRUST

static final int DO_NOT_TRUST
Result of user interaction. User don't trust this certificate.

See Also:
Constant Field Values

TRUST_ALWAYS

static final int TRUST_ALWAYS
Result of user interaction. User will always trust this certificate.

See Also:
Constant Field Values

TRUST_THIS_SESSION_ONLY

static final int TRUST_THIS_SESSION_ONLY
Result of user interaction. User will trust this certificate only during current session.

See Also:
Constant Field Values
Method Detail

verify

int verify(X509Certificate[] chain,
           String toHost,
           int toPort)
Checks does the user trust the supplied chain of certificates, when connecting to the server and port. If needed shows dialog to confirm.

Parameters:
chain - the chain of the certificates to check with user.
toHost - the host we are connecting.
toPort - the port used when connecting.
Returns:
the result of user interaction on of DO_NOT_TRUST, TRUST_ALWAYS, TRUST_THIS_SESSION_ONLY.

getTrustManager

X509TrustManager getTrustManager(String toHost,
                                 int toPort)
                                 throws GeneralSecurityException
Obtain custom trust manager, which will try verify the certificate and if verification fails will query the user for acceptance.

Parameters:
toHost - the host we are connecting.
toPort - the port used when connecting.
Returns:
the custom trust manager.
Throws:
GeneralSecurityException - when there is problem creating the trust manager

getSSLContext

SSLContext getSSLContext(String toHost,
                         int toPort)
                         throws IOException
Returns SSLContext instance initialized with the custom trust manager, which will try verify the certificate and if verification fails will query the user for acceptance.

Parameters:
toHost - the host we are connecting.
toPort - the port used when connecting.
Returns:
the SSLContext
Throws:
IOException - throws exception when unable to initialize the ssl context.

SIP Communicator: the OpenSource Java VoIP and Instant Messaging client.

SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.