Botan  1.11.15
src/lib/pubkey/nr/nr.h
Go to the documentation of this file.
00001 /*
00002 * Nyberg-Rueppel
00003 * (C) 1999-2010 Jack Lloyd
00004 *
00005 * Botan is released under the Simplified BSD License (see license.txt)
00006 */
00007 
00008 #ifndef BOTAN_NYBERG_RUEPPEL_H__
00009 #define BOTAN_NYBERG_RUEPPEL_H__
00010 
00011 #include <botan/dl_algo.h>
00012 
00013 namespace Botan {
00014 
00015 /**
00016 * Nyberg-Rueppel Public Key
00017 */
00018 class BOTAN_DLL NR_PublicKey : public virtual DL_Scheme_PublicKey
00019    {
00020    public:
00021       std::string algo_name() const { return "NR"; }
00022 
00023       DL_Group::Format group_format() const { return DL_Group::ANSI_X9_57; }
00024 
00025       size_t message_parts() const { return 2; }
00026       size_t message_part_size() const { return group_q().bytes(); }
00027       size_t max_input_bits() const { return (group_q().bits() - 1); }
00028 
00029       NR_PublicKey(const AlgorithmIdentifier& alg_id,
00030                    const secure_vector<byte>& key_bits);
00031 
00032       NR_PublicKey(const DL_Group& group, const BigInt& pub_key);
00033    protected:
00034       NR_PublicKey() {}
00035    };
00036 
00037 /**
00038 * Nyberg-Rueppel Private Key
00039 */
00040 class BOTAN_DLL NR_PrivateKey : public NR_PublicKey,
00041                                 public virtual DL_Scheme_PrivateKey
00042    {
00043    public:
00044       bool check_key(RandomNumberGenerator& rng, bool strong) const;
00045 
00046       NR_PrivateKey(const AlgorithmIdentifier& alg_id,
00047                     const secure_vector<byte>& key_bits,
00048                     RandomNumberGenerator& rng);
00049 
00050       NR_PrivateKey(RandomNumberGenerator& rng,
00051                     const DL_Group& group,
00052                     const BigInt& x = 0);
00053    };
00054 
00055 }
00056 
00057 #endif