|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.fhg.igd.semoa.net.SSLTrustManager
SSLTrustManager implements the X509TrustManager class from java ssl package.
This is unavoidable in order to redirect the certificate verification by
the KeyMaster
class.
Keep in mind, that logging to System.out or System.err is not possible
within callback methods, because data would be transfered over SSL stream!
Field Summary | |
private Set |
acceptedSubjects_
A certificate, which has successfully been verified, will be accepted by checkClientTrusted
resp. |
static String |
AUTH_TYPE
The variable AUTH_TYPE determine authentication type used in SSL process. |
protected int |
flag_
The flag identifying the type of trust checks which are made when checkClientTrusted or checkClientTrusted
is called. |
private String |
id_
The id used to identify error messages. |
static int |
ISSUER_TRUST_CHECK
When checkClientTrusted or checkServerTrusted
is called, the given certificate chain is verified and the root CA
certificate is validated against the trusted certificates of the
KeyMaster . |
private KeyMaster |
keymaster_
The KeyMaster . |
private long |
lastFetch_
The time at which the key master reference was fetched last. |
private Object |
lock_
A private lock object to synchronize on. |
private static Logger |
log_
The Logger instance for this class |
static int |
NO_TRUST_CHECK
No trust check is done at all, when checkClientTrusted
or checkServerTrusted is called. |
static int |
SUBJECT_TRUST_CHECK
In addition to the checks made when flag_ is
ISSUER_TRUST_CHECK , the subject DN of the given
certificate is compared against a given set of
acceptedSubjects_ . |
Constructor Summary | |
SSLTrustManager()
Default constructor. |
|
SSLTrustManager(String id,
int flag)
Constructor to create a class instance initiated with the given logging identifier and trust management flag. |
|
SSLTrustManager(String id,
Principal[] acceptedSubjects)
Constructor to create a class instance initiated with the given loggin identifier and set of subjects to accept during trust checks. |
Method Summary | |
void |
checkClientTrusted(X509Certificate[] chain,
String authType)
This Method implements checkClientTrusted() method from
X509TrustManager . |
void |
checkServerTrusted(X509Certificate[] chain,
String authType)
This Method implements checkServerTrusted() method from
X509TrustManager . |
protected void |
checkTrusted(X509Certificate[] chain,
String authType)
This Method implements checkServerTrusted() method from
X509TrustManager . |
X509Certificate[] |
getAcceptedIssuers()
Returns a chain of trusted X509Certificates from
the Keymaster. |
Principal[] |
getAcceptedSubjects()
Returns trusted certificate subjects DN as restriction in addition to the accepted issuers list. |
private KeyMaster |
getKeyMaster()
Returns a reference to the key master. |
int |
getTrustManagementType()
Returns the type of trust manangement checks made. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static Logger log_
Logger
instance for this class
public static final int NO_TRUST_CHECK
checkClientTrusted
or checkServerTrusted
is called. Neither the given
certificate chain is verified.
public static final int ISSUER_TRUST_CHECK
checkClientTrusted
or checkServerTrusted
is called, the given certificate chain is verified and the root CA
certificate is validated against the trusted certificates of the
KeyMaster
.
public static final int SUBJECT_TRUST_CHECK
flag_
is
ISSUER_TRUST_CHECK
, the subject DN of the given
certificate is compared against a given set of
acceptedSubjects_
.
public static final String AUTH_TYPE
private Object lock_
private KeyMaster keymaster_
KeyMaster
.
private Set acceptedSubjects_
checkClientTrusted
resp. checkClientTrusted
,
iff this set is null
, or the
corresponding subject DN is element of this set.
private long lastFetch_
private String id_
protected int flag_
checkClientTrusted
or checkClientTrusted
is called.
Constructor Detail |
public SSLTrustManager()
SSLMasterImpl.DEFAULT_ID
and ISSUER_TRUST_CHECK
are used for the
created class instance.
public SSLTrustManager(String id, int flag)
NO_TRUST_CHECK
,
ISSUER_TRUST_CHECK
.
id
- logging identifier.flag
- trust management flag.public SSLTrustManager(String id, Principal[] acceptedSubjects)
SUBJECT_TRUST_CHECK
.
id
- logging indentifier.acceptedSubjects
- the subject DNs to accept during trust checks.Method Detail |
private KeyMaster getKeyMaster()
KeyMaster
.public int getTrustManagementType()
public Principal[] getAcceptedSubjects()
null
,
if there is no restriction according to the certificates subject DN.public X509Certificate[] getAcceptedIssuers()
X509Certificates
from
the Keymaster. It implements getAcceptedIssuers()
from
X509TrustManager
.
getAcceptedIssuers
in interface X509TrustManager
X509Certificate
.public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException
checkClientTrusted()
method from
X509TrustManager
. To verify the client certificate
chain the checkServerTrusted
method is called.
checkClientTrusted
in interface X509TrustManager
chain
- X509Certificate
chain to be verified.authType
- authorisation type
CertificateException
- if the certificate chain is not
trusted by this TrustManagerpublic void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException
checkServerTrusted()
method from
X509TrustManager
. To verify the server certificate
chain the KeyMaster is used.
checkServerTrusted
in interface X509TrustManager
chain
- X509Certificate
chain to be verified.
CertificateException
- if the certificate chain is not
trusted by this TrustManagerprotected void checkTrusted(X509Certificate[] chain, String authType) throws CertificateException
checkServerTrusted()
method from
X509TrustManager
. To verify the server certificate
chain and validate root CA issuer the KeyMaster is used.
chain
- X509Certificate
chain to be verified.
CertificateException
- if the certificate chain is not
trusted by this TrustManager
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |