Created
November 15, 2018 20:42
-
-
Save devasat/f253e1bdc3ef65fbff8f24bd2f6a373e to your computer and use it in GitHub Desktop.
Convert AWS Secret Access Key to SES Password
This file contains hidden or 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
# Ref: https://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html | |
function awsSecretAccessKey2SesPassword () { | |
sesPassword=$((echo -en "\x02"; echo -n 'SendRawEmail' \ | |
| openssl dgst -sha256 -hmac "$1" -binary) \ | |
| openssl enc -base64); | |
encodedSesPassword=$(python -c "import urllib; print urllib.quote('''$sesPassword''','')"); | |
echo $encodedSesPassword; | |
} | |
# usage: awsSecretAccessKey2SesPassword $AWS_SECRET_ACCESS_KEY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment