Module org.apache.santuario.xmlsec
Class KeyInfoReferenceResolver
- java.lang.Object
-
- org.apache.xml.security.keys.keyresolver.KeyResolverSpi
-
- org.apache.xml.security.keys.keyresolver.implementations.KeyInfoReferenceResolver
-
public class KeyInfoReferenceResolver extends KeyResolverSpi
KeyResolverSpi implementation which resolves public keys, private keys, secret keys, and X.509 certificates from adsig11:KeyInfoReferenceelement.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.System.LoggerLOG
-
Constructor Summary
Constructors Constructor Description KeyInfoReferenceResolver()
-
Method Summary
All 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.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 engineResolvePublicKeyprotected javax.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 org.w3c.dom.ElementobtainReferenceElement(XMLSignatureInput resource, boolean secureValidation)Resolve the Element effectively represented by the XML signature input source.private XMLSignatureInputresolveInput(org.w3c.dom.Attr uri, java.lang.String baseURI, boolean secureValidation)Resolve the XML signature input represented by the specified URI.private KeyInforesolveReferentKeyInfo(org.w3c.dom.Element element, java.lang.String baseURI, StorageResolver storage, boolean secureValidation)Resolve the KeyInfoReference Element's URI attribute into a KeyInfo instance.private voidvalidateReference(org.w3c.dom.Element referentElement, boolean secureValidation)Validate the Element referred to by the KeyInfoReference.-
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) throws KeyResolverExceptionMethod engineResolvePublicKey- Specified by:
engineResolvePublicKeyin classKeyResolverSpi- Returns:
- resolved public key from the registered from the element.
- Throws:
KeyResolverException
-
engineResolveX509Certificate
protected java.security.cert.X509Certificate engineResolveX509Certificate(org.w3c.dom.Element element, java.lang.String baseURI, StorageResolver storage, boolean secureValidation) throws KeyResolverExceptionMethod engineResolveCertificate- Specified by:
engineResolveX509Certificatein classKeyResolverSpi- Returns:
- resolved X509Certificate key from the registered from the elements
- Throws:
KeyResolverException
-
engineResolveSecretKey
protected javax.crypto.SecretKey engineResolveSecretKey(org.w3c.dom.Element element, java.lang.String baseURI, StorageResolver storage, boolean secureValidation) throws KeyResolverExceptionMethod engineResolveSecretKey- Specified by:
engineResolveSecretKeyin classKeyResolverSpi- Returns:
- resolved SecretKey key from the registered from the elements
- Throws:
KeyResolverException
-
engineResolvePrivateKey
public java.security.PrivateKey engineResolvePrivateKey(org.w3c.dom.Element element, java.lang.String baseURI, StorageResolver storage, boolean secureValidation) throws KeyResolverExceptionMethod engineResolvePrivateKey- Specified by:
engineResolvePrivateKeyin classKeyResolverSpi- Returns:
- resolved PrivateKey key from the registered from the elements
- Throws:
KeyResolverException
-
resolveReferentKeyInfo
private KeyInfo resolveReferentKeyInfo(org.w3c.dom.Element element, java.lang.String baseURI, StorageResolver storage, boolean secureValidation) throws XMLSecurityException
Resolve the KeyInfoReference Element's URI attribute into a KeyInfo instance.- Parameters:
element-baseURI-storage-secureValidation-- Returns:
- the KeyInfo which is referred to by this KeyInfoReference, or null if can not be resolved
- Throws:
XMLSecurityException
-
validateReference
private void validateReference(org.w3c.dom.Element referentElement, boolean secureValidation) throws XMLSecurityExceptionValidate the Element referred to by the KeyInfoReference.- Parameters:
referentElement-secureValidation-- Throws:
XMLSecurityException
-
resolveInput
private XMLSignatureInput resolveInput(org.w3c.dom.Attr uri, java.lang.String baseURI, boolean secureValidation) throws XMLSecurityException
Resolve the XML signature input represented by the specified URI.- Parameters:
uri-baseURI-secureValidation-- Returns:
- the XML signature input represented by the specified URI.
- Throws:
XMLSecurityException
-
obtainReferenceElement
private org.w3c.dom.Element obtainReferenceElement(XMLSignatureInput resource, boolean secureValidation) throws CanonicalizationException, javax.xml.parsers.ParserConfigurationException, java.io.IOException, org.xml.sax.SAXException, KeyResolverException
Resolve the Element effectively represented by the XML signature input source.- Parameters:
resource-secureValidation-- Returns:
- the Element effectively represented by the XML signature input source.
- Throws:
CanonicalizationExceptionjavax.xml.parsers.ParserConfigurationExceptionjava.io.IOExceptionorg.xml.sax.SAXExceptionKeyResolverException
-
-