Last active
May 2, 2018 08:15
-
-
Save jakubboucek/c33f169dc33899d41b4534c73f1161c4 to your computer and use it in GitHub Desktop.
Convert AWS IAM credentials to SMTP credentials
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
<?php | |
if (!isset($argv[1])) { | |
echo 'You must key as command\'s parameter' . PHP_EOL; | |
die(1); | |
} | |
// by https://docs.aws.amazon.com/ses/latest/DeveloperGuide/smtp-credentials.html | |
$awsSecretAccessKey = $argv[1]; | |
$version = "\x02"; | |
$hash = hash_hmac('sha256', 'SendRawEmail', $awsSecretAccessKey, true); | |
$smtpPassword = base64_encode($version . $hash); | |
echo $smtpPassword . PHP_EOL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment