GMac

Special case of GCMCipher where no data gets encrypted but all processed as AAD.

Members

Functions

finish
void finish(ubyte[] output)

close the MAC, producing the final MAC value. The doFinal call leaves the MAC reset().

put
void put(ubyte[] input)

update the MAC with a block of bytes.

reset
void reset()

reset the digest back to it's initial state.

start
void start(ubyte[] key, ubyte[] nonce)
Undocumented in source. Be warned that the author may not have intended to support it.

Manifest constants

macSize
enum macSize;
Undocumented in source.

Properties

name
string name [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

simple usage of GMac with test vectors from http://www.ieee802.org/1/files/public/docs2011/bn-randall-test-vectors-0511-v1.pdf, section 2.1.1

t {

	import dcrypt.crypto.engines.aes;
	
	alias const(ubyte)[] octets;
	
	octets key = cast(octets)x"AD7A2BD03EAC835A6F620FDCB506B345";
	octets iv = cast(octets)x"12153524C0895E81B2C28465"; 

	auto gmac = new GMac!AES();
	gmac.start(key, iv);
	
	
	octets aad = cast(octets)(
		x"D609B1F056637A0D46DF998D88E5222A
          B2C2846512153524C0895E8108000F10
          1112131415161718191A1B1C1D1E1F20
          2122232425262728292A2B2C2D2E2F30
          313233340001"
		);

	gmac.put(aad);
	
	ubyte[] outbuf = new ubyte[gmac.macSize];

	gmac.finish(outbuf);
	
	octets expectedMac = cast(octets) (x"F09478A9B09007D06F46E9B6A1DA25DD");

	assert(outbuf == expectedMac

Meta

Standards

NIST Special Publication 800-38D