Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8185419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T01:50:31+00:00 2026-06-07T01:50:31+00:00

Here is the scenario: I have several .pfx files and I need to store

  • 0

Here is the scenario:

I have several .pfx files and I need to store them in a MySQL 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 its keys in the DB in a way that I can reconstruct it and use it for digital signing documents?

Update:

Already tried this and didn’t work:
Store an X509Certificate2 in DB

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T01:50:33+00:00Added an answer on June 7, 2026 at 1:50 am

    The certificate only includes the public key, so storing only that won’t work.

    On the other hand, cert.PrivateKey.ToXmlString(true) should work. Are you sure that you remembered to call it with the includePrivateParameters argument set to true and that you imported it as exportable?

    X509Certificate2 cert = new X509Certificate2("key.pfx", "password", X509KeyStorageFlags.Exportable);
    string xml = cert.PrivateKey.ToXmlString(true);
    

    Alternatively, you could just store the entire pfx in the database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my scenario: I have two MySQL tables: Categories (columns: id, category) Items
I have come across several solutions here and across the web but none seem
Here's the scenario... I have several float attributes in my data model which I
Here is the scenario: I have several CIFS partitions which AD-based users can mount
Here's my scenario: I have a page containing several links; each link is meant
Here's the scenario: I have a public repo A . Bob forks A ,
Here is my scenario: I have an Eclipse project in my desktop in a
Here is the scenario: I have a visual that displays some data The data
Here's the scenario: I have 2 tables with data, one is the 2009 version
Here's the scenario: I have a private site that, once logged on, will display

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.