public X509Certificate engineResolveX509Certificate(
Element element, String BaseURI, StorageResolver storage)
throws KeyResolverException {
try {
RetrievalMethod rm = new RetrievalMethod(element, BaseURI);
Attr uri = rm.getURIAttr();
Transforms transforms = rm.getTransforms();
log.debug("Asked to resolve URI " + uri);
ResourceResolver resRes = ResourceResolver.getInstance(uri, BaseURI);
if (resRes != null) {
XMLSignatureInput resource = resRes.resolve(uri, BaseURI);
log.debug("Before applying Transforms, resource has "
+ resource.getBytes().length + "bytes");
if (transforms != null) {
log.debug("We have Transforms");
resource = transforms.performTransforms(resource);
}
log.debug("After applying Transforms, resource has "
+ resource.getBytes().length + "bytes");
log.debug("Resolved to resource " + resource.getSourceURI());
byte inputBytes[] = resource.getBytes();
if ((rm.getType() != null)
&& rm.getType().equals(RetrievalMethod.TYPE_RAWX509)) {
// if the resource stores a raw certificate, we have to handle it
CertificateFactory certFact =
CertificateFactory
.getInstance(XMLX509Certificate.JCA_CERT_ID);