Nauman Thanvi wrote in post #1057798:
> This is code which I'm using both on centos and windows,
>
> require 'openssl'
>
> if ARGV.length == 2
>  pkcs12 = OpenSSL::PKCS12.new(File.read(ARGV[0]), ARGV[1])

I don't use Windows, but could it be that File.read() is opening the 
file in text mode, and thus doing CR/LF conversions?

Try:

... File.read(ARGV[0], :mode=>"rb") ...

(which looks to have been added in 1.9.x), or:

data = File.open(ARGV[0],"rb") { |f| f.read }
pkcs12 = OpenSSL::PCKS12.new(data, ARGV[1])

The documentation doesn't make it clear whether IO.read() opens in text 
or binary mode, but it's possible that it defaults to text.

Regards,

Brian.

-- 
Posted via http://www.ruby-forum.com/.