Skip to content

DataProtection without having to share data #29526

Answered by lukos
lukos asked this question in General
Discussion options

You must be logged in to vote

I was looking at the example that show:

services.AddDataProtection()
        .PersistKeysToFileSystem(new DirectoryInfo(@"\\server\share\directory\"))
        .ProtectKeysWithCertificate(
            new X509Certificate2("certificate.pfx", "password"));

So it looks like it would work with X509 certs, which are rotated, the confusing part is that the examples all show persisting to a shared location. I haven't tried to see what happens if I persist to the local file system but that was my thinking, this way, hitting a new server doesn't require a network trip, it will simply look for a key and if not found, will create it with the same cert?

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@Tratcher
Comment options

Answer selected by lukos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants