Forum: Ruby openssl help

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
4034df6027cbecf3f4a19a711a248536?d=identicon&s=25 Steven Hansen (rooster)
on 2005-12-03 22:46
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:
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
5) The verification method should indicate that the signature was, in
fact, made with the AWS private key, applied to the hash of the

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

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

str = '' do |f|
	f.each do |line|
		str += line

aws_sig_base_64 = params[:AWSSignatureBase64]
aws_auth_token = params[:AWSAuthToken]
decoded_dsa_sig = Base64.decode64(aws_sig_base_64)
public_key =
public_key.verify(, aws_auth_token,

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?

This topic is locked and can not be replied to.