Class MessageValidator
Uses openssl to verify SNS messages to ensure that they were sent by AWS.
Methods Summary
-
__construct ( callable $certClient = null, string $hostNamePattern = '' )
Constructs the Message Validator object and ensures that openssl is installed.
-
validate ( Aws\Sns\Message $message )
Validates a message from SNS to ensure that it was delivered by AWS.
-
isValid ( Aws\Sns\Message $message )
Determines if a message is valid and that is was delivered by AWS. This method does not throw exceptions and returns a simple boolean value.
-
getStringToSign ( Aws\Sns\Message $message )
Builds string-to-sign according to the SNS message spec.
Methods Details
__construct ( callable $certClient = null, string $hostNamePattern = '' )
Constructs the Message Validator object and ensures that openssl is installed.
Parameters
callable | $certClient = null | Callable used to download the certificate.
Should have the following function signature:
|
string | $hostNamePattern = '' |
validate (
Aws\Sns\Message
$message
)
Validates a message from SNS to ensure that it was delivered by AWS.
Parameters
Aws\Sns\Message |
$message | Message to validate. |
Exceptions
Aws\Sns\Exception\InvalidSnsMessageException If the cert cannot be retrieved or its source verified, or the message signature is invalid. |
boolean
isValid (
Aws\Sns\Message
$message
)
Determines if a message is valid and that is was delivered by AWS. This method does not throw exceptions and returns a simple boolean value.
Parameters
Aws\Sns\Message |
$message | The message to validate |
Returns
boolean |
string
getStringToSign (
Aws\Sns\Message
$message
)
Builds string-to-sign according to the SNS message spec.
Parameters
Aws\Sns\Message |
$message | Message for which to build the string-to-sign. |
Returns
string |
Link
Constants summary
string |
SIGNATURE_VERSION_1
|
#
'1'
|
string |
SIGNATURE_VERSION_2
|
#
'2'
|