Discuss this help topic in SecureBlackbox Forum
EDI: Process the received AS2/AS3 receipt
It's recommended to process incoming receipts the following way:
Examples:
C#:
TElAS2Receipt receipt = new TElAS2Receipt();
// use only local certificates to verify receipts signatures
receipt.Signature.VerificationOptions |= SBMessages.Unit.voUseLocalCerts;
receipt.Signature.VerificationOptions &= ~SBMessages.Unit.voUseEmbeddedCerts;
// create an empty storage, the appropriate certificate will be loaded later
receipt.Signature.CertStorage = new TElMemoryCertStorage();
// create an event handler which will load the necessary certificate
// to the empty certificate storage
receipt.OnVerifyIDs += delegate(Object sender, TElASMessageVerifier verifier)
{
// load certificate of the specified signer
// (LoadLocalCertificate method has to be created)
LoadLocalCertificate(
// where to load the necessary certificate
receipt.Signature.CertStorage,
// ID of the certificate which signed the receipt
(verifier as TElASSMIMEMessageVerifier).Verifier.get_CertIDs(0)
);
};
// actually load the receipt
if (!receipt.Load(receiptStream))
{
// there were some issues while loading the receipt
// check if the receipt is signed and if the signature is valid
if (receipt.Signature.Enabled &&
receipt.Signature.VerificationResult != 0)
{
Console.WriteLine("Failed to verify receipt signature: {0}",
receipt.Signature.VerificationResult);
}
}
// check the reported issues
if (receipt.Errors.Count != 0)
{
Console.WriteLine("The following issues reported for the original message:");
int i = 0;
while (i < receipt.Errors.Count)
Console.WriteLine("{0}: {1}", receipt.Errors[i].Modifier,
receipt.Errors[i].Summary);
}