| « PreviousNext » | |
![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
Amazon provides samples in four programming languages which show you how to perform a
server-side verification of the signatures in both the return URL and in IPN notifications. In
this section, we will briefly go over the essential details of the Java version only. The other samples differ only in the
programming language used for rendering them. For specific comprehensive information on a
particular sample, see its IPNAndReturnURLValidation.html file.
Each IPNAndReturnURLValidation sample contains three primary components in the src/com/amazonaws/ipnreturnurlvalidation folder. These
are:
|
File |
Description |
|---|---|
|
|
This class contains the program entry point for verifying the signature
contained in a return URL, and thereby validating the return URL content. It
sets up initial parameter values for return URL responses, and then calls the static method
|
IPNVerificationSampleCode.java | This class contains the program entry point for verifying the signature
contained in an IPN notification. It sets up initial parameter values for IPN notifications, and then calls the
static method SignatureUtilsForOutbound .validateRequest with
those values. |
SignatureUtilsForOutbound.java | Invoked from ReturnUrlVerificationSampleCode.java and
IPNVerificationSampleCode.java, this class uses the
signature version 2 process to validate the signature. It contains methods to
reassemble the string to sign, URL encode the string, and sign it using the Amazon
certificate listed as the signer. Finally, it validates the signature and prints
the result to standard out. |
Note
This following describes the Java sample only. The files for the C#, Perl, and PHP IPN and ReturnUrl Validation samples are listed in Locations of the IPNAndReturnURLValidation Files in Other SDKs
In addition to these primary components, a sample may include other required resources. For
example, the Java samples all include the third-party folder, the jar files of which must be in your
classpath in order to compile the sample.
To use the sample, do the following
Using the IPNAndReturnURLValidation Sample
| 1 |
Set up your programming environment so that the program will compile without
warnings or errors. For the Java sample, this includes ensuring that the
|
| 2 |
The |
| 3 | Compile the sample. For example, if you are including the $javac -cp
.:On Windows, you would type $javac -cp .; |
| 4 | Run the sample. Continuing the previous example, on linux, you would type $javac -cp .:On Windows, you would type $javac -cp .;
The result "Is signature correct: true" is printed to standard out if the verification determines the signature to be valid. |