Package org.bouncycastle.operator
Interface KnownLengthOutputEncryptor
-
- All Superinterfaces:
OutputEncryptor
public interface KnownLengthOutputEncryptor extends OutputEncryptor
Extension ofOutputEncryptorfor 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 identifierwhere the algorithm is recognised; implement this interface to support definite-length output with algorithms outside that set.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description longgetOutputLength(long inputLength)Return the exact number of ciphertext octets that encryptinginputLengthplaintext octets will produce, including any appended AEAD tag where the CMS structure carries the tag inside the encrypted content.-
Methods inherited from interface org.bouncycastle.operator.OutputEncryptor
getAlgorithmIdentifier, getKey, getOutputStream
-
-
-
-
Method Detail
-
getOutputLength
long getOutputLength(long inputLength)
Return the exact number of ciphertext octets that encryptinginputLengthplaintext octets will produce, including any appended AEAD tag where the CMS structure carries the tag inside the encrypted content.- Parameters:
inputLength- number of plaintext octets to be encrypted- Returns:
- the exact ciphertext octet count, or -1 if it cannot be determined
-
-