From: "Carlo M." Date: 2013-06-01T09:19:18+09:00 Subject: Making PKCS12 Stores in Ruby (& where's PKCS8)? I'm fairly new to Ruby, but very comfortable with OpenSSL. I thought it would be a good learning exercise to "require 'openssl'" and build certificates. I have an existing Root CA and an Intermediate CA, and I can build appropriate certificates in Ruby. I'm failing on making a PKCS12. I want to include a chain, so I build an Array: chain = [root_ca, ca_ca] Now I want to build a PKCS12 structure - but, I have two problems: 1) I have encrypted my private key, and the 'keyenc' below is failing as not a valid PKey. bundle = OpenSSL::PKCS12::create(pass_phrase, "myP12", keyenc, cert, chain) So I simplify it and use the non-encrypted key: bundle = OpenSSL::PKCS12::create(pass_phrase, "", pkey, cert) and this can be written out with a ".to_der", but it isn't a valid PKCS12! If I keep it PEM formatted, the whole structure looks like a ruby object of some sort, not P12. 2) What is wrong with the output? It looks like this: # I tried passing 'bundle' into a ::PKCS1::new with (bundle.to_der)- but it errors. Also: Where where might one find a roadmap? The support for OpenSSL is really quite good in Ruby (ECC, e.g.), but I do need a PKCS#8 function. -- Posted via http://www.ruby-forum.com/.