public interface KnownLengthOutputEncryptor extends OutputEncryptor
OutputEncryptor for encryptors that can predict the
exact ciphertext length produced for a given plaintext length. This enables
definite-length (DL/DER) streaming of CMS structures: the encrypted-content
OCTET STRING's length has to be written before any ciphertext flows, so the
producer needs the count up front.
For encryptors that do not implement this interface the CMS stream
generators fall back to deriving the count from the encryptor's
algorithm identifier where
the algorithm is recognised; implement this interface to support
definite-length output with algorithms outside that set.
| Modifier and Type | Method and Description |
|---|---|
long |
getOutputLength(long inputLength)
Return the exact number of ciphertext octets that encrypting
inputLength plaintext octets will produce, including any
appended AEAD tag where the CMS structure carries the tag inside the
encrypted content. |
getAlgorithmIdentifier, getKey, getOutputStreamlong getOutputLength(long inputLength)
inputLength plaintext octets will produce, including any
appended AEAD tag where the CMS structure carries the tag inside the
encrypted content.inputLength - number of plaintext octets to be encrypted