Hi,
there is a bug in the current CVS version in the Integer
encoding method.
| Integer::Power2(8*UnsignedMin(ByteCount(), outputLen)) + *this;
| (integer.cpp +3114)
It seems that UnsignedMax should be used.
The following code demonstrates the problem.
Greetings,
Michael
Wei: Thanks for pointing out that lword is unsigned. :-)
-- main.cpp
// output:
//
// out: -129.
// in: 127.
#include <iostream>
#include <crypto++/queue.h>
#include <crypto++/integer.h>
int main( int argc, char ** argv )
{
using namespace CryptoPP;
Integer i1 = -129;
ByteQueue bq;
i1.DEREncode(bq);
Integer i2;
i2.BERDecode(bq);
std::cout << "out: " << i1 << std::endl;
std::cout << "in: " << i2 << std::endl;
return 0;
}