.net Core web application using DataProtection with redis as storage provider
See original GitHub issueHi guys,
I have a .net core 2.0 web api project which is deployed as AWS Lambda using data protection with redis as storage provider. I followed the article https://docs.microsoft.com/en-us/aspnet/core/security/data-protection/configuration/overview?tabs=aspnetcore2x to set up. I also use x.509 certificate for the key encryption. However I always get the below errors during the startup.
Some code for the set up
X509Certificate2 cert = new X509Certificate2(Convert.FromBase64String(certificate), certPassword);
var redis = ConnectionMultiplexer.Connect(dpRedisConStr);
services.AddDataProtection()
.PersistKeysToRedis(redis)
.ProtectKeysWithCertificate(cert);
[Error] Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager: An exception occurred while processing the key element ‘<key id="a0604cb3-8f04-43f0-a9eb-a2ed5138a486" version="1" />’.
[Warning] Microsoft.AspNetCore.DataProtection.KeyManagement.DefaultKeyResolver: Key {a0604cb3-8f04-43f0-a9eb-a2ed5138a486} is ineligible to be the default key because its CreateEncryptor method failed.
Can anyone give some advice?
Cheers
Jason
Issue Analytics
- State:
- Created 6 years ago
- Comments:23 (9 by maintainers)
Top Related StackOverflow Question
@natemcmaster , looks like setting the HOME directory to /tmp resolved the problem.
Thanks guys.
Yep, noticed. And the solution you gave actually works. Thanks.