Class EncryptionManager


  • public class EncryptionManager
    extends Object
    A service to get the appropriate EncryptionHandler for a specified Java Cryptographic encryption algorithm.

    For details of all supported algorithms see JweAlgorithm and for all supported encryption methods see EncryptionMethod

    Since:
    2.0.0
    • Constructor Detail

      • EncryptionManager

        public EncryptionManager()
    • Method Detail

      • getEncryptionHandler

        public EncryptionHandler getEncryptionHandler​(JweHeader header)
        Gets the appropriate EncryptionHandler that can perform the required encryption algorithm, as described by the JweAlgorithm and EncryptionMethod in the given JweHeader.
        Parameters:
        header - The JweHeader containing the JweAlgorithm and EncryptionMethod to get the EncryptionHandler for.
        Returns:
        The EncryptionHandler.
      • getEncryptionHandler

        public EncryptionHandler getEncryptionHandler​(JweHeader header,
                                                      Key key)
        Gets the appropriate EncryptionHandler that can perform the required encryption algorithm, as described by the JweAlgorithm and EncryptionMethod in the given JweHeader. If non-null, the key parameter will be used to select an appropriate implementation.
        Parameters:
        header - The JweHeader containing the JweAlgorithm and EncryptionMethod to get the EncryptionHandler for.
        key - The encryption key. May be null.
        Returns:
        The EncryptionHandler.