. The P7B certificate is converted to. PFX

Source: Internet
Author: User
Tags openssl rsa pkcs12

. P7B converted to. PFX

1. Download the OpenSSL tool (for example, Windows system)

Https://www.chinassl.net/download/d1.html

2. Format conversion

p7b (pkcs#7)

A p7b file is a text file that contains a certificate and a chain of certificates, but does not contain a private key .

PFX (pkcs#12)

A portable format is specified for storing and transporting the user or server private key, public key, and certificate. It is a binary format that these files are also known as PFX files.

convert p7b to PFX

It is important to note that in order to do the conversion , you must have the certificate cert.p7b file and the private key cert.key file.

$ OpenSSL pkcs7-print_certs-in cert.p7b-out cert.cer


    1. -print_certs: Any certificate contained in the output file .

    2. -in: Specifies the input file .

    3. -out: Specifies the output file.


$ OpenSSL pkcs12-export-in cert.cer-inkey cert.key-out cert.pfx


    1. -export: represents the export certificate .

    2. -in: Specifies the file name of the pkcs#12.

    3. -inkey: Specifies the private key file name.

    4. -out: Specifies the output file.


3. Extension:

Create a self-signed certificate

Create a 2048-bit RSA certificate, valid for 5 years:

$ OpenSSL req-new-x509-days 1825-sha256-nodes-out cert.crt-keyout Cert.key


    1. req: Generate certificate Issuance request command

    2. -new: represents a new request.

    3. -x509: The issuance of the certificate of the ".

    4. -days: indicates the number of days that are valid.

    5. -sha256: represents the Certificate digest algorithm, which is SHA256.

    6. -nodes: the private key will not be encrypted .

    7. -out: Specifies the output file name.

    8. -keyout: Specifies the file name of the newly created private key .

$ OpenSSL pkcs12-export-in cert.crt-inkey cert.key-out cert.pfx
Create a certificate request (CSR)
$ OpenSSL req-new-newkey rsa:2048-sha256-nodes-out cert.csr-keyout Cert.key

-newkey : Create a new certificate request and key.

Note: "Country Name" must be "CN" and other fields can be filled in at will.

create RSA private key to PFX
$ OpenSSL pkcs12-in cert.pfx-nocerts-nodes | OpenSSL rsa-out Rsaprivkey.pem

This article is from the "My World" blog, so be sure to keep this source http://biweili.blog.51cto.com/4234993/1852336

. The P7B certificate is converted to. PFX

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.