From 10900175029448c69e178b68b50138d027a4452c Mon Sep 17 00:00:00 2001 From: Vincent Nikkelen Date: Tue, 13 Oct 2020 15:14:18 +0200 Subject: [PATCH] Enforce use of Signature Version 4 as version 3 isn't supported by AWS anymore. (#79) Keeping parameters for BW compatibility reasons. --- src/SimpleEmailService.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/SimpleEmailService.php b/src/SimpleEmailService.php index f36bd69..7d568e3 100644 --- a/src/SimpleEmailService.php +++ b/src/SimpleEmailService.php @@ -57,7 +57,7 @@ class SimpleEmailService const AWS_US_WEST_2 = 'email.us-west-2.amazonaws.com'; const AWS_EU_WEST1 = 'email.eu-west-1.amazonaws.com'; - const REQUEST_SIGNATURE_V3 = 'v3'; + const REQUEST_SIGNATURE_V3 = 'v4'; // For BW compatibility reasons. const REQUEST_SIGNATURE_V4 = 'v4'; /** @@ -114,8 +114,9 @@ class SimpleEmailService * @param string $host Amazon Host through which to send the emails * @param boolean $trigger_errors Trigger PHP errors when AWS SES API returns an error * @param string $requestSignatureVersion Version of the request signature + * Currently only V4 supported by AWS. Keeping parameter for BW compatibility reasons. */ - public function __construct($accessKey = null, $secretKey = null, $host = self::AWS_US_EAST_1, $trigger_errors = true, $requestSignatureVersion = self::REQUEST_SIGNATURE_V3) { + public function __construct($accessKey = null, $secretKey = null, $host = self::AWS_US_EAST_1, $trigger_errors = true, $requestSignatureVersion = self::REQUEST_SIGNATURE_V4) { if ($accessKey !== null && $secretKey !== null) { $this->setAuth($accessKey, $secretKey); } @@ -127,17 +128,21 @@ public function __construct($accessKey = null, $secretKey = null, $host = self:: /** * Set the request signature version * - * @param string $requestSignatureVersion + * @param string $requestSignatureVersion Value is ignored and V4 is used. This for BW compatibility. * @return SimpleEmailService $this + * + * @deprecated Currently only V4 supported. */ public function setRequestSignatureVersion($requestSignatureVersion) { - $this->__requestSignatureVersion = $requestSignatureVersion; + $this->__requestSignatureVersion = self::REQUEST_SIGNATURE_V4; return $this; } /** * @return string + * + * @deprecated Not relevant when only V4 is supported. */ public function getRequestSignatureVersion() { return $this->__requestSignatureVersion;