Class JwtHeader


  • public class JwtHeader
    extends JwtClaimSet
    Version:
    September 30, 2021
    Author:
    Javier Rojas Blum
    • Constructor Detail

      • JwtHeader

        public JwtHeader()
      • JwtHeader

        public JwtHeader​(org.json.JSONObject jsonObject)
    • Method Detail

      • instance

        public static JwtHeader instance()
      • setType

        public JwtHeader setType​(JwtType type)
        Declares the type of this object.
        Parameters:
        type - The type of this object.
      • getType

        public JwtType getType()
      • setAlgorithm

        public JwtHeader setAlgorithm​(SignatureAlgorithm algorithm)
        Identifies the cryptographic algorithm used to secure the JWS.
        Parameters:
        algorithm - The cryptographic algorithm.
      • setAlgorithm

        public JwtHeader setAlgorithm​(KeyEncryptionAlgorithm algorithm)
        Identifies the cryptographic algorithm used to encrypt the JWE.
        Parameters:
        algorithm - The cryptographic algorithm.
      • getKeyId

        public java.lang.String getKeyId()
      • setKeyId

        public JwtHeader setKeyId​(java.lang.String keyId)
        Indicates which key was used to secure/encrypt the JWS/JWE.
        Parameters:
        keyId - The key id.
      • getJwk

        public org.json.JSONObject getJwk()
      • setJwk

        public JwtHeader setJwk​(org.json.JSONObject jwk)
      • setContentType

        public void setContentType​(JwtType contentType)
        In a JWS it is used to declare the type of the secured content (the Payload). In a JWE it is used to declare the type of the encrypted content (the Plaintext).
        Parameters:
        contentType - The content type.
      • getContentType

        public JwtType getContentType()
      • setEncryptionMethod

        public void setEncryptionMethod​(BlockEncryptionAlgorithm encryptionMethod)
        Identifies the block encryption algorithm used to encrypt the Plaintext to produce the Cipher Text.
        Parameters:
        encryptionMethod - The JWE Encryption Method
      • setEphemeralPublicKey

        public void setEphemeralPublicKey​(java.lang.String ephemeralPublicKey)
        Value created by the originator for the use in key agreement algorithms.
        Parameters:
        ephemeralPublicKey - The Ephemeral Public Key.
      • setCompressionAlgorithm

        public void setCompressionAlgorithm​(java.lang.String compressionAlgorithm)
        The "zip" (compression algorithm) applied to the Plaintext before encryption, if any. If present, the value of the "zip" header parameter MUST be the case sensitive string "DEF". Compression is performed with the DEFLATE algorithm.
        Parameters:
        compressionAlgorithm - The compression algorithm.
      • setAgreementPartyUInfo

        public void setAgreementPartyUInfo​(java.lang.String agreementPartyUInfo)
        The "apu" (agreement PartyUInfo) value for key agreement algorithms using it (such as "ECDH-ES"), represented as a base64url encoded string.
        Parameters:
        agreementPartyUInfo - The Agreement PartyUInfo.
      • setAgreementPartyVInfo

        public void setAgreementPartyVInfo​(java.lang.String agreementPartyVInfo)
        The "apv" (agreement PartyVInfo) value for key agreement algorithms using it (such as "ECDH-ES"), represented as a base64url encoded string.
        Parameters:
        agreementPartyVInfo - The Agreement PartyVInfo.
      • setEncryptionPartyUInfo

        public void setEncryptionPartyUInfo​(java.lang.String encryptionPartyUInfo)
        The "epu" (encryption PartyUInfo) value for plaintext encryption algorithms using it (such as "A128CBC+HS256"), represented as a base64url encoded string.
        Parameters:
        encryptionPartyUInfo - The Encryption PartyUInfo.
      • setEncryptionPartyVInfo

        public void setEncryptionPartyVInfo​(java.lang.String encryptionPartyVInfo)
        The "epv" (encryption PartyVInfo) value for plaintext encryption algorithms using it (such as "A128CBC+HS256"), represented as a base64url encoded string.
        Parameters:
        encryptionPartyVInfo - The Encryption PartyVInfo.