ne7ssh_keys.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef NE7SSH_KEYS_H
00018 #define NE7SSH_KEYS_H
00019 #include <botan/pubkey.h>
00020 #include <botan/pem.h>
00021 #include <botan/dsa.h>
00022 #include <botan/rsa.h>
00023 #include <botan/numthry.h>
00024 #include <botan/der_enc.h>
00025 #include <botan/ber_dec.h>
00026
00027 #include "ne7ssh_types.h"
00028 #include "ne7ssh_string.h"
00029
00030 #define MAX_KEYSIZE 8192
00031
00032
00036 class ne7ssh_keys
00037 {
00038 private:
00039 Botan::DSA_PrivateKey *dsaPrivateKey;
00040 Botan::RSA_PrivateKey *rsaPrivateKey;
00041 ne7ssh_string publicKeyBlob;
00042 Botan::SecureVector<Botan::byte> signature;
00043
00044 uint8 keyAlgo;
00045
00052 bool getDSAKeys (char* buffer, uint32 size);
00053
00060 bool getRSAKeys (char* buffer, uint32 size);
00061
00062 public:
00063 enum keyAlgos { DSA, RSA };
00064
00068 ne7ssh_keys();
00069
00074 ~ne7ssh_keys();
00075
00084 bool generateDSAKeys (const char* fqdn, const char* privKeyFileName, const char* pubKeyFileName, uint16 keySize = 2048);
00085
00094 bool generateRSAKeys (const char* fqdn, const char* privKeyFileName, const char* pubKeyFileName, uint16 keySize = 2048);
00095
00102 bool getKeyPairFromFile (const char* privKeyFileName);
00103
00111 Botan::SecureVector<Botan::byte>& generateSignature (Botan::SecureVector<Botan::byte>& sessionID, Botan::SecureVector<Botan::byte>& signingData);
00112
00119 Botan::SecureVector<Botan::byte> generateDSASignature (Botan::SecureVector<Botan::byte>& sessionID, Botan::SecureVector<Botan::byte>& signingData);
00120
00127 Botan::SecureVector<Botan::byte> generateRSASignature (Botan::SecureVector<Botan::byte>& sessionID, Botan::SecureVector<Botan::byte>& signingData);
00128
00133 Botan::SecureVector<Botan::byte>& getPublicKeyBlob ();
00134
00139 uint8 getKeyAlgo () { return keyAlgo; }
00140
00141 };
00142
00143 #endif