# Openssl help

**URL:** <https://www.ruby-forum.com/t/openssl-help/95025>\
**Category:** Ruby\
**Created:** [December 3, 2005, 10:46pm UTC](https://www.ruby-forum.com/t/openssl-help/95025 "2005-12-03T22:46:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rooster](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/71c47a/32.png) [@rooster](https://www.ruby-forum.com/u/rooster)\
**Post date:** [December 3, 2005, 10:46pm UTC](https://www.ruby-forum.com/t/openssl-help/95025/1 "2005-12-03T22:46:33Z")

</div>

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:

```auto
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
