简体   繁体   中英

Possible to convert RSA private+public key to .pfx file?

I've got an RSA (XML) private+public key. Is there any way to create a .pfx file from this?

You can use the commandline tool openssl to convert certificatats.

Try

   openssl pkcs12 -export -out newCertificate.pfx -inkey myKey.pem -in myCertificate.cer -name "myCertificateName@myDomain.net"

Since you tagged .NET I'll assume you're looking for an API do to this...

The assembly Mono.Security.dll , that ships with Mono but works well with MS.NET on Windows, has a PKCS12 type that allows you to create .pfx files (with or without an X.509 certificate).

Note that it's a low-level API, used by the mono tools , but it might be a bit more complex than other API. OTOH since mono tools are built using this you can copy-paste the source code that does what you need.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM