Discuss this help topic in SecureBlackbox Forum

EDI: Process the received AS2/AS3 receipt

It's recommended to process incoming receipts the following way:

  1. Load a receipt by calling TElASReceipt.Load() method. All issues will be reported via OnError event. There can be critical issues (if the receipt cannot be parsed or decoded) and non-critical ones. Each issue can be ignored from within the event handler. By default, critical issues are not ignored and non-critical are ignored. It's possible to change the default reaction in OnError event handler. If an issue is not ignored, an exception is thrown. Load() method returns false if there were non-critical issue during message parsing or critical issues were ignored from within the event handler.
  2. Check the receipt signature verification result. Receipt signatures are processed absolutely the same way as message signatures. For details, see "Verify a signature of an AS2/AS3 message" topic. Check the reported issues that have occurred with the original message.
  3. Examples:


    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)
            // where to load the necessary certificate
            // 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}",
    // 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,

    How To articles about AS2 and AS3 messages

    Discuss this help topic in SecureBlackbox Forum