orders, that an encryption Interceptor already encrypts. You change the algorithm, then decide what to do with the records already in orders.
Change the algorithm
Setalgorithm in the encryption Interceptor and apply it with the Conduktor CLI or the API. Every Gateway node applies the change without a restart. See choosing an encryption algorithm.
defaultAlgorithm in the Interceptor and conduktor.algorithm on any field in the schema that sets its own.
After the change:
- New records in
ordersare encrypted with the new algorithm, under a new data encryption key (DEK). - Records already in
orderskeep the old algorithm. Gateway still decrypts them, because it stores the settings it used with each record: in a record header, or in a topic if you setexternalStorage: truebefore Gateway 3.18. - Your consumers read old and new records with no change to the decrypt Interceptor or your clients.
Do you need to act on older records?
Re-encrypt older records
Copyorders through Gateway into a new topic, orders-v2. Gateway decrypts the records as they’re read and encrypts them with the new algorithm as they’re written. Then give the copy the name orders, so your clients don’t change.
-
Create
orders-v2with the same number of partitions asorders, so records with the same key stay in order. -
Check that the encryption Interceptor covers
orders-v2. -
Run a copy job that reads
ordersthrough Gateway with a decrypt Interceptor and writes toorders-v2through Gateway. For MirrorMaker 2, see the sample configuration. - Stop your producers and consumers, let the copy job catch up, then stop it. Kafka can reset a consumer group’s offsets only while none of its consumers are running.
-
Delete
orders, then create an alias topic namedordersthat points toorders-v2. Keep this order: Gateway accepts an alias with the same name as an existing topic, and deletingorderswould then deleteorders-v2. - Restart your producers.
-
Reset each consumer group to the earliest offset, then start your consumers. Deleting
ordersdeleted the groups’ committed offsets, so consumers using the defaultauto.offset.reset=latestwould skip every copied record. Consumers read again the records they processed before the copy.
Sample MirrorMaker 2 configuration
Run it withconnect-mirror-maker.sh mm2.properties --clusters dst.
Check your master key
Gateway wraps each DEK with a key in your Key Management Service (KMS).- To rotate that key, see key rotation.
- If you use the Gateway KMS, keep
kmsConfig.gateway.masterKeyIdthe same. Changing it makes older records unreadable.