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