See: Description
A common use case is to choose the encryption key accordingly to the record key. For example, in an event log, you may want to encrypt all records relative to the same transaction with the same encryption key and the transaction id can be deducted from the record key.
To acheive this, the key serializer and the value serializer will be paired.
The key serializer will be wrapped to call the a
KeyReferenceExtractor
and put in the context the cryptographic key reference, that will be used to encrypt the record value.
This based on the fact that KafkaProducer
and RecordCollector
(for streams)
call key serialization before value serialization.
CryptoSerializerPairFactory,
CryptoSerdeFactoryCopyright © 2018. All rights reserved.