ne7ssh_string Class Reference

#include <ne7ssh_string.h>

Inheritance diagram for ne7ssh_string:

Inheritance graph
[legend]

List of all members.

Public Member Functions

 ne7ssh_string ()
 ne7ssh_string (Botan::SecureVector< Botan::byte > &var, uint32 position)
 ne7ssh_string (const char *var, uint32 position)
virtual ~ne7ssh_string ()
void clear ()
void addString (const char *str)
bool addFile (const char *filename)
void addBytes (const Botan::byte *buff, uint32 len)
void addVector (Botan::SecureVector< Botan::byte > &secvec)
void addVectorField (const Botan::SecureVector< Botan::byte > &vector)
void addChar (const char ch)
void addInt (const uint32 var)
void addBigInt (const Botan::BigInt &bn)
virtual Botan::SecureVector
< Botan::byte > & 
value ()
uint32 length ()
bool getString (Botan::SecureVector< Botan::byte > &result)
bool getBigInt (Botan::BigInt &result)
uint32 getInt ()
Botan::byte getByte ()
void split (const char token)
void resetParts ()
char * nextPart ()
void chop (uint32 nBytes)

Static Public Member Functions

static void bn2vector (Botan::SecureVector< Botan::byte > &result, const Botan::BigInt &bi)

Protected Attributes

Botan::SecureVector< Botan::byte > buffer

Private Attributes

Botan::byte ** positions
uint32 parts
uint32 currentPart


Detailed Description

Author:
Andrew Useckas

Constructor & Destructor Documentation

ne7ssh_string::ne7ssh_string (  ) 

ne7ssh_string class default consturctor.

Zeros out 'positions' and 'parts'.

ne7ssh_string::ne7ssh_string ( Botan::SecureVector< Botan::byte > &  var,
uint32  position 
)

ne7ssh_string class consturctor.

Takes a vector as an argument and places the data into 'buffer'.

Parameters:
var Reference to a vector containing a string.
position Position in the vector to start reading from. If '0', the entire vector is dumped into 'buffer'.

ne7ssh_string::ne7ssh_string ( const char *  var,
uint32  position 
)

Same as above costructor, but instead of vector it works with a string (const char*).

Parameters:
var Pointer to a string terminated by '/0'.
position Read from this position onwards.

ne7ssh_string::~ne7ssh_string (  )  [virtual]

ne7ssh_string class destructor.


Member Function Documentation

void ne7ssh_string::addBigInt ( const Botan::BigInt &  bn  ) 

Adds a BigInt variable to the buffer.

BigInt is first converted to a vector, then the integer, representing length of the vector is converted to the network format. Converted ingeger is added to the buffer, followed by the vector.

Parameters:
bn Reference to BigInt variable.

References bn2vector().

Referenced by ne7ssh_keys::generateDSAKeys(), ne7ssh_keys::generateRSAKeys(), ne7ssh_keys::getDSAKeys(), ne7ssh_keys::getRSAKeys(), and ne7ssh_kex::sendKexDHInit().

void ne7ssh_string::addBytes ( const Botan::byte *  buff,
uint32  len 
)

Adds a byte stream to the buffer.

Parameters:
buff Pointer to the byte stream.
len Length of the byte stream.

Referenced by Ne7sshSftpPacket::addInt64(), ne7ssh_kex::constructLocalKex(), ne7ssh_kex::handleInit(), and ne7ssh_transport::sendPacket().

void ne7ssh_string::addChar ( const char  ch  ) 

bool ne7ssh_string::addFile ( const char *  filename  ) 

Reads content of an ASCII file and appends it to the buffer.

Parameters:
filename Full path to ASCII file.
Returns:
True is file is successfully read. Otherwise False is returned.

References ne7ssh::errors(), and Ne7sshError::push().

Referenced by ne7ssh_keys::getKeyPairFromFile().

void ne7ssh_string::addInt ( const uint32  var  ) 

void ne7ssh_string::addString ( const char *  str  ) 

Adds a string to the buffer.

Adds an integer representing the length of the string, converted to the network format, before the actual string data. Required by SSH protocol specifications.

Parameters:
str pointer to a string.

References value().

Referenced by ne7ssh_connection::authWithKey(), ne7ssh_connection::authWithPassword(), ne7ssh_kex::constructLocalKex(), ne7ssh_channel::execCmd(), ne7ssh_keys::generateDSAKeys(), ne7ssh_keys::generateDSASignature(), ne7ssh_keys::generateRSAKeys(), ne7ssh_keys::generateRSASignature(), ne7ssh_keys::getDSAKeys(), ne7ssh_keys::getRSAKeys(), ne7ssh_channel::getShell(), Ne7sshSftp::init(), ne7ssh_channel::open(), and ne7ssh_connection::requestService().

void ne7ssh_string::addVector ( Botan::SecureVector< Botan::byte > &  secvec  ) 

void ne7ssh_string::addVectorField ( const Botan::SecureVector< Botan::byte > &  vector  ) 

Adds a vector to the buffer.

Adds an integer representing the length of the vector, converted to the network format, before the actual data. Required by SSH protocol specifications.

Parameters:
vector Reference to a vector.

Referenced by ne7ssh_connection::authWithKey(), ne7ssh_crypt::compute_key(), ne7ssh_kex::constructLocalKex(), ne7ssh_keys::generateDSASignature(), ne7ssh_keys::generateRSASignature(), Ne7sshSftp::handleNames(), ne7ssh_kex::makeH(), ne7ssh_channel::sendAll(), Ne7sshSftpPacket::value(), and Ne7sshSftpPacket::valueFragment().

void ne7ssh_string::bn2vector ( Botan::SecureVector< Botan::byte > &  result,
const Botan::BigInt &  bi 
) [static]

Converts BigInt into vector

For internal use only

Parameters:
result Reference to vector where the converted result will be dumped.
bi Reference to BigInt to convert.

Referenced by addBigInt(), ne7ssh_kex::handleKexDHReply(), ne7ssh_crypt::makeKexSecret(), and ne7ssh_kex::sendKexDHInit().

void ne7ssh_string::chop ( uint32  nBytes  ) 

Chops bytes off of the end of the buffer.

Parameters:
nBytes How many bytes to chop off the end of the buffer.

Referenced by ne7ssh_channel::handleData().

void ne7ssh_string::clear (  )  [inline]

bool ne7ssh_string::getBigInt ( Botan::BigInt &  result  ) 

Extracts a single BigInt variable from the payload field of SSH packet.

Parameters:
result Reference to a BigInt variable where the result will be stored.
Returns:
True if BigInt field was found and successfully parsed, otherwise false is returned.

Referenced by ne7ssh_crypt::getDSAKey(), ne7ssh_crypt::getRSAKey(), and ne7ssh_kex::handleKexDHReply().

Botan::byte ne7ssh_string::getByte (  ) 

Extracts a single byte from tje payload field of SSH packet.

Returns:
A byte extracted from thenext byte of the payload.

Referenced by ne7ssh_connection::authWithKey(), ne7ssh_connection::authWithPassword(), Ne7sshSftp::handleData(), ne7ssh_channel::handleReceived(), and ne7ssh_channel::handleRequest().

uint32 ne7ssh_string::getInt (  ) 

bool ne7ssh_string::getString ( Botan::SecureVector< Botan::byte > &  result  ) 

uint32 ne7ssh_string::length (  )  [inline]

char * ne7ssh_string::nextPart (  ) 

Returns the next part.

Returns:
NULL terminated string, or 0 if this is the last part.

Referenced by ne7ssh_crypt::agree(), and ne7ssh_kex::constructLocalKex().

void ne7ssh_string::resetParts (  )  [inline]

Returns to the first part.

Referenced by ne7ssh_crypt::agree(), and ne7ssh_kex::constructLocalKex().

void ne7ssh_string::split ( const char  token  ) 

Splits the buffer into strings separated by null character.

Parameters:
token Searches for this character in the buffer, replaces it with null and creates a part index.

Referenced by ne7ssh_crypt::agree(), and ne7ssh_kex::constructLocalKex().

virtual Botan::SecureVector<Botan::byte>& ne7ssh_string::value (  )  [inline, virtual]


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