SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Openssl help

Hybrid View

  1. #1
    SitePoint Enthusiast Stevenwulf's Avatar
    Join Date
    May 2002
    Location
    Berkeley
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Openssl help

    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

  2. #2
    SitePoint Wizard samsm's Avatar
    Join Date
    Nov 2001
    Location
    Atlanta, GA, USA
    Posts
    5,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Using your unpaid time to add free content to SitePoint Pty Ltd's portfolio?

  3. #3
    SitePoint Enthusiast Stevenwulf's Avatar
    Join Date
    May 2002
    Location
    Berkeley
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Angry

    Thanks for the response, I actually used that snippet to get as far as I did, no dice though


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •