Interface StreamSegmentDecrypter


  • public interface StreamSegmentDecrypter
    StreamSegmentDecrypter is a helper class that decrypts individual segments of a stream.

    Instances of this interfaces are passed to StreamingAeadDecryptingChannel. Each instance must be initialized with the header of the ciphertext.

    Since:
    1.1.0
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void decryptSegment​(java.nio.ByteBuffer ciphertext, int segmentNr, boolean isLastSegment, java.nio.ByteBuffer plaintext)
      Decrypts a ciphetext segment.
      void init​(java.nio.ByteBuffer header, byte[] aad)  
    • Method Detail

      • init

        void init​(java.nio.ByteBuffer header,
                  byte[] aad)
           throws java.security.GeneralSecurityException
        Throws:
        java.security.GeneralSecurityException
      • decryptSegment

        void decryptSegment​(java.nio.ByteBuffer ciphertext,
                            int segmentNr,
                            boolean isLastSegment,
                            java.nio.ByteBuffer plaintext)
                     throws java.security.GeneralSecurityException
        Decrypts a ciphetext segment.
        Parameters:
        segmentNr - the number of the segment
        isLastSegment - true if this segment is the last segment of the ciphertext stream. The last segment is encrypted (or authenticated) differently to detect truncated ciphertext.
        plaintext - the decrypted plaintext.
        Throws:
        java.security.GeneralSecurityException - if ciphertext was not a valid ciphertext for the given segment.