Automating generating x509 certificates

71 views
Skip to first unread message

Arash Sabet

unread,
Feb 8, 2021, 10:45:13 AM2/8/21
to RavenDB - 2nd generation document database
Greetings,
Not sure whether or not this question makes any sense: is there a way to automate the full cycle of generating PFX files (e.g. assigning Admin/Operatore/Read&Write privileges), acquiring the pfx file and getting it saved somewhere? If so, is there an article or material to look at? 

Iftah Ben Zaken

unread,
Feb 8, 2021, 11:06:19 AM2/8/21
to rav...@googlegroups.com
Yes, one way to do it would be via the client API:

You get a byte array that you can use to construct an X509Certificate2. Then you can export it to a PFX file and save it on disk or supply it directly to the Document Store.
Here is a simplified example

var clientCert = new X509Certificate2(certBytes, (string)null, X509KeyStorageFlags.Exportable | X509KeyStorageFlags.MachineKeySet);
var pfxBytes = clientCert.Export(X509ContentType.Pfx);
File.WriteAllBytes(path,  pfxBytes);

Iftah Ben Zaken
Senior Developer   /   Hibernating Rhinos LTD
E-mail:    if...@ravendb.net
Support:  sup...@ravendb.net
Skype:  live:iftahbe



On Mon, Feb 8, 2021 at 5:45 PM Arash Sabet <arash...@umplify.com> wrote:
Greetings,
Not sure whether or not this question makes any sense: is there a way to automate the full cycle of generating PFX files (e.g. assigning Admin/Operatore/Read&Write privileges), acquiring the pfx file and getting it saved somewhere? If so, is there an article or material to look at? 

--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ravendb/0d78deae-1058-4194-a224-0ba0609341cdn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages