openssl help

S

Steven Hansen

Hi, I'm trying to use ruby's openssl library to verify a DSA
signature....I think. Anyway, the openssl library does not seem to have
much documentation so I'm not sure what I'm doing wrong. Here is what
I'm trying to accomplish.

1) Receive a cleartext authtoken: AWSAuthToken
2) Receive base64-encoded signature of a SHA-1 hash of the authtoken:
AWSSignatureBase64
3) Base64-decode AWSSignatureBase64, to obtain the DSA signature of the
hash of the authtoken: DSASignature
4) Provide the DSASignature and AWSAuthToken as input to a DSA signature
verification method using the SHA-1 hashing algorithm and a public key
file.
5) The verification method should indicate that the signature was, in
fact, made with the AWS private key, applied to the hash of the
authtoken.

Here is how I'm trying to accomplish this in ruby:

Code:
aws_pub_key_file = '/srv/www/work/softdist/app/apis/AWSPublicKey3'

str = ''
File.open(aws_pub_key_file) do |f|
f.each do |line|
str += line
end
end

aws_sig_base_64 = params[:AWSSignatureBase64]
aws_auth_token = params[:AWSAuthToken]
decoded_dsa_sig = Base64.decode64(aws_sig_base_64)
public_key = OpenSSL::PKey::DSA.new(str)
public_key.verify(OpenSSL::Digest::SHA1.new, aws_auth_token,
decoded_dsa_sig)

When I make the call to public_key.verify the script bombs an spits ot
the following error:
"wrong public key type"

Any ideas?

Is there any known source of documentation for the openssl library?

Thanks,
Steven
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top