• Main Page
  • Classes
  • Files
  • File List
  • File Members

Beesnest/Windows/DcCrypto.h

Go to the documentation of this file.
00001 /*
00002 Copyright 2007 Erez Bibi (erezbibi@users.sourceforge.net)
00003 This file is part of Beesnest.
00004 
00005 Beesnest is free software; you can redistribute it and/or modify
00006 it under the terms of the GNU General Public License as published by
00007 the Free Software Foundation; either version 2 of the License, or
00008 (at your option) any later version.
00009 
00010 Beesnest is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License
00016 along with Beesnest; if not, write to the Free Software
00017 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018 */
00019 
00020 /* DcCrypto.h: interface for the CdcCrypto class. */
00021 
00022 #ifndef CDC_CRYPTO
00023 #define CDC_CRYPTO
00024 
00025 #include "../DcGlobals.h"
00026 #include "../DcException.h"
00027 
00028 /**
00029  * This static class implements some cryptographic functions I need.
00030  */
00031 
00032 class CdcCrypto
00033 {
00034 private:
00035 
00036     /** Handle to the Crypto service provider. */
00037     static HCRYPTPROV hProv;
00038 
00039 public:
00040 
00041     /**
00042      * Initialize the class.
00043      */
00044     static void Init ();
00045 
00046     /**
00047      * Destroy the class.
00048      */
00049     static void Destroy ();
00050 
00051     /**
00052      * This function returns a cryptographic secure random string of length
00053      * <b>len</b>.
00054      * <p>
00055      * @param len The length of the required string.
00056      * @return (CdcString) Random string of length <b>len</b>.
00057      * @throw (CdcException) If cannot generate a random string.
00058      */
00059     static CdcString GetRandomString (int len = 16);
00060 
00061 
00062     /**
00063      * This function makes a hash string from a buffer.
00064      * <p>
00065      * @param buff String of the buffer to make the hash code from.
00066      * @return (CdcString) The string of the hash result.
00067      * @throw (CdcException) If cannot make the hash.
00068      */
00069     static CdcString MakeHash (const CdcString& buff);
00070 
00071 };
00072 
00073 #endif /* CDC_CRYPTO */

Generated on Mon Oct 11 2010 16:23:25 for Beesnest by  doxygen 1.7.2