Interface CMSEncryptionService
public interface CMSEncryptionService
Interface for performing content-stream encryption and decryption.
-
Method Summary
Modifier and TypeMethodDescriptionbuildDecryptionInputStream(InputStream inputStream, Function<Set<String>, Map<String, Key>> keysByIds) Builds decrypted stream out of encrypted one.buildEncryptionOutputStream(OutputStream dataContentStream, Set<PublicKeyIDWithPublicKey> publicKeys) Builds asymmetrically encrypted stream using public-key cryptography.buildEncryptionOutputStream(OutputStream dataContentStream, SecretKey secretKey, KeyID secretKeyID) Builds symmetrically encrypted stream.
-
Method Details
-
buildEncryptionOutputStream
OutputStream buildEncryptionOutputStream(OutputStream dataContentStream, Set<PublicKeyIDWithPublicKey> publicKeys) Builds asymmetrically encrypted stream using public-key cryptography.- Parameters:
dataContentStream- Stream to encryptpublicKeys- Contains user public key and public-key ID which gets embedded into a stream, used for finding the private key to decrypt- Returns:
- Encrypted stream that wraps
dataContentStream
-
buildEncryptionOutputStream
OutputStream buildEncryptionOutputStream(OutputStream dataContentStream, SecretKey secretKey, KeyID secretKeyID) Builds symmetrically encrypted stream.- Parameters:
dataContentStream- Stream to encryptsecretKey- User secret keysecretKeyID- User key ID gets embedded into a stream, used for finding the key to decrypt- Returns:
- Encrypted stream that wraps
dataContentStream
-
buildDecryptionInputStream
InputStream buildDecryptionInputStream(InputStream inputStream, Function<Set<String>, Map<String, Key>> keysByIds) Builds decrypted stream out of encrypted one.- Parameters:
inputStream- Stream to decryptkeysByIds- Key to its ID mapping function - you request for the set of key aliases and function returns only those that were found as a map (key id - key), will retrieve key for decryption using this. Implemented as a request once for many instead of iterating one-by-one to avoid possible concurrency issues.- Returns:
- Decrypted stream that wraps
inputStream
-