From: Rolando Abarca Date: 2008-04-17T07:33:56+09:00 Subject: Re: OpenSSL with Ruby On Apr 16, 2008, at 6:16 PM, vaibhavb wrote: > hi all - > > I'm not sure if this is the correct forum but i was wondering if > anyone has successfully done RSA-SHA1 signing with Ruby OpenSSL and > interoperated with Java Servers. > > I'm using the following code but i'm not sure if the "sign" method on > works properly - > > @key = OpenSSL::PKey::RSA.new(2048) > #sign > @key.send("sign", OpenSSL::Digest.::SHA1.new, "text to sign") > > The expected signature from above "sign" is not what i know the Java > crytpo api likes. > > Thanks in advance. after digging forums and searching through the source, this is what i'm doing to sign: digest = OpenSSL::Digest::SHA1.new(text_to_sign) sign = key.private_encrypt(digest) # sign is what you want, if you need it in Base64: enc_sign = Base64.encode64(sign) > regards, > Vaibhav regards, -- Rolando Abarca M.