Nice work, Alwil17! Super handy tool for keeping secrets safe in .NET apps. Curious—how do you handle key rotation securely without breaking existing encrypted data?
SecurePasswordCrypt: Secure AES-GCM Encryption & Password Hashing for .NET Projects
0 Comments
Alwil17
•
Thanks James !!!
Currently, key rotation is not natively handled by the library, but here’s how you can approach it:
- Key Identifiers: When encrypting data, you can prepend or store a key identifier (e.g., key version or GUID) alongside the ciphertext. When decrypting, use this identifier to look up the correct key.
- Supporting Multiple Keys: During the rotation process, the application should maintain access to both the new key and previous keys, so existing data remains decryptable.
- Migration Strategy: For sensitive or frequently accessed data, you can re-encrypt using the new key during reads (lazy migration), or run a batch process to re-encrypt all existing data.
I'm considering adding built-in support for key versioning and seamless rotation in a future release. If you have a particular use case or idea, I'd love to hear it!
Please log in to add a comment.
Please log in to comment on this post.
More Posts
chevron_left