Botan  1.11.15
src/lib/misc/srp6/srp6_files.h
Go to the documentation of this file.
00001 /*
00002 * SRP-6a File Handling
00003 * (C) 2011 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_SRP6A_FILES_H__
00009 #define BOTAN_SRP6A_FILES_H__
00010 
00011 #include <botan/bigint.h>
00012 #include <string>
00013 #include <map>
00014 
00015 namespace Botan {
00016 
00017 /**
00018 * A GnuTLS compatible SRP6 authenticator file
00019 */
00020 class BOTAN_DLL SRP6_Authenticator_File
00021    {
00022    public:
00023       /**
00024       * @param filename will be opened and processed as a SRP
00025       * authenticator file
00026       */
00027       SRP6_Authenticator_File(const std::string& filename);
00028 
00029       bool lookup_user(const std::string& username,
00030                        BigInt& v,
00031                        std::vector<byte>& salt,
00032                        std::string& group_id) const;
00033    private:
00034       struct SRP6_Data
00035          {
00036          SRP6_Data() {}
00037 
00038          SRP6_Data(const BigInt& v,
00039                    const std::vector<byte>& salt,
00040                    const std::string& group_id) :
00041             v(v), salt(salt), group_id(group_id) {}
00042 
00043          BigInt v;
00044          std::vector<byte> salt;
00045          std::string group_id;
00046          };
00047 
00048       std::map<std::string, SRP6_Data> entries;
00049    };
00050 
00051 }
00052 
00053 #endif