Class JWEDecryptionKeySelector<C extends SecurityContext>

    • Constructor Detail

      • JWEDecryptionKeySelector

        public JWEDecryptionKeySelector​(JWEAlgorithm jweAlg,
                                        EncryptionMethod jweEnc,
                                        JWKSource<C> jwkSource)
        Creates a new decryption key selector.
        Parameters:
        jweAlg - The expected JWE algorithm for the objects to be decrypted. Must not be null.
        jweEnc - The expected JWE encryption method for the objects to be decrypted. Must not be null.
        jwkSource - The JWK source. Must include the private keys and must not be null.
    • Method Detail

      • getExpectedJWEAlgorithm

        public JWEAlgorithm getExpectedJWEAlgorithm()
        Returns the expected JWE algorithm.
        Returns:
        The expected JWE algorithm.
      • getExpectedJWEEncryptionMethod

        public EncryptionMethod getExpectedJWEEncryptionMethod()
        The expected JWE encryption method.
        Returns:
        The expected JWE encryption method.
      • createJWKMatcher

        protected JWKMatcher createJWKMatcher​(JWEHeader jweHeader)
        Creates a JWK matcher for the expected JWE algorithms and the specified JWE header.
        Parameters:
        jweHeader - The JWE header. Must not be null.
        Returns:
        The JWK matcher, null if none could be created.
      • selectJWEKeys

        public java.util.List<java.security.Key> selectJWEKeys​(JWEHeader jweHeader,
                                                               C context)
                                                        throws KeySourceException
        Description copied from interface: JWEKeySelector
        Selects key candidates for decrypting a JWE object.
        Specified by:
        selectJWEKeys in interface JWEKeySelector<C extends SecurityContext>
        Parameters:
        jweHeader - The header of the JWE object. Must not be null.
        context - Optional context of the JWE object, null if not required.
        Returns:
        The key candidates in trial order, empty list if none.
        Throws:
        KeySourceException - If a key source exception is encountered, e.g. on remote JWK retrieval.
      • getJWKSource

        public JWKSource<C> getJWKSource()
        Returns the JWK source.
        Returns:
        The JWK source.