Skip to content

Instantly share code, notes, and snippets.

View w3iBStime's full-sized avatar

Brett Stime w3iBStime

View GitHub Profile
@w3iBStime
w3iBStime / DeriveSesSmtpPassword.py
Last active August 10, 2018 04:57
Python script to derive AWS SES SMTP passwords from IAM access secret keys using HMAC, SHA256 and Base64 per http://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html
import base64
import hmac
import hashlib
secret = "_____" # replace with the secret key to be hashed
message = "SendRawEmail"
sig_bytes = bytearray(b'\x02') # init with version
theHmac = hmac.new(secret.encode("ASCII"), message.encode("ASCII"), hashlib.sha256)