MACTripleDES Class
TOC
Collapse the table of content
Expand the table of content

MACTripleDES Class

Updated: February 2009

Computes a Message Authentication Code (MAC) using TripleDES for the input data CryptoStream.

Namespace:  System.Security.Cryptography
Assembly:  mscorlib (in mscorlib.dll)

public class MACTripleDES extends KeyedHashAlgorithm

A MAC can be used to determine whether a message sent over an insecure channel has been tampered with, provided that the sender and receiver share a secret key. The sender computes the MAC for the original data, and sends both as a single message. The receiver recomputes the MAC on the received message, and checks that the computed MAC matches the transmitted MAC.

Any change to the data or the MAC will result in a mismatch, because knowledge of the secret key is required to change the message and reproduce the correct MAC. Therefore, if the codes match, the message is authenticated.

MACTripleDES uses a key of length 16 or 24 bytes, and produces a hash sequence of length 8 bytes.

The following example creates a MAC for a file named input.txt, which is located in the folder that contains the sample executable. The MAC and the original text are written to a file named encrypted.hsh in the same folder. The signed file is then read, and the MAC is calculated for the text portion of the file and compared to the MAC contained with the text.

No code example is currently available or this language may not be supported.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

Date

History

Reason

February 2009

Replaced the example with a new example that round-trips a file and checks the text for tampering.

Customer feedback.

Community Additions

ADD
Show:
© 2016 Microsoft