Skip to main content

verification_only

// Create Decoder with Verification-only sequencing
// When constructing an MteDec the second argument is
// the sequence window (the first is the timestamp window)
MteDec decoderV = new MteDec(0, 0);

// Instantiate the Decoder.
decoderV.SetEntropy(entropy);
decoderV.SetNonce(0);
status = decoderV.Instantiate(personal);
if (status != MteStatus.mte_status_success) {
Console.Error.WriteLine("Decoder instantiate error ({0}): {1}",
decoderV.GetStatusName(status),
decoderV.GetStatusDescription(status));
return (int)status;
}

// Output that decoding is in verification-only sequencing mode
Console.WriteLine("\nVerification-only mode (sequence window = 0):");

// Decode the first message
// Output: Decode #1: mte_status_success, message 1
decoded = decoderV.DecodeStrB64(encodings[0], out status);
Console.WriteLine("Decode #1: {0}, {1}",
decoderV.GetStatusName(status),
decoded);

// Try to decode the first message again -- out of sequence, should not work
// Output: Decode #1: mte_status_seq_outside_window,
decoded = decoderV.DecodeStrB64(encodings[0], out status);
Console.WriteLine("Decode #1: {0}, {1}",
decoderV.GetStatusName(status),
decoded);

// Decode the third message -- out of sequence should not work
// Output: Decode #3: mte_status_seq_outside_window,
decoded = decoderV.DecodeStrB64(encodings[2], out status);
Console.WriteLine("Decode #3: {0}, {1}",
decoderV.GetStatusName(status),
decoded);

// Decode the second message
// Output: Decode #2: mte_status_success, message 2
decoded = decoderV.DecodeStrB64(encodings[1], out status);
Console.WriteLine("Decode #2: {0}, {1}",
decoderV.GetStatusName(status),
decoded);

// Decode the third message
// Output: Decode #3: mte_status_success, message 3
decoded = decoderV.DecodeStrB64(encodings[2], out status);
Console.WriteLine("Decode #3: {0}, {1}",
decoderV.GetStatusName(status),
decoded);

// Decode the fourth message
// Output: Decode #4: mte_status_success, message 4
decoded = decoderV.DecodeStrB64(encodings[3], out status);
Console.WriteLine("Decode #4: {0}, {1}",
decoderV.GetStatusName(status),
decoded);