Ejemplo n.º 1
0
// EGPublicKey::EncryptBlock
// Encrypts a block of specified length into the specified queue.  This method is
// called by the EncryptData() method for each block.  Note that theLen MUST NOT exceed
// the max block size of the mCryptP object (EncryptData enforces this).  Also note that
// mCryptP must be valid before this method is called.
void
EGPublicKey::EncryptBlock(BufferedTransformation& aQueue, const unsigned char* theBlockP,
                         unsigned long theLen) const
{
	WTRACE("EGPublicKey::EncryptBlock");
	WDBG_LL("EGPublicKey::EncryptBlock, len=" << theLen << ", cipherlen=" << mCryptP->CipherTextLength());
	auto_ptr<unsigned char> aBuf(new unsigned char[mCryptP->CipherTextLength()]);
	mCryptP->Encrypt(Randomizer::GetPool(), theBlockP, theLen, aBuf.get());
	aQueue.Put(aBuf.get(), mCryptP->CipherTextLength());
}
Ejemplo n.º 2
0
/* Logging callback */
static void log_writer(int level, const char *buf, unsigned len)
{
    static wchar_t buf16[PJ_LOG_MAX_SIZE];

    PJ_UNUSED_ARG(level);

    pj_ansi_to_unicode(buf, len, buf16, PJ_ARRAY_SIZE(buf16));

    TPtrC16 aBuf((const TUint16*)buf16, (TInt)len);
    console->Write(aBuf);
}
Ejemplo n.º 3
0
GLDEF_C void TestTDes<T,S,L,R>::Test8()
//
//	Constructs a TBuf view with length
//
	{

	T aBuf(10);
	aBuf.__DbgTestInvariant();
	test(aBuf.Length()==10);
	test(aBuf.MaxLength()==0x40);
	}
Ejemplo n.º 4
0
GLDEF_C void TestTDes<T,S,L,R>::Test9()
//
//	Constructs a TBuf view over a string
//
	{

	T aBuf(_TL("ABCDEF"));
	aBuf.__DbgTestInvariant();
	test(aBuf.Length()==6);
	test(aBuf.MaxLength()==0x40);
	for(S count=0;count<aBuf.Length();count++)
		test(*(aBuf.Ptr()+count)==('A' + count));
	}
Ejemplo n.º 5
0
GLDEF_C void TestTDes<T,S,L,R>::TestF()
//	TBuf buffer Assignment
	{
	T aBuf(_TL("ABCDEF"));
	T bBuf;
	bBuf=aBuf;
	bBuf.__DbgTestInvariant();
	test(bBuf.MaxLength()==aBuf.MaxLength());
	test(bBuf.MaxLength()==0x40);
	test(bBuf.Length()==aBuf.Length());
	test(bBuf.Length()==6);
	for(S count=0;count<bBuf.Length();count++)
		{
		test(*(bBuf.Ptr()+count)==('A' + count));
		test(*(bBuf.Ptr()+count)==*(aBuf.Ptr()+count));
		}
 	}
Ejemplo n.º 6
0
GLDEF_C void TestTDes<T,S,L,R>::Test10()
//
//	Constructs a TBuf view over a descriptor
//
	{

	R aDesR(_TL("ABCDEF"));
	aDesR.__DbgTestInvariant();
	T aBuf(aDesR);
	aBuf.__DbgTestInvariant();
	test(aBuf.MaxLength()==0x40);
	test(aBuf.Length()==aDesR.Length());
	test(aBuf.Length()==6);
	for(S count=0;count<aBuf.Length();count++)
		{
		test(*(aBuf.Ptr()+count)==('A' + count));
		test(*(aBuf.Ptr()+count)==*(aDesR.Ptr()+count));
		}
	}
Ejemplo n.º 7
0
GLDEF_C void TestTDes<T,S,L,R>::Test11()
//
//	Constructs a TBuf view over a buffer
//
	{

	T aBuf(_TL("ABCDEF"));
	aBuf.__DbgTestInvariant();
	T bBuf(aBuf);
	bBuf.__DbgTestInvariant();
	test(bBuf.MaxLength()==aBuf.MaxLength());
	test(bBuf.MaxLength()==0x40);
	test(bBuf.Length()==aBuf.Length());
	test(bBuf.Length()==6);
	for(S count=0;count<bBuf.Length();count++)
		{
		test(*(bBuf.Ptr()+count)==('A' + count));
		test(*(bBuf.Ptr()+count)==*(aBuf.Ptr()+count));
		}
	}