Interface JWACipher

All Superinterfaces:
JWA

public interface JWACipher extends JWA

A JWA cipher is used to encrypt and decrypt content.

Since:
1.5
Author:
Jeremy Kuhn
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    An encrypted data composed of the initialization vector, the authentication tag and the cipher text.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    decrypt(byte[] cipherText, byte[] aad, byte[] iv, byte[] tag)
    Decrypts the specified cypher text.
    encrypt(byte[] data, byte[] aad)
    Encrypts the specified data using a default SecureRandom.
    encrypt(byte[] data, byte[] aad, SecureRandom secureRandom)
    Encrypts the specified data using the specified SecureRandom.

    Methods inherited from interface io.inverno.mod.security.jose.jwa.JWA

    getProcessedParameters
  • Method Details

    • encrypt

      default JWACipher.EncryptedData encrypt(byte[] data, byte[] aad) throws JWACipherException

      Encrypts the specified data using a default SecureRandom.

      Parameters:
      data - the data to encrypt
      aad - additional authentication data
      Returns:
      encrypted data
      Throws:
      JWACipherException - if there was an error encrypting the data
    • encrypt

      JWACipher.EncryptedData encrypt(byte[] data, byte[] aad, SecureRandom secureRandom) throws JWACipherException

      Encrypts the specified data using the specified SecureRandom.

      Parameters:
      data - the data to encrypt
      aad - additional authentication data
      secureRandom - a secure random
      Returns:
      encrypted data
      Throws:
      JWACipherException - if there was an error encrypting the data
    • decrypt

      byte[] decrypt(byte[] cipherText, byte[] aad, byte[] iv, byte[] tag) throws JWACipherException

      Decrypts the specified cypher text.

      Parameters:
      cipherText - the cipher text to decrypt
      aad - the additional authentication data
      iv - the initilization vector
      tag - the authentication tag
      Returns:
      decrypted data
      Throws:
      JWACipherException - if there was an error decrypting the data