ne7ssh_keys Class Reference

#include <ne7ssh_keys.h>

Collaboration diagram for ne7ssh_keys:

Collaboration graph
[legend]

List of all members.

Public Types

enum  keyAlgos { DSA, RSA }

Public Member Functions

 ne7ssh_keys ()
 ~ne7ssh_keys ()
bool generateDSAKeys (const char *fqdn, const char *privKeyFileName, const char *pubKeyFileName, uint16 keySize=2048)
bool generateRSAKeys (const char *fqdn, const char *privKeyFileName, const char *pubKeyFileName, uint16 keySize=2048)
bool getKeyPairFromFile (const char *privKeyFileName)
Botan::SecureVector
< Botan::byte > & 
generateSignature (Botan::SecureVector< Botan::byte > &sessionID, Botan::SecureVector< Botan::byte > &signingData)
Botan::SecureVector< Botan::byte > generateDSASignature (Botan::SecureVector< Botan::byte > &sessionID, Botan::SecureVector< Botan::byte > &signingData)
Botan::SecureVector< Botan::byte > generateRSASignature (Botan::SecureVector< Botan::byte > &sessionID, Botan::SecureVector< Botan::byte > &signingData)
Botan::SecureVector
< Botan::byte > & 
getPublicKeyBlob ()
uint8 getKeyAlgo ()

Private Member Functions

bool getDSAKeys (char *buffer, uint32 size)
bool getRSAKeys (char *buffer, uint32 size)

Private Attributes

Botan::DSA_PrivateKey * dsaPrivateKey
Botan::RSA_PrivateKey * rsaPrivateKey
ne7ssh_string publicKeyBlob
Botan::SecureVector< Botan::byte > signature
uint8 keyAlgo


Detailed Description

Author:
Andrew Useckas <andrew@netsieben.com>

Constructor & Destructor Documentation

ne7ssh_keys::ne7ssh_keys (  ) 

ne7ssh_keys constructor.

ne7ssh_keys::~ne7ssh_keys (  ) 

ne7ssh_keys destructor.

Returns:


Member Function Documentation

bool ne7ssh_keys::generateDSAKeys ( const char *  fqdn,
const char *  privKeyFileName,
const char *  pubKeyFileName,
uint16  keySize = 2048 
)

Generates DSA Key pair and saves keys in specified files.

Parameters:
fqdn User id. Usually an Email. For example "test@netsieben.com"
privKeyFileName Full path to a file where generated private key should be written.
pubKeyFileName Full path to a file where generated public key should be written.
keySize Desired key size in bits. If not specified will default to 2048.
Returns:
True if keys generated and written to the files. Otherwise false is returned.

References ne7ssh_string::addBigInt(), ne7ssh_string::addString(), ne7ssh::errors(), Ne7sshError::push(), and ne7ssh_string::value().

Referenced by ne7ssh::generateKeyPair().

SecureVector< Botan::byte > ne7ssh_keys::generateDSASignature ( Botan::SecureVector< Botan::byte > &  sessionID,
Botan::SecureVector< Botan::byte > &  signingData 
)

Generates a SHA-1 signature from sessionID and packet data provided, using DSA private key initialized before.

Parameters:
sessionID SSH2 SessionID.
signingData Packet data to sign.
Returns:
Returns signature, or 0 length vector if operation failed.

References ne7ssh_string::addString(), ne7ssh_string::addVector(), ne7ssh_string::addVectorField(), ne7ssh_string::clear(), ne7ssh::errors(), Ne7sshError::push(), and ne7ssh_string::value().

Referenced by generateSignature().

bool ne7ssh_keys::generateRSAKeys ( const char *  fqdn,
const char *  privKeyFileName,
const char *  pubKeyFileName,
uint16  keySize = 2048 
)

Generates RSA Key pair and saves keys in specified files.

Parameters:
fqdn User id. Usually an Email. For example "test@netsieben.com"
privKeyFileName Full path to a file where generated private key should be written.
pubKeyFileName Full path to a file where generated public key should be written.
keySize Desired key size in bits. If not specified will default to 2048.
Returns:
True if keys generated and written to the files. Otherwise false is returned.

References ne7ssh_string::addBigInt(), ne7ssh_string::addString(), ne7ssh::errors(), Ne7sshError::push(), and ne7ssh_string::value().

Referenced by ne7ssh::generateKeyPair().

SecureVector< Botan::byte > ne7ssh_keys::generateRSASignature ( Botan::SecureVector< Botan::byte > &  sessionID,
Botan::SecureVector< Botan::byte > &  signingData 
)

Generates a SHA-1 signature from sessionID and packet data provided, using DSA private key initialized before.

Parameters:
sessionID SSH2 SessionID.
signingData Packet data to sign.
Returns:
Returns signature, or 0 length vector if operation failed.

References ne7ssh_string::addString(), ne7ssh_string::addVector(), ne7ssh_string::addVectorField(), ne7ssh::errors(), Ne7sshError::push(), and ne7ssh_string::value().

Referenced by generateSignature().

SecureVector< Botan::byte > & ne7ssh_keys::generateSignature ( Botan::SecureVector< Botan::byte > &  sessionID,
Botan::SecureVector< Botan::byte > &  signingData 
)

Generates a SHA-1 signature from sessionID and packet data provided.

Determines key type and passed the processing either to generateDSASignature() or generateRSAKeys() functions.

Parameters:
sessionID SSH2 SessionID.
signingData Packet data to sign.
Returns:
Returns signature, or 0 length vector if operation failed.

References generateDSASignature(), and generateRSASignature().

Referenced by ne7ssh_connection::authWithKey().

bool ne7ssh_keys::getDSAKeys ( char *  buffer,
uint32  size 
) [private]

Extracts DSA key pair from a PEM encoded stream.

Parameters:
buffer PEM encoded string.
size Length of the stream.
Returns:
True if keys succesfully extracted. Otherwise False is returned.

References ne7ssh_string::addBigInt(), ne7ssh_string::addString(), ne7ssh_string::clear(), ne7ssh::errors(), and Ne7sshError::push().

Referenced by getKeyPairFromFile().

uint8 ne7ssh_keys::getKeyAlgo (  )  [inline]

Returns type of initialized keys.

Returns:
Type of keys.

Referenced by ne7ssh_connection::authWithKey().

bool ne7ssh_keys::getKeyPairFromFile ( const char *  privKeyFileName  ) 

Extracts key pair from a PEM encoded file.

Reads the file and determines the type of key, then passes processing to either getDsaKeys() or getRSAKeys(*) functions.

Parameters:
privKeyFileName Full path to PEM encoded file.
Returns:
True if key succesfully extracted, otherwise False is returned.

References ne7ssh_string::addFile(), ne7ssh::errors(), getDSAKeys(), getRSAKeys(), ne7ssh_string::length(), Ne7sshError::push(), and ne7ssh_string::value().

Referenced by ne7ssh_connection::authWithKey().

SecureVector< Botan::byte > & ne7ssh_keys::getPublicKeyBlob (  ) 

After key pair has been initialized, this function returns public key blob, as specified by SSH2 specs.

Returns:
Public key blob or zero length vector, if there are initialized keys.

References ne7ssh_string::value().

Referenced by ne7ssh_connection::authWithKey().

bool ne7ssh_keys::getRSAKeys ( char *  buffer,
uint32  size 
) [private]

Extracts RSA key pair from a PEM encoded stream.

Parameters:
buffer PEM encoded string.
size Length of the stream.
Returns:
True if keys succesfully extracted. Otherwise False is returned.

References ne7ssh_string::addBigInt(), ne7ssh_string::addString(), ne7ssh_string::clear(), ne7ssh::errors(), and Ne7sshError::push().

Referenced by getKeyPairFromFile().


The documentation for this class was generated from the following files:

Generated on Tue May 5 14:10:43 2009 for ne7ssh.kdevelop by  doxygen 1.5.9