Closed GoogleCodeExporter closed 9 years ago
The error occurs on File.exists? not File.read
the following fixes the problem
def self.load_key(keyfile, passphrase)
begin
begin
content = File.read(keyfile)
rescue Errno::ENOENT, ArgumentError
content = keyfile
end
pkcs12 = OpenSSL::PKCS12.new(content, passphrase)
return pkcs12.key
rescue OpenSSL::PKCS12::PKCS12Error
raise ArgumentError.new("Invalid keyfile or passphrase")
end
end
Original comment by tim.uc...@digitaldialogue.com.au
on 13 Sep 2012 at 12:40
I'm strongly inclined to say that this should either be split into two methods,
load_key and load_key_file or it should use optional named parameters that
explicitly indicate whether this is a raw key or a filename.
Original comment by bobaman@google.com
on 13 Sep 2012 at 4:10
I think the two call idea is great because the load_key_from_file method can
call the load_key method
Original comment by tim.uc...@digitaldialogue.com.au
on 13 Sep 2012 at 5:05
This will be fixed in the next version. Did a bit more refactoring since we're
likely moving to generating keys in PEM format instead.
Original comment by sba...@google.com
on 2 Nov 2012 at 8:58
Original issue reported on code.google.com by
tim.uc...@digitaldialogue.com.au
on 13 Sep 2012 at 12:19