C# Class Amazon.SimpleNotificationService.Util.Message

This class reads in JSON formatted Amazon SNS messages into Message objects. The messages can also be verified using the IsMessageSignatureValid operation.
Show file Open project: aws/aws-sdk-net Class Usage Examples

Private Properties

Property Type Description
BuildNotificationStringToSign string
BuildSubscriptionStringToSign string
GetMessageBytesToSign byte[]
GetX509Certificate System.Security.Cryptography.X509Certificates.X509Certificate2
MakeGetRequest void
Message System
ValidateCertUrl string

Public Methods

Method Description
IsMessageSignatureValid ( ) : bool

Verifies the authenticity of a message sent by Amazon SNS. This is done by computing a signature from the fields in the message and then comparing the signature to the signature provided as part of the message.

ParseMessage ( string messageText ) : Message

Parses the JSON message from Amazon SNS into the Message object.

SubscribeToTopic ( ) : void

Uses the SubscribeURL property to subscribe to the topic

UnsubscribeFromTopic ( ) : void

Uses the UnsubscribeURL property to unsubscribe from the topic

Private Methods

Method Description
BuildNotificationStringToSign ( ) : string

Build the string to sign for SubscriptionConfirmation and UnsubscribeConfirmation messages.

BuildSubscriptionStringToSign ( ) : string

Build the string to sign for Notification messages.

GetMessageBytesToSign ( ) : byte[]
GetX509Certificate ( ) : X509Certificate2
MakeGetRequest ( string url, string action ) : void
Message ( ) : System
ValidateCertUrl ( string certUrl ) : string

Verifies that the signing certificate url is from a recognizable source. Returns the cert url if it cen be verified, otherwise throws an exception.

Method Details

IsMessageSignatureValid() public method

Verifies the authenticity of a message sent by Amazon SNS. This is done by computing a signature from the fields in the message and then comparing the signature to the signature provided as part of the message.
public IsMessageSignatureValid ( ) : bool
return bool

ParseMessage() public static method

Parses the JSON message from Amazon SNS into the Message object.
public static ParseMessage ( string messageText ) : Message
messageText string The JSON text from an Amazon SNS message
return Message

SubscribeToTopic() public method

Uses the SubscribeURL property to subscribe to the topic
public SubscribeToTopic ( ) : void
return void

UnsubscribeFromTopic() public method

Uses the UnsubscribeURL property to unsubscribe from the topic
public UnsubscribeFromTopic ( ) : void
return void