使用shell我可以这样做:
# Extract Public Key (ask for password)openssl pkcs12 -in file.pfx -out file_public.pem -clcerts -nokeys# Extract Certificate Authority Key (ask for password)openssl pkcs12 -in file.pfx -out file_ca.pem -cacerts -nokeys# Extract Private Key (ask for password)openssl pkcs12 -in file.pfx -out file_private.pem -nocerts -nodes# Extract RSA Private Keyopenssl rsa -in file_private.pfx -out file_private_rsa.key# Create Combo file with Public and RSA Private Keyscat file_private_rsa.key file_public.pem > file_combo.pem
On this post DMKE显示了如何将键转换为.PFX,但是如何反过来呢?
解决方法pkcs = OpenSSL::PKCS12.new(file.read("xyz.p12"),"password_for_xyz.p12")key = OpenSSL::PKey::RSA.new(pkcs.key.to_pem)cert = OpenSSL::X509::Certificate.new(pkcs.certificate.to_pem)总结
以上是内存溢出为你收集整理的ruby-on-rails – Ruby – 如何从ruby上的.pfx文件中提取public,rsa私钥和CA密钥全部内容,希望文章能够帮你解决ruby-on-rails – Ruby – 如何从ruby上的.pfx文件中提取public,rsa私钥和CA密钥所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)