In Focus

Forums - C# Corner

Forum guidelines
Mike Fif

Mike Fif

  • 1.5k
  • 15
  • 16.4k

Merging certificate(.crt) and private key(.key) into one .pfx file

Oct 16 2011 1:10 PM

I had a lot of problems trying to ad a seperate private key(received from the institute I want to communicate with) to the outgoing message.
I stumbled upon a solution where certificate and private key can be merged into one .pfx file via an commandline instruction.
The resulting .pfx file can then be used with the appropriate C# code to send a, in this case, signed message.

However when I use the commandline command:
openssl pkcs12 -in a.crt -inkey a.key -export -out a.pfx

I get the error message:
unable to load private key
6704:error:0906D06C: PEM routines: PEM_read_bio: no start line: .\crypto\pem\pem_lib.c:696:Expecting: ANY PRIVATE KEY

Do you know what the problemcould be?
I would appreciate your help very much

Kind regards

Answers (8)


Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now