Botan  1.11.15
src/lib/pubkey/rw/rw.h
Go to the documentation of this file.
00001 /*
00002 * Rabin-Williams
00003 * (C) 1999-2007 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_RW_H__
00009 #define BOTAN_RW_H__
00010 
00011 #include <botan/if_algo.h>
00012 
00013 namespace Botan {
00014 
00015 /**
00016 * Rabin-Williams Public Key
00017 */
00018 class BOTAN_DLL RW_PublicKey : public virtual IF_Scheme_PublicKey
00019    {
00020    public:
00021       std::string algo_name() const { return "RW"; }
00022 
00023       RW_PublicKey(const AlgorithmIdentifier& alg_id,
00024                    const secure_vector<byte>& key_bits) :
00025          IF_Scheme_PublicKey(alg_id, key_bits)
00026          {}
00027 
00028       RW_PublicKey(const BigInt& mod, const BigInt& exponent) :
00029          IF_Scheme_PublicKey(mod, exponent)
00030          {}
00031 
00032    protected:
00033       RW_PublicKey() {}
00034    };
00035 
00036 /**
00037 * Rabin-Williams Private Key
00038 */
00039 class BOTAN_DLL RW_PrivateKey : public RW_PublicKey,
00040                                 public IF_Scheme_PrivateKey
00041    {
00042    public:
00043       RW_PrivateKey(const AlgorithmIdentifier& alg_id,
00044                     const secure_vector<byte>& key_bits,
00045                     RandomNumberGenerator& rng) :
00046          IF_Scheme_PrivateKey(rng, alg_id, key_bits) {}
00047 
00048       RW_PrivateKey(RandomNumberGenerator& rng,
00049                     const BigInt& p, const BigInt& q,
00050                     const BigInt& e, const BigInt& d = 0,
00051                     const BigInt& n = 0) :
00052          IF_Scheme_PrivateKey(rng, p, q, e, d, n) {}
00053 
00054       RW_PrivateKey(RandomNumberGenerator& rng, size_t bits, size_t = 2);
00055 
00056       bool check_key(RandomNumberGenerator& rng, bool) const;
00057    };
00058 
00059 }
00060 
00061 #endif