net.java.sip.communicator.impl.gui.main.login
Class CertificateVerificationServiceImpl
java.lang.Object
net.java.sip.communicator.impl.gui.main.login.CertificateVerificationServiceImpl
- All Implemented Interfaces:
- CertificateVerificationService
public class CertificateVerificationServiceImpl
- extends Object
- implements CertificateVerificationService
Asks the user for permission for the
certificates which are for some reason not valid and not globally trusted.
- Author:
- Damian Minkov
|
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. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
CertificateVerificationServiceImpl
public CertificateVerificationServiceImpl()
verify
public 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.
- Specified by:
verify in interface CertificateVerificationService
- 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
public 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.
- Specified by:
getTrustManager in interface CertificateVerificationService
- 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
public 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.
- Specified by:
getSSLContext in interface CertificateVerificationService
- Parameters:
toHost - the host we are connecting.toPort - the port used when connecting.
- Returns:
- SSL context object
- Throws:
IOException - throws exception when unable to initialize the
ssl context.
SIP Communicator, the OpenSource Java VoIP and Instant Messaging client.
Distributable under LGPL license.