I would like to access the certificate details for the SecureContext/DerivedKey... however this info is not available in the RECV Results..
is there a way to access this info using the SCT identifier or
DerivedKeyID??
try {
Vector results = null;
if ((results = (Vector)
ctx.getProperty(WSHandlerConstants.RECV_RESULTS))
== null) {
throw new RuntimeException("No security
results!!");
} else {
for (int i = 0; i < results.size(); i++) {
//Get hold of the WSHandlerResult
instance
WSHandlerResult rResult =
(WSHandlerResult) results.get(i);
Vector wsSecEngineResults =
rResult.getResults();
for (int j = 0; j <
wsSecEngineResults.size(); j++) {
//Get hold of the
WSSecurityEngineResult instance
WSSecurityEngineResult wser =
(WSSecurityEngineResult)wsSecEngineResults.get(j);
if(wser.getAction()==WSConstants.TS) {
System.out.println("TS");
} else
if(wser.getAction()==WSConstants.SIGN) {
System.out.println("SIGN");
} else {
System.out.println(wser.getAction());
}
try {
WSDerivedKeyTokenPrincipal principal = (WSDerivedKeyTokenPrincipal)
wser.getPrincipal();
user =
principal.getName();
System.out.println(user);
} catch (Exception e) {
System.out.println("error");
}
X509Certificate certificate =
wser.getCertificate();
if (certificate != null) {
System.out.println(certificate.toString());
System.out.println("IssuerDN: " + certificate.getIssuerDN());
System.out.println("SubjectDN: " +certificate.getSubjectDN());
System.out.println("SerialNumber: " + certificate.getSerialNumber());
} else {
System.out.println("cert is null");
}
SecurityContextToken sct =
wser.getSecurityContextToken();
if (sct != null) {
SimpleTokenStore
tokenStore = new SimpleTokenStore();
Token
tok=tokenStore.getToken(sct.getID());
//tokenStore.getToken(sct.getIdentifier());
System.out.println(sct.getIdentifier());
if (tok!=null) {
System.out.println(tok.getIssuerAddress());
}else {
System.out.println("tok is null");
}
} else {
System.out.println("sct
is null");
}
}
}
}
} catch (Exception e) {
System.out.println(e.getMessage());
}
--
View this message in context:
http://www.nabble.com/Access-Certificate-details-when-using-SecureConv-tp16396510p16396510.html
Sent from the Axis - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
