Click here to Skip to main content
15,886,639 members
Articles / Programming Languages / C++

BasicAdmin2 - Personal Finance Software

Rate me:
Please Sign up or sign in to vote.
4.58/5 (8 votes)
4 Nov 2011CPOL3 min read 38.9K   5.9K   33  
Utility to keep track of your finances
#include "StdAfx.h"
#include "Interno.h"
#include "Cryptopp/osrng.h"
#include "Cryptopp/base64.h"
//#include "Cryptopp/default.h"
#include "Cryptopp/gzip.h"
//#include "Cryptopp/zlib.h"
#include "RSAEnc.h"

using namespace std;
using namespace CryptoPP;

CInterno::CInterno()
{
	encrsa = new CRSAEnc();
}
CInterno::~CInterno()
{
	delete encrsa;
}
void ProcessBuffTrans(BufferedTransformation& buf, const BYTE* input, int inputlen,BYTE** output, int* outputlen)
{
	buf.Put(input, inputlen);
	buf.MessageEnd();
	int len = buf.MaxRetrievable();
	*output = new BYTE[len];
	buf.Get(*output, len);
	*outputlen = len;
}
void ReplaceEnter(BYTE** input, int* inputlen)
{
	int shift = 0;
	BYTE car;
	for (int i=0;i<(*inputlen);i++)
	{
		car = (*input)[i];
		if (car == 13 || car == 10)
			shift++;
		else
		{
			if (shift > 0)
				(*input)[i-shift] = (*input)[i];
		}
	}
	*inputlen = *inputlen - shift;
}
void CInterno::EncodeB64(const BYTE* input, int inputlen,BYTE** output, int* outputlen, BOOL Enters)
{
	Base64Encoder ber;
	ProcessBuffTrans(ber, input, inputlen, output, outputlen);
	if (!Enters)
		ReplaceEnter(output, outputlen);
}
void CInterno::DecodeB64(const BYTE* input, int inputlen,BYTE** output, int* outputlen)
{
	Base64Decoder ber;
	ProcessBuffTrans(ber, input, inputlen, output, outputlen);
}
void CInterno::GZip(const BYTE* input, int inputlen,BYTE** output, int* outputlen)
{
	Gzip zip;
	ProcessBuffTrans(zip, input, inputlen, output, outputlen);
}
void CInterno::UnGZip(const BYTE* input, int inputlen,BYTE** output, int* outputlen)
{
	Gunzip unzip;
	ProcessBuffTrans(unzip, input, inputlen, output, outputlen);
}

void CInterno::EncryptRSA(const BYTE* input, int inputlen,BYTE** output, int* outputlen)
{
	((CRSAEnc*)encrsa)->Encrypt(input, inputlen,output, outputlen);
}
void CInterno::DecryptRSA(const BYTE* input, int inputlen,BYTE** output, int* outputlen)
{
	((CRSAEnc*)encrsa)->Decrypt(input, inputlen,output, outputlen);
}
void CInterno::InitRSA(CRSAKey& rsakey)
{
	((CRSAEnc*)encrsa)->Init(rsakey);
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Argentina Argentina
System developer from Argentina.

Programmed in VB 5,6,.NET, C#, Java, PL-SQL, Transac-SQL, C, C++ and even some "calculator" language.

Love to build small, useful applications.
Usually building big and complicated apps based on solid, reliable components.

Hobbies: reading, photography, chess, paddle, running.

Comments and Discussions