Class EncryptedSegment


  • public class EncryptedSegment
    extends FileDirectSegment
    Writes encrypted segments to disk. Data is compressed before encrypting to (hopefully) reduce the size of the data into the encryption algorithms. The format of the encrypted commit log is as follows: - standard commit log header (as written by CommitLogDescriptor.writeHeader(ByteBuffer, CommitLogDescriptor)) - a series of 'sync segments' that are written every time the commit log is sync()'ed -- a sync section header, see CommitLogSegment.writeSyncMarker(long, ByteBuffer, int, int, int) -- total plain text length for this section -- a series of encrypted data blocks, each of which contains: --- the length of the encrypted block (cipher text) --- the length of the unencrypted data (compressed text) --- the encrypted block, which contains: ---- the length of the plain text (raw) data ---- block of compressed data Notes: - "length of the unencrypted data" is different from the length of resulting decrypted buffer as encryption adds padding to the output buffer, and we need to ignore that padding when processing.