1 Replies - 1067 Views - Last Post: 12 October 2017 - 04:13 PM

#1 wtp   User is offline

  • D.I.C Regular

Reputation: 28
  • View blog
  • Posts: 338
  • Joined: 08-December 11

Creating private/public key pair in a particular format

Posted 09 October 2017 - 11:43 AM

I was given a .pfx file. I want to create a similar example .pfx file (or the certs I extract from it) with different keys, so people can still follow the document I'm writing even if they don't already have their .pfx file.

I get easily confused with all the different key formats and file extensions. So maybe you can help me find the commands I need. Here's what I see when I run commands on the .pfx file.

I ran this on the .pfx to change it to a pem:
winpty openssl pkcs12 -in my.pfx -out cert.pem

I then ran these commands to extract the public and private keys:
winpty openssl x509 -pubkey -noout -in cert.pem > pubkey.pem
winpty openssl pkcs12 -in my.pfx -nocerts -out privkey.pem -nodes


These are the .pem files the above commands give me. I want to create a self signed key pair in the same format as these:
privkey.pem
Bag Attributes
    localKeyID: 01 00 00 00 
    friendlyName: rxsigservice-dev.cloud.walmart.com
    Microsoft CSP Name: Microsoft Strong Cryptographic Provider
Key Attributes
    X509v3 Key Usage: 10 
-----BEGIN PRIVATE KEY-----
MIIJjjB...
-----END PRIVATE KEY-----


pubkey.pem
-----BEGIN PUBLIC KEY-----
MIIBI...
-----END PUBLIC KEY-----



I tried this command:
winpty openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -sha256


But it's giving me -----BEGIN ENCRYPTED PRIVATE KEY----- and -----BEGIN CERTIFICATE----- which apparently isn't in the same format.

Is there more information I need to provide? Thanks for the help

This post has been edited by wtp: 09 October 2017 - 11:47 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Creating private/public key pair in a particular format

#2 wtp   User is offline

  • D.I.C Regular

Reputation: 28
  • View blog
  • Posts: 338
  • Joined: 08-December 11

Re: Creating private/public key pair in a particular format

Posted 12 October 2017 - 04:13 PM

I used this to create a key pair. It's not the exact same format as above but it's working for my purpose.
https://www.ibm.com/...ed_openSSL.html
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1