Sfoglia il codice sorgente

snfNETmgr not using namespace std

master
Pete McNeil 4 anni fa
parent
commit
28ae11eac4
2 ha cambiato i file con 8 aggiunte e 8 eliminazioni
  1. 5
    5
      snfNETmgr.cpp
  2. 3
    3
      snfNETmgr.hpp

+ 5
- 5
snfNETmgr.cpp Vedi File

#include "../CodeDweller/base64codec.hpp" #include "../CodeDweller/base64codec.hpp"
// #include "tcp_watchdog.hpp" No longer using TCPWatchdog -- see below _M // #include "tcp_watchdog.hpp" No longer using TCPWatchdog -- see below _M


using namespace std;
namespace cd = codedweller;


///// utilities //////////////////////////////////////////////////////////////// ///// utilities ////////////////////////////////////////////////////////////////


//-- <msg...> //-- <msg...>


XML << "<msg size=\'" << ScanData.ScanSize << "'>" << endl; // Starting with the msg element. XML << "<msg size=\'" << ScanData.ScanSize << "'>" << endl; // Starting with the msg element.
to_base64 EncodedMessageData(
cd::to_base64 EncodedMessageData(
reinterpret_cast<const char*>(MessageBuffer), MessageLength); // Encode the message to base64. reinterpret_cast<const char*>(MessageBuffer), MessageLength); // Encode the message to base64.


const int SampleLineLength = 64; // 64 bytes per line is good. const int SampleLineLength = 64; // 64 bytes per line is good.


CurrentThreadState(SYNC_Compute_Response); CurrentThreadState(SYNC_Compute_Response);


from_base64 DecodedChallenge(Challenge.snf_sync_challenge_txt); // Decode the challenge.
cd::from_base64 DecodedChallenge(Challenge.snf_sync_challenge_txt); // Decode the challenge.


//--- Prepare the secret. //--- Prepare the secret.




PadBuffer NewPad = OneTimePad(); // Grab a new Pad (default size). PadBuffer NewPad = OneTimePad(); // Grab a new Pad (default size).


base64buffer ResponseBin; // With the key now established,
cd::base64buffer ResponseBin; // With the key now established,
for(unsigned int i = 0; i < NewPad.size(); i++) // encrypt the one time pad for for(unsigned int i = 0; i < NewPad.size(); i++) // encrypt the one time pad for
ResponseBin.push_back( // transfer. ResponseBin.push_back( // transfer.
ResponseGenerator.Encrypt(NewPad[i])); ResponseGenerator.Encrypt(NewPad[i]));


//--- Encode our response as base64 and send it. //--- Encode our response as base64 and send it.


to_base64 ResponseTxt(ResponseBin); // Encode the cyphertext as base64.
cd::to_base64 ResponseTxt(ResponseBin); // Encode the cyphertext as base64.
string ResponseTxtString; // Create a handy string and place string ResponseTxtString; // Create a handy string and place
ResponseTxtString.assign(ResponseTxt.begin(), ResponseTxt.end()); // the base 64 text into it. ResponseTxtString.assign(ResponseTxt.begin(), ResponseTxt.end()); // the base 64 text into it.



+ 3
- 3
snfNETmgr.hpp Vedi File

#include "snfLOGmgr.hpp" #include "snfLOGmgr.hpp"
#include "snfGBUdbmgr.hpp" #include "snfGBUdbmgr.hpp"


//namespace cd = codedweller;

class snfScanData; // Declare snfScanData; class snfScanData; // Declare snfScanData;
class snfLOGmgr; // Declare snfLOGmgr; class snfLOGmgr; // Declare snfLOGmgr;
class snfGBUdbmgr; // Declare snfGBUdbmgr; class snfGBUdbmgr; // Declare snfGBUdbmgr;


using namespace std;

typedef vector<unsigned char> PadBuffer; // Holds one time pads etc.
typedef std::vector<unsigned char> PadBuffer; // Holds one time pads etc.
const unsigned int SNFHandshakeSize = 8; // Size of an SNF Handshake. const unsigned int SNFHandshakeSize = 8; // Size of an SNF Handshake.
const unsigned int SNFChallengeSize = 32; // Size of an SNF Challenge. const unsigned int SNFChallengeSize = 32; // Size of an SNF Challenge.
const unsigned int SNFPadSize = 16; // Size of an SNF One Time Pad. const unsigned int SNFPadSize = 16; // Size of an SNF One Time Pad.

Loading…
Annulla
Salva