|
This example shows how to access the TrustedX
encryption and decryption service in a RESTful way in order to encrypt a message, so that the result is obtained in a CMS (RFC
3852) EnvelopedData structure.
The HTTP POST action is used to ask the trustedx-sgw/cms/encryption
resource, located in the labs.safelayer.com site,
to encrypt the following message according to the EnvelopedData
format:
"La libertad, querido
Sancho, es el don más preciado que dieron los cielos a los hombres".
This message is encoded in base64 in
the <Base64Data> element
of the request being sent (in the message-body).
Please note that the servicePolicy
parameter in the URI is used to specify the
policy under which the encryption is wanted to be performed (txDemoEncryptPolicy). Likewise, the recipient
parameter specifies the Distinguished
Name of the legitimate recipient that the data are intended for.
POST trustedx-sgw/cms/encryption?servicePolicy=txDemoEncryptPolicy HTTP/1.1 Host: labs.safelayer.com Content-Length: 141 Content-Type: application/x-trustedx-data+xml
<Base64Data>TGEgbGliZXJ0YWQsIHF1ZXJpZG8gU2FuY2hvLCBlcyBlbCBkb24gbeFzIHByZWNpYWRvIHF1ZSBkaWVyb24gbG9zIGNpZWxvcyBhIGxvcyBob21icmVz</Base64Data>
| | | | | | | |
|
The following explanation refers to the response
given by TrustedX when it receives the previous request. Consequently, click on
Try for TrustedX to generate this
response.
As you can see, the response consists of a
base64
encoding (<Base64Envelope>
element) of the CMS EnvelopedData
structure that contains the result produced by the encryption of the data that was sent in the request.
Note:
To implement this example, the TrustedX SmartGateway
component must be configured properly. See REST HowTo for an explanation on how to perform this.
|