Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

[Fixed/Found] IDataProtectionBuilder - PersistKeysToFileSystem

$
0
0

Hi everyone,

I'm using IDataProtectionBuilder to encrypt/decrypt data, and because the application is split on several machines I'm using as you can see it below.

services.AddDataProtection()
.PersistKeysToFileSystem(new DirectoryInfo(@"\\SharedKeyFolder"))
.SetDefaultKeyLifetime(TimeSpan.FromDays(30))
.SetApplicationName("ApplicationName");

My issue is that when I encrypt with machine 1 and decrypt with machine 2, the machine 2 throws an exception that cant find the key. 

I'm missing something from the configuration ? 

Thanks,

Mircea

https://docs.microsoft.com/en-us/aspnet/core/security/data-protection/configuration/overview?view=aspnetcore-2.1&tabs=aspnetcore2x

Later Edit: 

Seems like is working, after further investigation the cause was made of an old deployment that didn't had Certificate with NetworkPath. 


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>