Skip to content

Instantly share code, notes, and snippets.

@tncbbthositg
Created August 13, 2015 15:50
Show Gist options
  • Save tncbbthositg/bd75e4eed234372d1cf3 to your computer and use it in GitHub Desktop.
Save tncbbthositg/bd75e4eed234372d1cf3 to your computer and use it in GitHub Desktop.
Compute SES SMTP password from AWS secret key
#!/usr/bin/env ruby
require 'openssl'
require 'base64'
key = ARGV[0]
message = 'SendRawEmail'
version = 0x02
digest = OpenSSL::Digest.new('sha256')
signature = OpenSSL::HMAC.digest(digest, key, message)
signature_and_version = version.chr + signature
smtp_password = Base64.encode64(signature_and_version)
puts "smtp password:\n#{smtp_password}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment