require 'openssl'
if ARGV.length == 2
pkcs12 = OpenSSL::PKCS12.new(File.read(ARGV[0]), ARGV[1])
p pkcs12.certificate
else
puts "Usage: load_cert.rb <path_to_cert> <cert_password>"
end
Running this produces error on windows but not in linux.
Error:
OpenSSL::PKCS12::PKCS12Error: PKCS12_parse: mac verify failure
from (irb):21:ininitialize
from (irb):21:innew
from (irb):21
from C:/Ruby192/bin/irb:12:in<main>
File.read("UserCert.p12", "rb")
Problem was ruby by default read file as text and need to force to read file as binary, it solves the problem
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With