X509IssuerSerialResolverpublic class X509IssuerSerialResolver extends KeyResolverSpi
Fields Summary |
---|
static Logger | log{@link java.util.logging} logging facility |
Methods Summary |
---|
public boolean | engineCanResolve(org.w3c.dom.Element element, java.lang.String BaseURI, com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver storage)
if (true)
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Can I resolve " + element.getTagName() + "?");
X509Data x509data = null;
try {
x509data = new X509Data(element, BaseURI);
} catch (XMLSignatureException ex) {
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "I can't");
return false;
} catch (XMLSecurityException ex) {
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "I can't");
return false;
}
if (x509data == null) {
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "I can't");
return false;
}
if (x509data.containsIssuerSerial()) {
return true;
}
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "I can't");
return false;
| public java.security.PublicKey | engineResolvePublicKey(org.w3c.dom.Element element, java.lang.String BaseURI, com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver storage)
X509Certificate cert = this.engineResolveX509Certificate(element,
BaseURI, storage);
if (cert != null) {
return cert.getPublicKey();
}
return null;
| public javax.crypto.SecretKey | engineResolveSecretKey(org.w3c.dom.Element element, java.lang.String BaseURI, com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver storage)
return null;
| public java.security.cert.X509Certificate | engineResolveX509Certificate(org.w3c.dom.Element element, java.lang.String BaseURI, com.sun.org.apache.xml.internal.security.keys.storage.StorageResolver storage)
try {
if (storage == null) {
Object exArgs[] = { Constants._TAG_X509ISSUERSERIAL };
KeyResolverException ex =
new KeyResolverException("KeyResolver.needStorageResolver",
exArgs);
if (log.isLoggable(java.util.logging.Level.INFO)) log.log(java.util.logging.Level.INFO, "", ex);
throw ex;
}
X509Data x509data = new X509Data(element, BaseURI);
int noOfISS = x509data.lengthIssuerSerial();
while (storage.hasNext()) {
X509Certificate cert = storage.next();
XMLX509IssuerSerial certSerial = new XMLX509IssuerSerial(element.getOwnerDocument(), cert);
if (true) {
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Found Certificate Issuer: "
+ certSerial.getIssuerName());
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Found Certificate Serial: "
+ certSerial.getSerialNumber().toString());
}
for (int i=0; i<noOfISS; i++) {
XMLX509IssuerSerial xmliss = x509data.itemIssuerSerial(i);
if (true) {
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Found Element Issuer: "
+ xmliss.getIssuerName());
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "Found Element Serial: "
+ xmliss.getSerialNumber().toString());
}
if (certSerial.equals(xmliss)) {
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "match !!! ");
return cert;
}
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "no match...");
}
}
return null;
} catch (XMLSecurityException ex) {
if (log.isLoggable(java.util.logging.Level.FINE)) log.log(java.util.logging.Level.FINE, "XMLSecurityException", ex);
throw new KeyResolverException("generic.EmptyMessage", ex);
}
|
|