How to store a X509Certificate2 in db c#

amemahoney

New Member
Heres the scenario:I have several .pfx files and i need to store them in my SQl DB.I already tried to store the RawData thing, but when I try to sign a xml using the reconstructed certificate i get: "Signing key is not loaded".Well so i tried to store the private key, using the function ToXmlString to generate a string from the private key and FromXmlString to load the new string, but then i get: "Object contains only the public half of a key pair. A private key must also be provided."The point is, how to correctly store the certificate and it keys on the db in a way that I can reconstruct it and use it for digital signing documents?Edit:Already tried this and didn't worked:Store an X509Certificate2 in DBThanks
 
Back
Top