Class LegacyFullDeterministicAead

  • All Implemented Interfaces:
    DeterministicAead

    public class LegacyFullDeterministicAead
    extends java.lang.Object
    implements DeterministicAead
    Takes an arbitrary raw DeterministicAead and makes it a full primitive. This is a class that helps us transition onto the new Keys and Configurations interface, by bringing potential user-defined primitives to a common denominator with our primitives over which we have control.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static DeterministicAead create​(LegacyProtoKey key)
      Creates a DeterministicAead full primitive from user-defined deterministic aead / key classes.
      byte[] decryptDeterministically​(byte[] ciphertext, byte[] associatedData)
      Deterministically decrypts ciphertext with associatedData as associated authenticated data.
      byte[] encryptDeterministically​(byte[] plaintext, byte[] associatedData)
      Deterministically encrypts plaintext with associatedData as associated authenticated data.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • create

        public static DeterministicAead create​(LegacyProtoKey key)
                                        throws java.security.GeneralSecurityException
        Creates a DeterministicAead full primitive from user-defined deterministic aead / key classes.
        Throws:
        java.security.GeneralSecurityException
      • encryptDeterministically

        public byte[] encryptDeterministically​(byte[] plaintext,
                                               byte[] associatedData)
                                        throws java.security.GeneralSecurityException
        Description copied from interface: DeterministicAead
        Deterministically encrypts plaintext with associatedData as associated authenticated data.

        Warning

        Encrypting the same plaintext multiple times protects the integrity of that plaintext, but confidentiality is compromised to the extent that an attacker can determine that the same plaintext was encrypted.

        The resulting ciphertext allows for checking authenticity and integrity of associated data (associatedData), but does not guarantee its secrecy.

        Specified by:
        encryptDeterministically in interface DeterministicAead
        Returns:
        resulting ciphertext
        Throws:
        java.security.GeneralSecurityException
      • decryptDeterministically

        public byte[] decryptDeterministically​(byte[] ciphertext,
                                               byte[] associatedData)
                                        throws java.security.GeneralSecurityException
        Description copied from interface: DeterministicAead
        Deterministically decrypts ciphertext with associatedData as associated authenticated data.

        The decryption verifies the authenticity and integrity of the associated data, but there are no guarantees wrt. secrecy of that data.

        Specified by:
        decryptDeterministically in interface DeterministicAead
        Returns:
        resulting plaintext
        Throws:
        java.security.GeneralSecurityException