Module Simplepay::Authentication
In: lib/simplepay/authentication.rb
RuntimeError Error Service Standard Marketplace Donation Subscription MarketplacePolicy Interval SubscriptionPeriod BillingFrequency Comparable Field Service Epoch Currency Amount Boolean ResponseStatusCode Services Authentication FormHelper NotificationHelper RailsHelper Helpers Interval Currency Support Boolean Simplepay dot/f_2.png

This module generates RFC-2104-compliant HMAC signatures. These signatures are used by both Amazon and you to determine whether or not data transmitted is authentic. The hash is based on the amazon secret access key, which is a trusted secret between both parties.

HMAC (RFC-2104 Specification)

For more information about the RFC-2104 spec, see


Public Class methods


# File lib/simplepay/authentication.rb, line 25
      def authentic?(hash_data, signature, secret_access_key = Simplepay.aws_secret_access_key)
        signature == generate(hash_data, secret_access_key)


# File lib/simplepay/authentication.rb, line 21
      def generate(hash_data, secret_access_key = Simplepay.aws_secret_access_key)
        encode(digest(convert_to_string(hash_data), secret_access_key))