How can I convert the private key pem to a format for windows that can be used in .NET.

I was given a private key, which turned out to be in pkcs8 format, which I managed to turn into a pem file using the following command:

openssl pkcs8 -inform der -nocrypt -in private.key -out pkey.pem

Now I need to convert this to pkcs12 so that I can use it in .NET to create an X509 certificate (I would also like to import it into the Windows Certificate Manager).

I tried this command:

openssl pkcs12 -export -name myalias -in mycert.crt -inkey pkey.pem -out keystore.p12

however, I do not have a public key, I tried to use the pkey.pem file as -in arg, but it tells me No certificate matches private key. If I try without -inarg, nothing will happen (and I don't mean anything, there is an empty line until I press ctrl-c).

How can I generate a public key from a private key or convert to pkcs12 without a public key?

I , , , (-nocerts):

openssl pkcs12 -export -nocerts -inkey your.private.key.pem -out your.private.key.p12

Windows, The specified file is empty, .

, , ' , No certificate matches private key

, , -in, No certificate matches private key, , : openssl rsa -in privkey.pem -pubout > key.pub

EDIT: , , , , . - , , .

+4
1

:

, :

pkcs8/DER PEM

openssl pkcs8 -nocrypt -in dealerPrivate.key -inform der -outform pem -out private.pem

x509/DER PEM

openssl x509 -inform der -in dealerCertificate.x509 -out public.pem

pkcs12 - p12

openssl pkcs12 -export -inkey private.pem -in public.pem -out mycert.p12

pkcs12 ( ), Windows, .NET WCF.

, , , , :

:

POST http://[HOST].com/services/fsa/1.0 HTTP/1.1
Content-Type: text/xml; charset=utf-8
VsDebuggerCausalityData: uIDPo0ii5Jr5wONMi6i/jkMQdFkAAAAArRV2zOsUrEioQMkqYDWulG6ktjqzCoRLtP+/9VQSARUACQAA
SOAPAction: ""
Host: [HOST]
Content-Length: 299
Expect: 100-continue
Connection: Keep-Alive

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><list xmlns="http://[HOST].com/services/fsa/1.0"><String_1 xmlns="">[MY_STRING]</String_1></list></s:Body></s:Envelope>

:

HTTP/1.1 200 OK
Date: Thu, 31 Oct 2013 12:19:38 GMT
Server: Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/1.0.0a mod_jk/1.2.31
X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1
VsDebuggerCausalityData: uIDPo0ii5Jr5wONMi6i/jkMQdFkAAAAArRV2zOsUrEioQMkqYDWulG6ktjqzCoRLtP+/9VQSARUACQAA
SOAPAction: ""
host: [HOST]
Expect: 100-continue
connection: Keep-Alive, Keep-Alive
Content-Length: 299
Keep-Alive: timeout=2, max=100
Content-Type: text/xml;charset=utf-8

<s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'><s:Body xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><list xmlns='http://[HOST].com/services/fsa/1.0'><String_1 xmlns=''>[MY_STRING]</String_1></list></s:Body></s:Envelope>
+2

All Articles