public interface DataSealer
A DataSealer is a thread safe object that can protect data that must be exchanged between two parties. It provides protection regarding the following aspects of the data:
A DataSealer has a strong association with an author, because it signs data with the private authentication key of the author
Consequently a DataSealer must be created for each author. Use the DataSealerBuilder to create DataSealers. Once the DataSealer
is created, it can be used for several messages, to different addressees. It can be used simultaneously by multiple threads.
To seal the data, i.e. protect the data, you need to pass to the seal operation :
The KEK ID will be readable included in the sealed message. In other words, the KEK ID is not encrypted. As such it can be used by the recipient to know which KEK to use in order to decrypt the sealed message. In some circumstances, you don't want to have the real identifier of the KEK of the message in the message. In that case you can pass a dummy value as KEK ID to the seal operation, and use another way of letting your recipient know which KEK to use to decrypt the message.
The dataToSeal can be a byte[] or an InputStream. Use the byte[] for small messages that can be loaded in memory in one take. Use the
InputStream for bigger messages.
The result of a seal operation of the DataSealer is a CMS message according to the security policy of the eHealth Platform Belgium
regarding End-To-End protection of data to exchange.
Note that one CMS message can have the data sealed for multiple addressees or multiple keys for the same addressee. In that case a Set of
EncryptionCredentials must be passed to the seal operation.
DataSealerBuilder| Modifier and Type | Method and Description |
|---|---|
byte[] |
seal(byte[] dataToSeal,
EncryptionCredential... encryptionKeys)
Seals the given message so that it can be exchanged safely with the owner(s) of the given encryption credential(s).
|
byte[] |
seal(byte[] dataToSeal,
javax.crypto.SecretKey symKek,
java.lang.String base64encodedSymKekId)
Deprecated.
|
byte[] |
seal(EncryptionToken etk,
byte[] dataToSeal)
Deprecated.
|
byte[] |
seal(EncryptionToken asymKek,
byte[] dataToSeal,
javax.crypto.SecretKey symKek,
java.lang.String base64encodedSymKekId)
Deprecated.
|
void |
seal(EncryptionToken asymKek,
java.io.InputStream dataToSeal,
java.io.OutputStream sealedData)
Deprecated.
|
void |
seal(EncryptionToken asymKek,
java.io.InputStream dataToSeal,
java.io.OutputStream sealedData,
javax.crypto.SecretKey symKek,
java.lang.String base64encodedSymKekId)
Deprecated.
|
void |
seal(java.io.InputStream dataToSeal,
java.io.OutputStream sealedData,
EncryptionCredential... encryptionKeys)
Seals the given message so that it can be exchanged safely with the owner(s) of the given encryption credential(s).
|
void |
seal(java.io.InputStream dataToSeal,
java.io.OutputStream sealedData,
javax.crypto.SecretKey symKek,
java.lang.String base64encodedSymKekId)
Deprecated.
|
byte[] |
seal(java.util.Set<EncryptionToken> asymKeks,
byte[] dataToSeal)
Deprecated.
|
byte[] |
seal(java.util.Set<EncryptionToken> asymKeks,
byte[] dataToSeal,
javax.crypto.SecretKey symKek,
java.lang.String base64encodedSymKekId)
Deprecated.
|
void |
seal(java.util.Set<EncryptionToken> asymKeks,
java.io.InputStream dataToSeal,
java.io.OutputStream sealedData)
Deprecated.
|
void |
seal(java.util.Set<EncryptionToken> asymKeks,
java.io.InputStream dataToSeal,
java.io.OutputStream sealedData,
javax.crypto.SecretKey symKek,
java.lang.String base64encodedSymKekId)
Deprecated.
|
byte[] seal(byte[] dataToSeal,
EncryptionCredential... encryptionKeys)
throws DataSealerException
dataToSeal - - the data to sealencryptionKeys - - keys owned or known by the receiver(s) of the message, used to encrypt the dataDataSealerException - When the CMS message could not be generated.void seal(java.io.InputStream dataToSeal,
java.io.OutputStream sealedData,
EncryptionCredential... encryptionKeys)
throws DataSealerException
dataToSeal - the InputStream where the dataToSeal content is read from by the DataSealer. The given InputStream must implement
the available() method.sealedData - the OutputStream to which the sealed result is written by the DataSealer. When the sealing is finished, the
OutputStream is not closed in here.encryptionKeys - - keys owned or known by the receiver(s) of the message, used to encrypt the dataDataSealerException - When the CMS message could not be generated.@Deprecated byte[] seal(EncryptionToken etk, byte[] dataToSeal) throws DataSealerException
seal(byte[], EncryptionCredential...)dataToSeal - - the data to sealetk - - the EncryptionToken of the addresseeDataSealerException - When the CMS message could not be generated.@Deprecated byte[] seal(EncryptionToken asymKek, byte[] dataToSeal, javax.crypto.SecretKey symKek, java.lang.String base64encodedSymKekId) throws DataSealerException
seal(byte[], EncryptionCredential...)asymKek - - the EncryptionToken of a recipient.dataToSeal - - the data to sealsymKek - - the symmetric Key Encryption Keybase64encodedSymKekId - - the ID (base64 encoded) of the given SecretKey symKekDataSealerException - When the CMS message could not be generated.@Deprecated byte[] seal(java.util.Set<EncryptionToken> asymKeks, byte[] dataToSeal) throws DataSealerException
seal(byte[], EncryptionCredential...)dataToSeal - - the data to sealasymKeks - - the EncryptionTokens of the addresseesDataSealerException - When the CMS message could not be generated.@Deprecated byte[] seal(java.util.Set<EncryptionToken> asymKeks, byte[] dataToSeal, javax.crypto.SecretKey symKek, java.lang.String base64encodedSymKekId) throws DataSealerException
seal(byte[], EncryptionCredential...)asymKeks - - the EncryptionTokens of the addresseesdataToSeal - - the data to sealsymKek - - the symmetric Key Encryption Keybase64encodedSymKekId - - the ID (base64 encoded) of the given SecretKey symKekDataSealerException - When the CMS message could not be generated.@Deprecated
byte[] seal(byte[] dataToSeal,
javax.crypto.SecretKey symKek,
java.lang.String base64encodedSymKekId)
throws DataSealerException
seal(byte[], EncryptionCredential...)dataToSeal - - the data to sealsymKek - - the symmetric Key Encryption Keybase64encodedSymKekId - - the ID (base64 encoded) of the given SecretKey symKekDataSealerException - When the CMS message could not be generated.@Deprecated void seal(EncryptionToken asymKek, java.io.InputStream dataToSeal, java.io.OutputStream sealedData) throws DataSealerException
seal(InputStream, OutputStream, EncryptionCredential...)asymKek - - the EncryptionToken of a recipient.dataToSeal - the InputStream where the dataToSeal content is read from by the DataSealer. The given InputStream must implement
the available() method.sealedData - the OutputStream to which the sealed result is written by the DataSealer. When the sealing is finished, the
OutputStream is not closed in here.DataSealerException - When the CMS message could not be generated.@Deprecated void seal(java.util.Set<EncryptionToken> asymKeks, java.io.InputStream dataToSeal, java.io.OutputStream sealedData) throws DataSealerException
seal(InputStream, OutputStream, EncryptionCredential...)asymKeks - - the EncryptionTokens of the known addresseesdataToSeal - the InputStream where the dataToSeal content is read from by the DataSealer. The given InputStream must implement
the available() method.sealedData - the OutputStream to which the sealed result is written by the DataSealer. When the sealing is finished, the
OutputStream is not closed in here.DataSealerException - When the CMS message could not be generated.@Deprecated void seal(EncryptionToken asymKek, java.io.InputStream dataToSeal, java.io.OutputStream sealedData, javax.crypto.SecretKey symKek, java.lang.String base64encodedSymKekId) throws DataSealerException
seal(InputStream, OutputStream, EncryptionCredential...)asymKek - - the EncryptionToken of a recipient.dataToSeal - the InputStream where the dataToSeal content is read from by the DataSealer. The given InputStream must implement
the available() method.sealedData - the OutputStream to which the sealed result is written by the DataSealer. When the sealing is finished, the
OutputStream is not closed in here.symKek - - the symmetric Key Encryption Keybase64encodedSymKekId - - the ID (base64 encoded) of the given SecretKey symKekDataSealerException - When the CMS message could not be generated.@Deprecated void seal(java.util.Set<EncryptionToken> asymKeks, java.io.InputStream dataToSeal, java.io.OutputStream sealedData, javax.crypto.SecretKey symKek, java.lang.String base64encodedSymKekId) throws DataSealerException
seal(InputStream, OutputStream, EncryptionCredential...)asymKeks - - the EncryptionTokens of the known addresseesdataToSeal - the InputStream where the dataToSeal content is read from by the DataSealer. The given InputStream must implement
the available() method.sealedData - the OutputStream to which the sealed result is written by the DataSealer. When the sealing is finished, the
OutputStream is not closed in here.symKek - - the symmetric Key Encryption Keybase64encodedSymKekId - - the ID (base64 encoded) of the given SecretKey symKekDataSealerException - When the CMS message could not be generated.@Deprecated
void seal(java.io.InputStream dataToSeal,
java.io.OutputStream sealedData,
javax.crypto.SecretKey symKek,
java.lang.String base64encodedSymKekId)
throws DataSealerException
seal(InputStream, OutputStream, EncryptionCredential...)dataToSeal - the InputStream where the dataToSeal content is read from by the DataSealer. The given InputStream must implement
the available() method.sealedData - the OutputStream to which the sealed result is written by the DataSealer. When the sealing is finished, the
OutputStream is not closed in here.symKek - - the symmetric Key Encryption Keybase64encodedSymKekId - - the ID (base64 encoded) of the given SecretKey symKekDataSealerException - When the CMS message could not be generated.Copyright © 2025 eHealth. All rights reserved.