31.01.2014 Views

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

10.5 Authentication ( OMACCoder )<br />

1. Definition<br />

<strong>The</strong> class OMACCoder can be used for authentication. It implements the One-Key CBC<br />

MAC algorithm by Iwata and Kurosawa [49]. A MAC (= message authentication code)<br />

is a kind of checksum that is generated for a message m. In contrast to a usual checksum<br />

a MAC does not only depend on m but also on a secret key k. A MAC can be used if a<br />

sender wants to transfer m through an insecure channel to a receiver. If the sender also<br />

transmits the MAC then the receiver can verify that m has not been altered and that it<br />

originates from someone who knows k.<br />

Important: OMACCoder does not encipher or decipher any data, it only computes and<br />

verifies MACs!<br />

<strong>The</strong> behaviour of this coder depends on the MAC in stream flag. If it is false then encoding<br />

and decoding are equivalent: Both methods copy the source stream to the target stream<br />

and compute a MAC. If the flag is true then in encoding mode the source stream is copied<br />

to the target stream, a MAC is computed and appended to the target stream. In decoding<br />

mode the MAC at the end of source stream is removed and the original data is copied to<br />

the target stream, a MAC is computed and compared with the MAC found in the source<br />

stream. If the two MACs differ an error is signaled. <strong>The</strong> method MAC is valid may be<br />

used to check whether the source stream is authentic.<br />

<strong>The</strong> class OMACCoder< BlkCipher > is parameterized with a block-cipher BlkCipher,<br />

which can be one of the following: Rijndael (default), Blowfish, Twofish (see Section 10.3<br />

for more information). OMACCoder also supports fast seek operations (see Section 9.22).<br />

#include < <strong>LEDA</strong>/coding/authentication.h ><br />

2. Creation<br />

OMACCoder< BlkCipher > C(streambuf ∗ src stream = 0,<br />

streambuf ∗ tgt stream = 0, bool own streams = false);<br />

creates an instance C which uses the given source and target<br />

streams. If own streams is set, then C is responsible for the destruction<br />

of the streams, otherwise the pointers src stream and tgt stream<br />

must be valid during the life-time of C.<br />

OMACCoder< BlkCipher > C(const char ∗ src file name, const char ∗ tgt file name);<br />

creates an instance C which uses file-streams for input and output.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!