rsa_crypto.h

Go to the documentation of this file.
00001 #ifndef RSA_CRYPTO_CLASS
00002 #define RSA_CRYPTO_CLASS
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : RSA public key encryption                                         *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *******************************************************************************
00010 * Copyright (c) 2005-$now By Author.  This program is free software; you can  *
00011 * redistribute it and/or modify it under the terms of the GNU General Public  *
00012 * License as published by the Free Software Foundation; either version 2 of   *
00013 * the License or (at your option) any later version.  This is online at:      *
00014 *     http://www.fsf.org/copyleft/gpl.html                                    *
00015 * Please send any updates to: fred@gruntose.com                               *
00016 \*****************************************************************************/
00017 
00018 #include "crypto_dll.h"
00019 
00020 #include <basis/object_base.h>
00021 
00022 // forward.
00023 struct rsa_st;
00024 
00026 
00030 class CRYPTO_CLASS_STYLE RSA_crypto : public virtual object_base
00031 {
00032 public:
00033   RSA_crypto(int key_size);
00035 
00038   RSA_crypto(const byte_array &key);
00040 
00045   RSA_crypto(rsa_st *key);
00047 
00048   RSA_crypto(const RSA_crypto &to_copy);
00049 
00050   virtual ~RSA_crypto();
00051 
00052   const RSA_crypto &operator = (const RSA_crypto &to_copy);
00053 
00054   IMPLEMENT_CLASS_NAME("RSA_crypto");
00055 
00056   bool set_key(byte_array &key);
00058 
00062   bool set_key(rsa_st *key);
00064 
00066   bool check_key(rsa_st *key);
00068 
00069   bool public_encrypt(const byte_array &source, byte_array &target) const;
00071 
00074   bool private_decrypt(const byte_array &source, byte_array &target) const;
00076 
00077   bool private_encrypt(const byte_array &source, byte_array &target) const;
00079 
00082   bool public_decrypt(const byte_array &source, byte_array &target) const;
00084 
00085   bool public_key(byte_array &pubkey) const;
00087   bool private_key(byte_array &privkey) const;
00089 
00091   static rsa_st *generate_key(int key_size);
00093 
00094 private:
00095   rsa_st *_key;  
00096 };
00097 
00098 #endif
00099 

Generated on Fri Nov 21 04:29:40 2008 for HOOPLE Libraries by  doxygen 1.5.1