Botan  1.11.15
src/lib/mac/mac.h
Go to the documentation of this file.
00001 /*
00002 * Base class for message authentiction codes
00003 * (C) 1999-2007 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_MESSAGE_AUTH_CODE_BASE_H__
00009 #define BOTAN_MESSAGE_AUTH_CODE_BASE_H__
00010 
00011 #include <botan/buf_comp.h>
00012 #include <botan/sym_algo.h>
00013 #include <botan/scan_name.h>
00014 #include <string>
00015 
00016 namespace Botan {
00017 
00018 /**
00019 * This class represents Message Authentication Code (MAC) objects.
00020 */
00021 class BOTAN_DLL MessageAuthenticationCode : public Buffered_Computation,
00022                                             public SymmetricAlgorithm
00023    {
00024    public:
00025       /**
00026       * Verify a MAC.
00027       * @param in the MAC to verify as a byte array
00028       * @param length the length of param in
00029       * @return true if the MAC is valid, false otherwise
00030       */
00031       virtual bool verify_mac(const byte in[], size_t length);
00032 
00033       /**
00034       * Get a new object representing the same algorithm as *this
00035       */
00036       virtual MessageAuthenticationCode* clone() const = 0;
00037 
00038       /**
00039       * Get the name of this algorithm.
00040       * @return name of this algorithm
00041       */
00042       virtual std::string name() const = 0;
00043 
00044       typedef SCAN_Name Spec;
00045    };
00046 
00047 }
00048 
00049 #endif