From: Yves Vogl Date: 2009-01-26T19:22:10+09:00 Subject: Re: Creating p7s/pkcs7 files with Ruby Hi, On 25.01.2009, at 20:12, Sandor Szücs wrote: > I think what you want is: > p7 = OpenSSL::PKCS7::PKCS7.new(signed) > > The variable signed is the signature in your example and is of type > OpenSSL::PKCS7. But isn't this redundant then? signed = OpenSSL::PKCS7::sign(crt, key, data, [], OpenSSL::PKCS7::DETACHED) At this point I have a complete p7s file already (see signed.inspect) When adding certificate and data again, I'm signing a signature… p7 = OpenSSL::PKCS7::PKCS7.new(signed) p7.add_certificate(crt) p7.add_data(data) At least my signature is as big as the input file then… no matter if I say "DETACHED" or "BINARY" in the example above. > > Try OpenSSL::Digest::SHA512.new, Digest is not the same as > Openssl::Digest. > irb> Digest.class > => Module > irb> OpenSSL::Digest.class > => Class >> Digest.class NameError: uninitialized constant Digest from (irb):11 >> OpenSSL::Digest.class => Module irb 0.9.5(05/04/13) ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0] Mac OS X 10.5.6, Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 Cheers, Yves