Interface HpkeAead


  • @Immutable
    public interface HpkeAead
    Interface for Hybrid Public Key Encryption (HPKE) authenticated encryption with associated data (AEAD).

    HPKE RFC is available at https://www.rfc-editor.org/rfc/rfc9180.html.

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      byte[] getAeadId()
      Returns the HPKE AEAD algorithm identifier for the underlying AEAD implementation.
      int getKeyLength()
      Returns key length (in bytes) for this algorithm (i.e., parameter 'Nk' in HPKE RFC).
      int getNonceLength()
      Returns nonce length (in bytes) for this algorithm (i.e., parameter 'Nn' in HPKE RFC).
      default byte[] open​(byte[] key, byte[] nonce, byte[] ciphertext, byte[] associatedData)
      Performs authenticated decryption of ciphertext and associatedData using key and nonce according to the HPKE AEAD specification.
      byte[] open​(byte[] key, byte[] nonce, byte[] ciphertext, int ciphertextOffset, byte[] associatedData)  
      default byte[] seal​(byte[] key, byte[] nonce, byte[] plaintext, byte[] associatedData)
      Performs authenticated encryption of plaintext and associatedData using key and nonce according to the HPKE AEAD specification.
      byte[] seal​(byte[] key, byte[] nonce, byte[] plaintext, int ciphertextOffset, byte[] associatedData)  
    • Method Detail

      • seal

        default byte[] seal​(byte[] key,
                            byte[] nonce,
                            byte[] plaintext,
                            byte[] associatedData)
                     throws java.security.GeneralSecurityException
        Performs authenticated encryption of plaintext and associatedData using key and nonce according to the HPKE AEAD specification.

        More details available at https://www.rfc-editor.org/rfc/rfc9180.html#name-encryption-and-decryption.

        Throws:
        java.security.GeneralSecurityException
      • seal

        byte[] seal​(byte[] key,
                    byte[] nonce,
                    byte[] plaintext,
                    int ciphertextOffset,
                    byte[] associatedData)
             throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException
      • open

        default byte[] open​(byte[] key,
                            byte[] nonce,
                            byte[] ciphertext,
                            byte[] associatedData)
                     throws java.security.GeneralSecurityException
        Performs authenticated decryption of ciphertext and associatedData using key and nonce according to the HPKE AEAD specification.

        More details available at https://www.rfc-editor.org/rfc/rfc9180.html#name-encryption-and-decryption.

        Throws:
        java.security.GeneralSecurityException
      • open

        byte[] open​(byte[] key,
                    byte[] nonce,
                    byte[] ciphertext,
                    int ciphertextOffset,
                    byte[] associatedData)
             throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException
      • getAeadId

        byte[] getAeadId()
                  throws java.security.GeneralSecurityException
        Returns the HPKE AEAD algorithm identifier for the underlying AEAD implementation.

        More details at https://www.rfc-editor.org/rfc/rfc9180.html#name-authenticated-encryption-wi.

        Throws:
        java.security.GeneralSecurityException
      • getKeyLength

        int getKeyLength()
        Returns key length (in bytes) for this algorithm (i.e., parameter 'Nk' in HPKE RFC).
      • getNonceLength

        int getNonceLength()
        Returns nonce length (in bytes) for this algorithm (i.e., parameter 'Nn' in HPKE RFC).