AspNetCore.DataProtection `ProtectKeysWithCertificate` rotation mechanism
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe the problem.
Protecting keys at rest is a good practice and is often done via the ProtectKeysWith...
methods like ProtectKeysWithCertificate
.
However, protecting the keys with for example ProtectKeysWithCertificate
and an X509Certificate2
keeps the problem of rotating the certificate used for protecting the keys at rest. Is there a good pattern or some documentation on this topic on how to proceed with rotation certificates used for key protection at rest without restarting the application?
Describe the solution you’d like
Some docs or a API to configure propper certificate rotation for the protection of key in rest.
Additional context
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Configure ASP.NET Core Data Protection
Learn how to configure Data Protection in ASP. ... You can rotate certificates and decrypt keys at rest using an array of X509Certificate2 ......
Read more >An introduction to the Data Protection system in ASP. ...
The data-protection keys are designed to expire and be rotated. Additionally, if keys are deleted (not recommended) then encrypted data will be ...
Read more >Does `Microsoft.AspNetCore.Identity.PasswordHasher< ...
According to ASP.NET Core Data Protection, the default implementation handles key generation and rotation - i.e. keys are stored in the LOCAL ...
Read more >Data Protection — ASP.NET documentation - Read the Docs
The ASP.NET Core data protection stack provides a simple and easy to use ... API a developer can use to protect data, including...
Read more >ASP.NET Core 6.0 - Data Protection Keys
Describes the default ASP.NET Core Data Protection conditions and ... can use to protect data, including key management and rotation.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I would like to state that the current API works, however there is practically no documentation or examples available online. Having literally any documentation (beyond the fact that the methods exist) would be nice. As mentioned, there is no way to change the certificates once the application has started. If you have long-running processes, this is a problem.
Another problem (not with .NET itself, all crypto has this problem) is that the private keys have to be stored somewhere. The whole keyring must itself be encrypted, this is still the developers problem.
The current workflow is as follows (as far as I can make out) - it would be nice if this was officially documented somewhere:
CertificateXmlEncryptor
class.IXmlRepository
(Redis, File etc).XmlKeyDecryptionOptions
class. If the certificate is not found, an error occurs (i.e. no payloads encrypted with this key can be decrypted).As already mentioned, this process is not officially documented anywhere I can find. I am also not 100% sure if that is a correct explanation either, due to the lack of documentation.
Thanks for contacting us.
We’re moving this issue to the
.NET 8 Planning
milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it’s very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.