File Access Issues with File creation

Ok, for all you Certificate Gurus, here is a bizarre one for you!

I am downloading a .pfx (PKCS12) file to a local file. I then use a
System
call to run a Java application I have written to convert that PKCS12
file
into a pem (I essentially am just getting rid of the password
protection).
Upon finishing the system call, I then attempt to open this file with
the
OpenSSL::X509:: Certificate.new call. This produces the following
error:
OpenSSL::X509::CertificateError: not enough data
Y:/pki/…/lib/pkistdlib.rb:346:in initialize' Y:/pki/../lib/pkistdlib.rb:349:injoin’
Y:/pki/…/lib/pkistdlib.rb:349:in validateExportedCert' Y:/pki/../lib/pkistdlib.rb:349:ineach’
Y:/pki/…/lib/pkistdlib.rb:349:in validateExportedCert' Y:/pki/../lib/pkistdlib.rb:323:incheck_Export_WprivateKey’
Y:/pki/…/lib/pkistdlib.rb:284:in times' Y:/pki/../lib/pkistdlib.rb:284:incheck_Export_WprivateKey’
Y:/pki/eval/pki_validation.rb:37:in test_02_ExportKMO_validate' Y:/pki/../lib/testcase_impl.rb:26:inrun’

The interesting part is this. I can stall the progress, with a gets
command, and use the exact same code run from a different file, and read
the
exact same certificate file with no problem. Any ideas as to why this
is
happening?

Thanks in advance!

Mbright

Code:
Ruby Ceritifcate Code:

require 'openssl'
file=File.open(out)
cert=OpenSSL::X509::Certificate.new(file.read) if file &&

FileTest::file?(file)
file.close()

Java Code is cleaning up with System.exit();

On 10/2/06, Michael B. [email protected] wrote:

Ok, for all you Certificate Gurus, here is a bizarre one for you!

Make sure the Java code is flushing the streams; System.exit() won’t
do it for you.

Make sure the Java code is flushing the streams; System.exit() won’t
do it for you.

Thanks for advice, I am using a FileOutputStreamWriter and I am calling
the
flush and close prior to calling System.exit(). I should have stated
that
in the previous section.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs