java.lang.Object
org.apache.xml.security.keys.keyresolver.KeyResolverSpi
Direct Known Subclasses:
DEREncodedKeyValueResolver, DSAKeyValueResolver, ECKeyValueResolver, EncryptedKeyResolver, KeyInfoReferenceResolver, PrivateKeyResolver, RetrievalMethodResolver, RSAKeyValueResolver, SecretKeyResolver, SingleKeyResolver, X509CertificateResolver, X509DigestResolver, X509IssuerSerialResolver, X509SKIResolver, X509SubjectNameResolver

public abstract class KeyResolverSpi extends Object
This class is an abstract class to resolve a Key of some kind given a KeyInfo element. If you want the your KeyResolver, at firstly you must extend this class, and register as following in config.xml
  <KeyResolver URI="http://www.w3.org/2000/09/xmldsig#KeyValue"
   JAVACLASS="MyPackage.MyKeyValueImpl"//gt;
 
Extensions of this class must be thread-safe.
  • Constructor Details

    • KeyResolverSpi

      public KeyResolverSpi()
  • Method Details

    • engineCanResolve

      protected abstract boolean engineCanResolve(Element element, String baseURI, StorageResolver storage)
      This method returns whether the KeyResolverSpi is able to perform the requested action.
      Parameters:
      element -
      baseURI -
      storage -
      Returns:
      whether the KeyResolverSpi is able to perform the requested action.
    • engineResolvePublicKey

      protected abstract PublicKey engineResolvePublicKey(Element element, String baseURI, StorageResolver storage, boolean secureValidation) throws KeyResolverException
      Method engineResolvePublicKey
      Parameters:
      element -
      baseURI -
      storage -
      secureValidation -
      Returns:
      resolved public key from the registered from the element.
      Throws:
      KeyResolverException
    • engineLookupAndResolvePublicKey

      public PublicKey engineLookupAndResolvePublicKey(Element element, String baseURI, StorageResolver storage, boolean secureValidation) throws KeyResolverException
      Method engineLookupAndResolvePublicKey
      Parameters:
      element -
      baseURI -
      storage -
      secureValidation -
      Returns:
      resolved public key from the registered from the element.
      Throws:
      KeyResolverException
    • engineResolveX509Certificate

      protected abstract X509Certificate engineResolveX509Certificate(Element element, String baseURI, StorageResolver storage, boolean secureValidation) throws KeyResolverException
      Method engineResolveCertificate
      Parameters:
      element -
      baseURI -
      storage -
      secureValidation -
      Returns:
      resolved X509Certificate key from the registered from the elements
      Throws:
      KeyResolverException
    • engineLookupResolveX509Certificate

      public X509Certificate engineLookupResolveX509Certificate(Element element, String baseURI, StorageResolver storage, boolean secureValidation) throws KeyResolverException
      Method engineLookupResolveX509Certificate
      Parameters:
      element -
      baseURI -
      storage -
      secureValidation -
      Returns:
      resolved X509Certificate key from the registered from the elements
      Throws:
      KeyResolverException
    • engineResolveSecretKey

      protected abstract SecretKey engineResolveSecretKey(Element element, String baseURI, StorageResolver storage, boolean secureValidation) throws KeyResolverException
      Method engineResolveSecretKey
      Parameters:
      element -
      baseURI -
      storage -
      secureValidation -
      Returns:
      resolved SecretKey key from the registered from the elements
      Throws:
      KeyResolverException
    • engineLookupAndResolveSecretKey

      public SecretKey engineLookupAndResolveSecretKey(Element element, String baseURI, StorageResolver storage, boolean secureValidation) throws KeyResolverException
      Method engineLookupAndResolveSecretKey
      Parameters:
      element -
      baseURI -
      storage -
      secureValidation -
      Returns:
      resolved SecretKey key from the registered from the elements
      Throws:
      KeyResolverException
    • engineResolvePrivateKey

      protected abstract PrivateKey engineResolvePrivateKey(Element element, String baseURI, StorageResolver storage, boolean secureValidation) throws KeyResolverException
      Method engineResolvePrivateKey
      Parameters:
      element -
      baseURI -
      storage -
      secureValidation -
      Returns:
      resolved PrivateKey key from the registered from the elements
      Throws:
      KeyResolverException
    • engineLookupAndResolvePrivateKey

      public PrivateKey engineLookupAndResolvePrivateKey(Element element, String baseURI, StorageResolver storage, boolean secureValidation) throws KeyResolverException
      Method engineLookupAndResolvePrivateKey
      Parameters:
      element -
      baseURI -
      storage -
      secureValidation -
      Returns:
      resolved PrivateKey key from the registered from the elements
      Throws:
      KeyResolverException
    • getDocFromBytes

      protected static Element getDocFromBytes(byte[] bytes, boolean secureValidation) throws KeyResolverException
      Parses a byte array and returns the parsed Element.
      Parameters:
      bytes -
      Returns:
      the Document Element after parsing bytes
      Throws:
      KeyResolverException - if something goes wrong