Read a PKCS12 in Ruby

69 Views Asked by At

I tried running this code to parse a PKCS12 but for some reason, It didn't run and it gave me this error.

Does any one know a fix to this?

The Error:

main.rb:4:in `initialize': PKCS12_parse: mac verify failure (OpenSSL::PKCS12::PKCS12Error)
        from main.rb:4:in `new'
        from main.rb:4:in `<main>'

The code:

require 'openssl'


  pkcs12 = OpenSSL::PKCS12.new(File.read("cert.p12"), "AppleP12.com")

  puts pkcs12.key
0

There are 0 best solutions below