Skip to content

Instantly share code, notes, and snippets.

@devasat
Created November 15, 2018 20:42
Show Gist options
  • Save devasat/f253e1bdc3ef65fbff8f24bd2f6a373e to your computer and use it in GitHub Desktop.
Save devasat/f253e1bdc3ef65fbff8f24bd2f6a373e to your computer and use it in GitHub Desktop.
Convert AWS Secret Access Key to SES Password
# 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