public interface StreamSegmentEncrypter
Instances of this interfaces are passed to ...EncryptingChannel. Each instance of a segment encrypter is used to encrypt one stream. Typically, constructing a new StreamSegmentEncrypter results in the generation of a new symmetric key. This new symmetric key is used to encrypt the segments of the stream. The key itself wrapped with or derived from the key from StreamingAead instance. The wrapped key or the salt used to derive the symmetric key is part of the header.
A StreamSegmentEncrypter has a state: it keeps the number of segments encrypted so far. This state is used to encrypt each segment with different parameters, so that segments in the ciphertext cannot be switched.
| Modifier and Type | Method and Description |
|---|---|
void |
encryptSegment(ByteBuffer plaintext,
boolean isLastSegment,
ByteBuffer ciphertext)
Encrypts the next plaintext segment.
|
void |
encryptSegment(ByteBuffer part1,
ByteBuffer part2,
boolean isLastSegment,
ByteBuffer ciphertext)
Encrypt a segment consisting of two parts.
|
ByteBuffer |
getHeader()
Returns the header of the ciphertext stream.
|
ByteBuffer getHeader()
void encryptSegment(ByteBuffer plaintext, boolean isLastSegment, ByteBuffer ciphertext) throws GeneralSecurityException
GeneralSecurityExceptionvoid encryptSegment(ByteBuffer part1, ByteBuffer part2, boolean isLastSegment, ByteBuffer ciphertext) throws GeneralSecurityException
GeneralSecurityException