Module org.apache.santuario.xmlsec
Class RetrievalMethodResolver
- java.lang.Object
-
- org.apache.xml.security.keys.keyresolver.KeyResolverSpi
-
- org.apache.xml.security.keys.keyresolver.implementations.RetrievalMethodResolver
-
public class RetrievalMethodResolver extends KeyResolverSpi
The RetrievalMethodResolver can retrieve public keys and certificates from other locations. The location is specified using the ds:RetrievalMethod element which points to the location. This includes the handling of raw (binary) X.509 certificate which are not encapsulated in an XML structure. If the retrieval process encounters an element which the RetrievalMethodResolver cannot handle itself, resolving of the extracted element is delegated back to the KeyResolver mechanism.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.System.LoggerLOG
-
Constructor Summary
Constructors Constructor Description RetrievalMethodResolver()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanengineCanResolve(org.w3c.dom.Element element, java.lang.String baseURI, StorageResolver storage)This method returns whether the KeyResolverSpi is able to perform the requested action.protected java.security.PrivateKeyengineResolvePrivateKey(org.w3c.dom.Element element, java.lang.String baseURI, StorageResolver storage, boolean secureValidation)Method engineResolvePrivateKeyprotected java.security.PublicKeyengineResolvePublicKey(org.w3c.dom.Element element, java.lang.String baseURI, StorageResolver storage, boolean secureValidation)Method engineResolvePublicKeyjavax.crypto.SecretKeyengineResolveSecretKey(org.w3c.dom.Element element, java.lang.String baseURI, StorageResolver storage, boolean secureValidation)Method engineResolveSecretKeyprotected java.security.cert.X509CertificateengineResolveX509Certificate(org.w3c.dom.Element element, java.lang.String baseURI, StorageResolver storage, boolean secureValidation)Method engineResolveCertificateprivate static org.w3c.dom.ElementgetDocumentElement(java.util.Set<org.w3c.dom.Node> set)private static java.security.cert.X509CertificategetRawCertificate(XMLSignatureInput resource)private static org.w3c.dom.ElementobtainReferenceElement(XMLSignatureInput resource, boolean secureValidation)private static java.security.cert.X509CertificateresolveCertificate(org.w3c.dom.Element e, java.lang.String baseURI, StorageResolver storage, boolean secureValidation)Retrieves a x509Certificate from the given informationprivate static XMLSignatureInputresolveInput(RetrievalMethod rm, java.lang.String baseURI, boolean secureValidation)Resolves the input from the given retrieval methodprivate static java.security.PublicKeyresolveKey(org.w3c.dom.Element e, java.lang.String baseURI, StorageResolver storage, boolean secureValidation)Retrieves a PublicKey from the given information-
Methods inherited from class org.apache.xml.security.keys.keyresolver.KeyResolverSpi
engineLookupAndResolvePrivateKey, engineLookupAndResolvePublicKey, engineLookupAndResolveSecretKey, engineLookupResolveX509Certificate, getDocFromBytes
-
-
-
-
Method Detail
-
engineCanResolve
protected boolean engineCanResolve(org.w3c.dom.Element element, java.lang.String baseURI, StorageResolver storage)This method returns whether the KeyResolverSpi is able to perform the requested action.- Specified by:
engineCanResolvein classKeyResolverSpi- Returns:
- whether the KeyResolverSpi is able to perform the requested action.
-
engineResolvePublicKey
protected java.security.PublicKey engineResolvePublicKey(org.w3c.dom.Element element, java.lang.String baseURI, StorageResolver storage, boolean secureValidation)Method engineResolvePublicKey- Specified by:
engineResolvePublicKeyin classKeyResolverSpi- Returns:
- resolved public key from the registered from the element.
-
engineResolveX509Certificate
protected java.security.cert.X509Certificate engineResolveX509Certificate(org.w3c.dom.Element element, java.lang.String baseURI, StorageResolver storage, boolean secureValidation)Method engineResolveCertificate- Specified by:
engineResolveX509Certificatein classKeyResolverSpi- Returns:
- resolved X509Certificate key from the registered from the elements
-
resolveCertificate
private static java.security.cert.X509Certificate resolveCertificate(org.w3c.dom.Element e, java.lang.String baseURI, StorageResolver storage, boolean secureValidation) throws KeyResolverExceptionRetrieves a x509Certificate from the given information- Parameters:
e-baseURI-storage-- Returns:
- a x509Certificate from the given information
- Throws:
KeyResolverException
-
resolveKey
private static java.security.PublicKey resolveKey(org.w3c.dom.Element e, java.lang.String baseURI, StorageResolver storage, boolean secureValidation) throws KeyResolverExceptionRetrieves a PublicKey from the given information- Parameters:
e-baseURI-storage-secureValidation-- Returns:
- a PublicKey from the given information
- Throws:
KeyResolverException
-
obtainReferenceElement
private static org.w3c.dom.Element obtainReferenceElement(XMLSignatureInput resource, boolean secureValidation) throws CanonicalizationException, XMLParserException, java.io.IOException, KeyResolverException
- Throws:
CanonicalizationExceptionXMLParserExceptionjava.io.IOExceptionKeyResolverException
-
getRawCertificate
private static java.security.cert.X509Certificate getRawCertificate(XMLSignatureInput resource) throws CanonicalizationException, java.io.IOException, java.security.cert.CertificateException
- Throws:
CanonicalizationExceptionjava.io.IOExceptionjava.security.cert.CertificateException
-
resolveInput
private static XMLSignatureInput resolveInput(RetrievalMethod rm, java.lang.String baseURI, boolean secureValidation) throws XMLSecurityException
Resolves the input from the given retrieval method- Returns:
- the input from the given retrieval method
- Throws:
XMLSecurityException
-
engineResolveSecretKey
public javax.crypto.SecretKey engineResolveSecretKey(org.w3c.dom.Element element, java.lang.String baseURI, StorageResolver storage, boolean secureValidation)Method engineResolveSecretKey- Specified by:
engineResolveSecretKeyin classKeyResolverSpi- Returns:
- resolved SecretKey key from the registered from the elements
-
engineResolvePrivateKey
protected java.security.PrivateKey engineResolvePrivateKey(org.w3c.dom.Element element, java.lang.String baseURI, StorageResolver storage, boolean secureValidation)Method engineResolvePrivateKey- Specified by:
engineResolvePrivateKeyin classKeyResolverSpi- Returns:
- resolved PrivateKey key from the registered from the elements
-
getDocumentElement
private static org.w3c.dom.Element getDocumentElement(java.util.Set<org.w3c.dom.Node> set)
-
-