AS2 - Decrypt/Verify message

Declaration

<AMAS2 ACTIVITY="decode_message" AS2MESSAGE="text" DATAFILE="text" RESULTVARIABLE="text" RESULTDATASET="text" ERRORDATASET="text" USEEMBEDDED="YES/NO" USELOCAL="YES/NO" VERIFYMESSAGEDIGEST="YES/NO"><DECRYPT CERTIFICATE="text" KEY="text" PASSPHRASE="text (encrypted)" /><VERIFY CERTIFICATE="text" PASSPHRASE="text (encrypted)" /></AMAS2>

Related Topics    

Description

Decrypts and verifies an AS2 message.

Practical usage

Used to decompile code written in AS2 and verify that the signature wrapper in the AS2 message is valid.

Parameters

General

Property Type Required Default Markup Description
AS2 message file Text Yes (Empty) AS2MESSAGE="C:\folder1\filename.as2m" Specifies the location of the message file to decode/verify. All AS2 messages must derive from a specific file. This file contains extra fields such as From, To, and Data File. The full path and file name can be entered manually in the provided field or you can click the Folder icon to navigate to the file.
Data file Text Yes (Empty) DATAFILE="C:\folder2\filename.bin" Specifies the location of the AS2 data file to decode/verify.
Overwrite existing file Yes/No No Yes OVERWRITEFILE="NO" If selected, indicates that if an existing file with the same name already exists, it will be overwritten. This parameter is selected by default.
Populate variable with result Text No (Empty) RESULTVARIABLE="varName" The name of an existing variable to populate with decrypt/verification results.
Populate dataset with message information Text No (Empty) RESULTDATASET="theDataset" The name of the dataset to create and populate with AS2 message information. For more details, see Datasets below.
Populate dataset with error information Text No (Empty) ERRORDATASET="errorData" The name of the dataset to create and populate with AS2 error information. For more details, see Datasets below.

Decrypt Data

Property Type Required Default Markup Description
Certificate Text No (Empty) CERTIFICATEPATH="C:\temp\cert_file.cer" The location of the certificate file used to decode the message.
Key Text No (Empty) KEY="C:\temp\key_file.key" The location of the key file used to decode the message.
Passphrase Text No (Empty) PASSPHRASE="encrypted_text" The passphrase associated with the certificate file to decode.

Verify Signature

Property Type Required Default Markup Description
Certificate Text No (Empty) CERTIFICATEPATH="C:\temp\cert_file.cer" The location of the certificate file to verify.
Passphrase Text No (Empty) PASSPHRASE="encrypted_text" The passphrase associated with the certificate file to verify.
Use embedded certificate(s) Yes/No No No USEEMBEDDED="YES" If selected, specifies that embedded certificates will be used. This parameter is disabled by default.
Use local certificates Yes/No No No USELOCAL="YES" If selected, specifies that local certificates will be used. This parameter is disabled by default.
Verify message digests Yes/No No No VERIFYMESSAGEDIGEST="YES" If selected, specifies that message digests will also be verified. This parameter is disabled by default.

Description

Error Causes

On Error

Additional Information

Datasets

A dataset is a multiple column, multiple row container object. This activity creates and populates a two datasets, one with message information and the other with error information (see tables below).

Message Information Dataset

Name Type Return Value
InfoData.AS2From Text The AS2-From AS2 header value that represents the sender’s name.
InfoData.AS2To Text The AS2-To AS2 header value that represents the receiver’s name.
InfoData.Date Date The date of the incoming message (for example, 1/1/2022 12:00:00 AM).
InfoData.Encryption True/False Indicates whether the incoming AS2 message was encrypted (True or False).
InfoData.FileName Text Contains the original file name of the message. This context property will only be populated if the incoming message includes file name information as part of the Content-Disposition MIME header.
InfoData.MessageID Text The AS2 Message ID that is included in the headers of the AS2 message.
InfoData.ReceiptRequest True/False Indicates whether the incoming AS2 message was signed (True or False).
InfoData.Signature True/False Indicates whether the incoming AS2 message was signed (True or False).
InfoData.Subject Text The subject of the incoming message.

Error Information Dataset

Name Type Return Value
ErrData.Code Text The error code.
ErrData.Description Text The description of the error.
ErrData.Summary Text The error summary.
ErrData.Type Text The error type.

Example

NOTE:
  • Copy and paste the sample AML code below directly into the Task Builder Steps Panel.
  • To successfully run the sample code, update parameters containing user credentials, files, file paths, or other information specific to the task to match your environment.

Description

This sample task decrypts/verifies an AS2 messageand then stores the message data into a file.

Copy
<AMAS2 ACTIVITY="decode_message" AS2MESSAGE="C:\AS2\Files\SendMessage.as2m" DATAFILE="C:\temp\datafile.xml" RESULTDATASET="InfoDataset" ERRORDATASET="ErrDataset" />