tags:

views:

162

answers:

1

Hi all, what's the Ruby OpenSSL library equivalent of the following command?

openssl pkcs12 -clcerts -nodes -in apns.p12 -out apns.pem

I've been reading through the documentation that I could find, but it's so sparsely documented and I'm not having much luck with that.

Thanks!

A: 

No. Ruby OpenSSL doesn't expose enough API to do this. Even in C, we have to write some custom code to accomplish this.

Your best bet is to run openssl from Ruby like this,

  system("#{openssl_path}openssl pkcs12 -in #{dir}/#{login}.p12 -out #{dir}/#{login}.cer -clcerts -nokeys -passin pass:#{p12_password}")
ZZ Coder
Ah, lack of an API for that feature explains the lack of documentation, I suppose ;-)I'll look into using something like that, thanks!