Class JweHeader


  • public class JweHeader
    extends JwtSecureHeader
    An implementation for the JWE Header parameters.
    Since:
    2.0.0
    • Constructor Detail

      • JweHeader

        public JweHeader()
        Constructs an new, empty JweHeader.
      • JweHeader

        public JweHeader​(Map<String,​Object> headerParameters)
        Constructs a new JweHeader with its parameters set to the contents of the given Map.
        Parameters:
        headerParameters - A Map containing the parameters to be set in the header.
    • Method Detail

      • getAlgorithm

        public JweAlgorithm getAlgorithm()
        Gets the Algorithm set in the JWT header.

        If there is no algorithm set in the JWT header, then the JweAlgorithm NONE will be returned.

        Specified by:
        getAlgorithm in class JwtHeader
        Returns:
        The Algorithm.
      • setEncryptionMethod

        public void setEncryptionMethod​(EncryptionMethod encryptionMethod)
        Sets the Encryption Method header parameter for this JWE.

        Identifies the block encryption algorithm used to encrypt the Plaintext to produce the Ciphertext.

        Parameters:
        encryptionMethod - The Encryption Method.
      • getEncryptionMethod

        public EncryptionMethod getEncryptionMethod()
        Gets the Encryption Method header parameter for this JWE.
        Returns:
        The Encryption Method.
      • setEphemeralPublicKey

        public void setEphemeralPublicKey​(JWK ephemeralPublicKey)
        Sets the Ephemeral Public Key header parameter for this JWE.

        For use in key agreement algorithms. When the Algorithm header parameter value specified identifies an algorithm for which "epk" is a parameter, this parameter MUST be present if REQUIRED by the algorithm.

        Parameters:
        ephemeralPublicKey - The Ephemeral Public Key.
      • getEphemeralPublicKey

        public JWK getEphemeralPublicKey()
        Gets the Ephemeral Public Key header parameter for this JWE.
        Returns:
        The Ephemeral Public Key.
      • setAgreementPartyUInfo

        public void setAgreementPartyUInfo​(String agreementPartyUInfo)
        Sets the Agreement PartyUInfo header parameter for this JWE.

        For use with key agreement algorithms (such as "ECDH-ES"), represented as a base64url encoded string.

        Parameters:
        agreementPartyUInfo - The Agreement PartyUInfo.
      • getAgreementPartyUInfo

        public String getAgreementPartyUInfo()
        Gets the Agreement PartyUInfo header parameter for this JWE.
        Returns:
        The Agreement PartyUInfo.
      • setAgreementPartyVInfo

        public void setAgreementPartyVInfo​(String agreementPartyVInfo)
        Sets the Agreement PartyVInfo header parameter for this JWE.

        For use with key agreement algorithms (such as "ECDH-ES"), represented as a base64url encoded string.

        Parameters:
        agreementPartyVInfo - The Agreement PartyVInfo.
      • getAgreementPartyVInfo

        public String getAgreementPartyVInfo()
        Gets the Agreement PartyVInfo header parameter for this JWE.
        Returns:
        The Agreement PartyVInfo.
      • setParameter

        public void setParameter​(String key,
                                 Object value)
        Description copied from class: JwtSecureHeader
        Sets a header parameter with the specified key and value.

        If the key matches one of the reserved header parameter names, then the relevant set method is called to set that header parameter with the specified value.

        Overrides:
        setParameter in class JwtSecureHeader
        Parameters:
        key - The key of the header parameter.
        value - The value of the header parameter.
      • getParameter

        public Object getParameter​(String key)
        Description copied from class: JwtSecureHeader
        Gets a header parameter for the specified key.

        If the key matches one of the reserved header parameter names, then the relevant get method is called to get that header parameter.

        Overrides:
        getParameter in class JwtSecureHeader
        Parameters:
        key - The header parameter key.
        Returns:
        The value stored against the header parameter key.