From: Chris Catton Date: 2006-12-22T18:26:43+09:00 Subject: help please - openssl and ruby Hi, I've run into a problem using openssl and ruby, which I can't solve. I have a public key, a text string, and a signature, and I want to check that the signature was created from the text string using the appropriate private key. On the command line i can do openssl sha1 -sha512 -verify /tmp/public.pem -signature /tmp/signatureValue.bin /tmp/signatureText.bin and I get 'Verified OK' I want to do the same in ruby. I can create the hash ok, but when I run pkey=OpenSSL::PKey::RSA.new( Base64.decode64(File.read('/tmp/public.pem'))) p pkey.verify( OpenSSL::Digest::SHA512.new, signatureValue, signatureText ) I get 'false' Examining the key, I notice that before it is loaded into the OpenSSL object the key reads -----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7p.. but when I print the key out after creating the OpenSSL object i get -----BEGIN RSA PUBLIC KEY----- MIIBCgKCAQEA7p.. ie a chunk (MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8) has gone missing from the front of the key. I guess this might be the source of my problem, but try as I might I can't find anything about what is going on here. I'm no great SSL expert, and I'd love to get this done before christmas, so if anyone can help it would really be appreciated. thanks chris -- Posted via http://www.ruby-forum.com/.