Class EncryptedKeyResolver


  • public class EncryptedKeyResolver
    extends KeyResolverSpi
    The EncryptedKeyResolver is not a generic resolver. It can only be for specific instantiations, as the key being unwrapped will always be of a particular type and will always have been wrapped by another key which needs to be recursively resolved. The EncryptedKeyResolver can therefore only be instantiated with an algorithm. It can also be instantiated with a key (the KEK) or will search the static KeyResolvers to find the appropriate key.
    • Field Detail

      • LOG

        private static final java.lang.System.Logger LOG
      • kek

        private final java.security.Key kek
      • algorithm

        private final java.lang.String algorithm
      • internalKeyResolvers

        private final java.util.List<KeyResolverSpi> internalKeyResolvers
    • Constructor Detail

      • EncryptedKeyResolver

        public EncryptedKeyResolver​(java.lang.String algorithm,
                                    java.util.List<KeyResolverSpi> internalKeyResolvers)
        Constructor for use when a KEK needs to be derived from a KeyInfo list
        Parameters:
        algorithm -
        internalKeyResolvers -
      • EncryptedKeyResolver

        public EncryptedKeyResolver​(java.lang.String algorithm,
                                    java.security.Key kek,
                                    java.util.List<KeyResolverSpi> internalKeyResolvers)
        Constructor used for when a KEK has been set
        Parameters:
        algorithm -
        kek -
        internalKeyResolvers -
    • 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:
        engineCanResolve in class KeyResolverSpi
        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:
        engineResolvePublicKey in class KeyResolverSpi
        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:
        engineResolveX509Certificate in class KeyResolverSpi
        Returns:
        resolved X509Certificate key from the registered from the elements
      • engineResolveSecretKey

        protected javax.crypto.SecretKey engineResolveSecretKey​(org.w3c.dom.Element element,
                                                                java.lang.String baseURI,
                                                                StorageResolver storage,
                                                                boolean secureValidation)
        Method engineResolveSecretKey
        Specified by:
        engineResolveSecretKey in class KeyResolverSpi
        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:
        engineResolvePrivateKey in class KeyResolverSpi
        Returns:
        resolved PrivateKey key from the registered from the elements