Created
August 13, 2015 15:50
-
-
Save tncbbthositg/bd75e4eed234372d1cf3 to your computer and use it in GitHub Desktop.
Compute SES SMTP password from AWS secret key
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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