QSecureArray/QBigInteger -> QCA::SecureArray/QCA::BigInteger fixups

svn path=/trunk/kdesupport/qca/; revision=653605
This commit is contained in:
Alon Bar-Lev 2007-04-13 19:19:18 +00:00
parent 924d5a685f
commit 9f9f2d05d6
23 changed files with 552 additions and 552 deletions

View File

@ -36,10 +36,10 @@ public:
// Helper to left shift an arbitrary length array
// This is heavily based on the example in the I-D.
QSecureArray leftShift(const QSecureArray &array)
QCA::SecureArray leftShift(const QCA::SecureArray &array)
{
// We create an output of the same size as the input
QSecureArray out(array.size());
QCA::SecureArray out(array.size());
// We handle one byte at a time - this is the high bit
// from the previous byte.
int overflow = 0;
@ -59,14 +59,14 @@ public:
// Helper to XOR two arrays - must be same length
QSecureArray xorArray(const QSecureArray &array1,
const QSecureArray &array2)
QCA::SecureArray xorArray(const QCA::SecureArray &array1,
const QCA::SecureArray &array2)
{
if (array1.size() != array2.size())
// empty array
return QSecureArray();
return QCA::SecureArray();
QSecureArray result(array1.size());
QCA::SecureArray result(array1.size());
for (int i = 0; i < array1.size(); ++i)
result[i] = array1[i] ^ array2[i];
@ -84,18 +84,18 @@ public:
m_key = key;
// Generate the subkeys
QSecureArray const_Zero(16);
QSecureArray const_Rb(16);
QCA::SecureArray const_Zero(16);
QCA::SecureArray const_Rb(16);
const_Rb[15] = (char)0x87;
m_X = const_Zero;
m_residual = QSecureArray();
m_residual = QCA::SecureArray();
// Figure 2.2, step 1.
QCA::Cipher aesObj(QString("aes128"),
QCA::Cipher::ECB, QCA::Cipher::DefaultPadding,
QCA::Encode, key);
QSecureArray L = aesObj.process(const_Zero);
QCA::SecureArray L = aesObj.process(const_Zero);
// Figure 2.2, step 2
if (0 == (L[0] & 0x80))
@ -127,15 +127,15 @@ public:
// This is a bit different to the way the I-D does it,
// to allow for multiple update() calls.
void update(const QSecureArray &a)
void update(const QCA::SecureArray &a)
{
QSecureArray bytesToProcess = m_residual + a;
QCA::SecureArray bytesToProcess = m_residual + a;
int blockNum;
// note that we don't want to do the last full block here, because
// it needs special treatment in final().
for (blockNum = 0; blockNum < ((bytesToProcess.size()-1)/16); ++blockNum) {
// copy a block of data
QSecureArray thisBlock(16);
QCA::SecureArray thisBlock(16);
for (int yalv = 0; yalv < 16; ++yalv)
thisBlock[yalv] = bytesToProcess[blockNum*16 + yalv];
@ -154,9 +154,9 @@ public:
m_residual[yalv] = bytesToProcess[blockNum*16 + yalv];
}
void final( QSecureArray *out)
void final( QCA::SecureArray *out)
{
QSecureArray lastBlock;
QCA::SecureArray lastBlock;
int numBytesLeft = m_residual.size();
if ( numBytesLeft != 16 ) {
@ -178,18 +178,18 @@ public:
protected:
// first subkey
QSecureArray m_k1;
QCA::SecureArray m_k1;
// second subkey
QSecureArray m_k2;
QCA::SecureArray m_k2;
// main key
QSecureArray m_key;
QCA::SecureArray m_key;
// state
QSecureArray m_X;
QSecureArray m_Y;
QCA::SecureArray m_X;
QCA::SecureArray m_Y;
// partial block that we can't do yet
QSecureArray m_residual;
QCA::SecureArray m_residual;
};
class ClientSideProvider : public QCA::Provider
@ -272,11 +272,11 @@ int main(int argc, char **argv)
// set the MAC to use the key
cmacObject.setup(key);
QSecureArray message = QCA::hexToArray("6bc1bee22e409f96e93d7e117393172a"
QCA::SecureArray message = QCA::hexToArray("6bc1bee22e409f96e93d7e117393172a"
"ae2d8a571e03ac9c9eb76fac45af8e51"
"30c81c46a35ce411e5fbc1191a0a52ef"
"f69f2445df4f9b17ad2b417be66c3710");
QSecureArray message1(message);
QCA::SecureArray message1(message);
message1.resize(0);
qDebug();
qDebug() << "Message1: " << QCA::arrayToHex(message1);
@ -284,7 +284,7 @@ int main(int argc, char **argv)
qDebug() << "AES-CMAC: " << QCA::arrayToHex(cmacObject.process(message1));
cmacObject.clear();
QSecureArray message2(message);
QCA::SecureArray message2(message);
message2.resize(16);
qDebug();
qDebug() << "Message2: " << QCA::arrayToHex(message2);
@ -292,7 +292,7 @@ int main(int argc, char **argv)
qDebug() << "AES-CMAC: " << QCA::arrayToHex(cmacObject.process(message2));
cmacObject.clear();
QSecureArray message3(message);
QCA::SecureArray message3(message);
message3.resize(40);
qDebug();
qDebug() << "Message3: " << QCA::arrayToHex(message3);
@ -300,7 +300,7 @@ int main(int argc, char **argv)
qDebug() << "AES-CMAC " << QCA::arrayToHex(cmacObject.process(message3));
cmacObject.clear();
QSecureArray message4(message);
QCA::SecureArray message4(message);
message4.resize(64);
qDebug();
qDebug() << "Message4: " << QCA::arrayToHex(message4);

View File

@ -34,7 +34,7 @@ int main(int argc, char **argv)
// we use the first argument if provided, or
// use "hello" if no arguments
QSecureArray arg = (argc >= 2) ? argv[1] : "hello";
QCA::SecureArray arg = (argc >= 2) ? argv[1] : "hello";
// AES128 testing
if(!QCA::isSupported("aes128-cbc-pkcs7"))
@ -61,7 +61,7 @@ int main(int argc, char **argv)
// the result of that is returned - note that if there is less than
// 16 bytes (1 block), then nothing will be returned - it is buffered
// update() can be called as many times as required.
QSecureArray u = cipher.update(arg);
QCA::SecureArray u = cipher.update(arg);
// We need to check if that update() call worked.
if (!cipher.ok()) {
@ -75,7 +75,7 @@ int main(int argc, char **argv)
// Because we are using PKCS7 padding, we need to output the final (padded) block
// Note that we should always call final() even with no padding, to clean up
QSecureArray f = cipher.final();
QCA::SecureArray f = cipher.final();
// Check if the final() call worked
if (!cipher.ok()) {
@ -91,10 +91,10 @@ int main(int argc, char **argv)
// Build a single cipher text array. You could also call update() with
// each block as you receive it, if that is more useful.
QSecureArray cipherText = u.append(f);
QCA::SecureArray cipherText = u.append(f);
// take that cipher text, and decrypt it
QSecureArray plainText = cipher.update(cipherText);
QCA::SecureArray plainText = cipher.update(cipherText);
// check if the update() call worked
if (!cipher.ok()) {

View File

@ -92,7 +92,7 @@ int main(int argc, char** argv)
// Read in a private key
QCA::PrivateKey privKey;
QCA::ConvertResult convRes;
QSecureArray passPhrase = "start";
QCA::SecureArray passPhrase = "start";
privKey = QCA::PrivateKey::fromPEMFile( "Userkey.pem", passPhrase, &convRes );
if ( convRes != QCA::ConvertGood ) {
qWarning() << "Sorry, could not import Private Key";
@ -129,7 +129,7 @@ int main(int argc, char** argv)
return 1;
}
QSecureArray plainTextResult = msg2.read();
QCA::SecureArray plainTextResult = msg2.read();
qDebug() << enc.arrayToString( cipherText )
<< " (in base 64) decrypts to: "

View File

@ -89,7 +89,7 @@ private slots:
}
// You would typically request the password/PIN/passphrase.
// again, we just fake it.
m_handler.submitPassword( id, QSecureArray( "hello" ) );
m_handler.submitPassword( id, QCA::SecureArray( "hello" ) );
} else {
std::cout << "Unexpected event type" << std::endl;

View File

@ -33,7 +33,7 @@ int main(int argc, char **argv)
// we use the first argument if provided, or
// use "hello" if no arguments
QSecureArray arg = (argc >= 2) ? argv[1] : "hello";
QCA::SecureArray arg = (argc >= 2) ? argv[1] : "hello";
// must always check that an algorithm is supported before using it
if( !QCA::isSupported("sha1") )
@ -51,8 +51,8 @@ int main(int argc, char **argv)
// this shows the incremental approach. Naturally
// for this simple job, we could use the "all in one"
// approach - this is an example, after all :-)
QSecureArray part1(arg.toByteArray().left(3)); // three chars - "hel"
QSecureArray part2(arg.toByteArray().mid(3)); // the rest - "lo"
QCA::SecureArray part1(arg.toByteArray().left(3)); // three chars - "hel"
QCA::SecureArray part2(arg.toByteArray().mid(3)); // the rest - "lo"
// create the required object.
QCA::Hash hashObject("md5");
@ -60,7 +60,7 @@ int main(int argc, char **argv)
hashObject.update(part1);
hashObject.update(part2);
// no more updates after calling final.
QSecureArray resultArray = hashObject.final();
QCA::SecureArray resultArray = hashObject.final();
// convert the result into printable hexadecimal.
QString result = QCA::arrayToHex(resultArray);
printf("md5(\"%s\") = [%s]\n", arg.data(), result.toAscii().data());

View File

@ -40,7 +40,7 @@ private slots:
{
if(event.type() == QCA::Event::Password)
{
QSecureArray pass;
QCA::SecureArray pass;
pass = QCA::ConsolePrompt::getHidden("Passphrase");
handler.submitPassword(id, pass);
}

View File

@ -41,7 +41,7 @@ int main(int argc, char **argv)
// we use the second argument as the key to authenticate
// with, if two arguments are provided. Use "secret" as
// the key if less than two arguments.
QSecureArray key((argc >= 3) ? argv[2] : "secret");
QCA::SecureArray key((argc >= 3) ? argv[2] : "secret");
// must always check that an algorithm is supported before using it
if( !QCA::isSupported("hmac(sha1)") ) {
@ -49,7 +49,7 @@ int main(int argc, char **argv)
} else {
// create the required object using HMAC with SHA-1, and an
// empty key.
QCA::MessageAuthenticationCode hmacObject( "hmac(sha1)", QSecureArray() );
QCA::MessageAuthenticationCode hmacObject( "hmac(sha1)", QCA::SecureArray() );
// create the key
QCA::SymmetricKey keyObject(key);
@ -60,13 +60,13 @@ int main(int argc, char **argv)
// QCA::MessageAuthenticationCode constructor
// we split it into two parts to show incremental update
QSecureArray part1(arg.left(3)); // three chars - "hel"
QSecureArray part2(arg.mid(3)); // the rest - "lo"
QCA::SecureArray part1(arg.left(3)); // three chars - "hel"
QCA::SecureArray part2(arg.mid(3)); // the rest - "lo"
hmacObject.update(part1);
hmacObject.update(part2);
// no more updates after calling final.
QSecureArray resultArray = hmacObject.final();
QCA::SecureArray resultArray = hmacObject.final();
// convert the result into printable hexadecimal.
QString result = QCA::arrayToHex(resultArray);

View File

@ -56,9 +56,9 @@ int byte2unsigned ( int byteValue )
}
QString qca_md5crypt( const QSecureArray &password, const QSecureArray &salt )
QString qca_md5crypt( const QCA::SecureArray &password, const QCA::SecureArray &salt )
{
QSecureArray finalState, magic_string = "$1$";
QCA::SecureArray finalState, magic_string = "$1$";
// The md5crypt algorithm uses two separate hashes
QCA::Hash hash1( "md5" );
@ -185,7 +185,7 @@ int main(int argc, char **argv)
// also does cleanup when it goes out of scope
QCA::Initializer init;
QSecureArray password, salt;
QCA::SecureArray password, salt;
QCoreApplication app ( argc, argv );

View File

@ -45,7 +45,7 @@ int main(int argc, char** argv)
// Read in a private key
QCA::PrivateKey privKey;
QCA::ConvertResult convRes;
QSecureArray passPhrase = "start";
QCA::SecureArray passPhrase = "start";
privKey = QCA::PrivateKey::fromPEMFile( "Userkey.pem", passPhrase, &convRes );
if ( convRes != QCA::ConvertGood ) {
std::cout << "Sorry, could not import Private Key" << std::endl;
@ -89,7 +89,7 @@ int main(int argc, char** argv)
}
// get the result
QSecureArray cipherText = msg.read();
QCA::SecureArray cipherText = msg.read();
QCA::Base64 enc;
std::cout << plainText.data() << " encrypts to (in base 64): ";
std::cout << qPrintable( enc.arrayToString( cipherText ) ) << std::endl;
@ -99,7 +99,7 @@ int main(int argc, char** argv)
std::cout << "Private key cannot be used to decrypt" << std::endl;
return 1;
}
QSecureArray plainTextResult;
QCA::SecureArray plainTextResult;
if ( 0 == privKey.decrypt(cipherText, &plainTextResult, QCA::EME_PKCS1_OAEP ) ) {
std::cout << "Decryption process failed" << std::endl;
return 1;

View File

@ -46,7 +46,7 @@ int main(int argc, char **argv)
// It might not be printable, so this may not produce output
std::cout << "A random character: " << randChar << std::endl;
QSecureArray tenBytes(10);
QCA::SecureArray tenBytes(10);
// If you need more random values, you may want to
// get an array, as shown below.
tenBytes = QCA::Random::randomArray(10);

View File

@ -34,7 +34,7 @@ int main(int argc, char **argv)
// we use the first argument if provided, or
// use "hello" if no arguments
QSecureArray arg = (argc >= 2) ? argv[1] : "hello";
QCA::SecureArray arg = (argc >= 2) ? argv[1] : "hello";
// We demonstrate PEM usage here, so we need to test for
// supportedIOTypes, not just supportedTypes
@ -66,7 +66,7 @@ int main(int argc, char **argv)
// encrypt some data - note that only the public key is required
// you must also choose the algorithm to be used
QSecureArray result = pubkey.encrypt(arg, QCA::EME_PKCS1_OAEP);
QCA::SecureArray result = pubkey.encrypt(arg, QCA::EME_PKCS1_OAEP);
if(result.isEmpty()) {
std::cout << "Error encrypting" << std::endl;
return 1;
@ -80,7 +80,7 @@ int main(int argc, char **argv)
// save the private key - in a real example, make sure this goes
// somewhere secure and has a good pass phrase
// You can use the same technique with the public key too.
QSecureArray passPhrase = "pass phrase";
QCA::SecureArray passPhrase = "pass phrase";
seckey.toPEMFile("keyprivate.pem", passPhrase);
// Read that key back in, checking if the read succeeded
@ -94,7 +94,7 @@ int main(int argc, char **argv)
// now decrypt that encrypted data using the private key that
// we read in. The algorithm is the same.
QSecureArray decrypt;
QCA::SecureArray decrypt;
if(0 == privateKey.decrypt(result, &decrypt, QCA::EME_PKCS1_OAEP)) {
printf("Error decrypting.\n");
return 1;
@ -112,7 +112,7 @@ int main(int argc, char **argv)
}
privateKey.startSign( QCA::EMSA3_MD5 );
privateKey.update( arg ); // just reuse the same message
QSecureArray argSig = privateKey.signature();
QCA::SecureArray argSig = privateKey.signature();
// instead of using the startSign(), update(), signature() calls,
// you may be better doing the whole thing in one go, using the

View File

@ -51,24 +51,24 @@ void BigIntUnitTest::cleanupTestCase()
void BigIntUnitTest::allTests()
{
QBigInteger result;
QCA::BigInteger result;
// Some string conversion tests
QCOMPARE( QBigInteger("255").toString(), QBigInteger(255).toString() );
QCOMPARE( QBigInteger("-255").toString(), QBigInteger(-255).toString() );
QCOMPARE( QBigInteger("255").toString(), QString("255") );
QCOMPARE( QBigInteger("-255").toString(), QString("-255") );
QCOMPARE( QCA::BigInteger("255").toString(), QCA::BigInteger(255).toString() );
QCOMPARE( QCA::BigInteger("-255").toString(), QCA::BigInteger(-255).toString() );
QCOMPARE( QCA::BigInteger("255").toString(), QString("255") );
QCOMPARE( QCA::BigInteger("-255").toString(), QString("-255") );
// Some operator tests
QCOMPARE( QBigInteger("255") == QBigInteger(255), true );
QCOMPARE( QBigInteger("-255") == QBigInteger(-255), true );
QCOMPARE( QBigInteger("256") != QBigInteger(255), true );
QCOMPARE( QBigInteger("-256") != QBigInteger(-255), true );
QCOMPARE( QCA::BigInteger("255") == QCA::BigInteger(255), true );
QCOMPARE( QCA::BigInteger("-255") == QCA::BigInteger(-255), true );
QCOMPARE( QCA::BigInteger("256") != QCA::BigInteger(255), true );
QCOMPARE( QCA::BigInteger("-256") != QCA::BigInteger(-255), true );
// Some comparison tests
QBigInteger a( "4000000000000" );
QBigInteger b( "-4000000000000" );
QBigInteger c( "2000000000000" );
QCA::BigInteger a( "4000000000000" );
QCA::BigInteger b( "-4000000000000" );
QCA::BigInteger c( "2000000000000" );
QCOMPARE( a < b, false );
QCOMPARE( a <= b, false );
QCOMPARE( a.compare(b), 1 );
@ -85,597 +85,597 @@ void BigIntUnitTest::allTests()
QCOMPARE( testString, QString( "4000000000000-40000000000002000000000000\n") );
// Botan's addition tests
QCOMPARE( QBigInteger( 255 ) += QBigInteger ( 1 ), QBigInteger( 256 ) );
result = QBigInteger( 255 ) += QBigInteger( 1 );
QCOMPARE( result.toString(), QBigInteger( 256 ).toString() );
QCOMPARE( QCA::BigInteger( 255 ) += QCA::BigInteger ( 1 ), QCA::BigInteger( 256 ) );
result = QCA::BigInteger( 255 ) += QCA::BigInteger( 1 );
QCOMPARE( result.toString(), QCA::BigInteger( 256 ).toString() );
result = QBigInteger( "65535" ) += QBigInteger( "1" );
result = QCA::BigInteger( "65535" ) += QCA::BigInteger( "1" );
QCOMPARE( result.toString(), QString( "65536" ) );
QCOMPARE( result, QBigInteger( "65536") );
QCOMPARE( result, QCA::BigInteger( "65536") );
result = QBigInteger( "4294967295" ) += QBigInteger( 1 );
result = QCA::BigInteger( "4294967295" ) += QCA::BigInteger( 1 );
QCOMPARE( result.toString(), QString( "4294967296" ) );
QCOMPARE( result, QBigInteger( "4294967296" ) );
QCOMPARE( result, QCA::BigInteger( "4294967296" ) );
result = QBigInteger( "18446744073709551615" ) += QBigInteger( 1 );
result = QCA::BigInteger( "18446744073709551615" ) += QCA::BigInteger( 1 );
QCOMPARE( result.toString(), QString( "18446744073709551616" ) );
QCOMPARE( result, QBigInteger( "18446744073709551616" ) );
QCOMPARE( result, QCA::BigInteger( "18446744073709551616" ) );
result = QBigInteger( "124536363637272472" ) += QBigInteger( "124536363637272472" );
result = QCA::BigInteger( "124536363637272472" ) += QCA::BigInteger( "124536363637272472" );
QCOMPARE( result.toString(), QString ( "249072727274544944" ) );
QCOMPARE( result, QBigInteger ( "249072727274544944" ) );
QCOMPARE( result, QCA::BigInteger ( "249072727274544944" ) );
result = QBigInteger( "9223372036854775807" ) += QBigInteger( "281474976710655" );
result = QCA::BigInteger( "9223372036854775807" ) += QCA::BigInteger( "281474976710655" );
QCOMPARE( result.toString(), QString ( "9223653511831486462" ) );
QCOMPARE( result, QBigInteger ( "9223653511831486462" ) );
QCOMPARE( result, QCA::BigInteger ( "9223653511831486462" ) );
result = QBigInteger( "9223372036854775807" ) += QBigInteger( "137438953471" );
result = QCA::BigInteger( "9223372036854775807" ) += QCA::BigInteger( "137438953471" );
QCOMPARE( result.toString(), QString( "9223372174293729278" ) );
QCOMPARE( result, QBigInteger( "9223372174293729278" ) );
QCOMPARE( result, QCA::BigInteger( "9223372174293729278" ) );
// Botan's carry tests
result = QBigInteger( "340282366920938463463374607431768211455" )
+= QBigInteger( "340282366920938463463374607431768211455" );
result = QCA::BigInteger( "340282366920938463463374607431768211455" )
+= QCA::BigInteger( "340282366920938463463374607431768211455" );
QCOMPARE( result.toString(), QString( "680564733841876926926749214863536422910" ) );
QCOMPARE( result, QBigInteger( "680564733841876926926749214863536422910" ) );
QCOMPARE( result, QCA::BigInteger( "680564733841876926926749214863536422910" ) );
result = QBigInteger( "340282366920938463463374607431768211455" )
+= QBigInteger( "340282366920938463463374607431768211450" );
result = QCA::BigInteger( "340282366920938463463374607431768211455" )
+= QCA::BigInteger( "340282366920938463463374607431768211450" );
QCOMPARE( result.toString(), QString( "680564733841876926926749214863536422905" ) );
QCOMPARE( result, QBigInteger( "680564733841876926926749214863536422905" ) );
QCOMPARE( result, QCA::BigInteger( "680564733841876926926749214863536422905" ) );
result = QBigInteger( "115792089237316195423570985008687907853269984665640564039457584007913129639935" )
+= QBigInteger( "115792089237316195423570985008687907853269984665640564039457584007913129639935" );
result = QCA::BigInteger( "115792089237316195423570985008687907853269984665640564039457584007913129639935" )
+= QCA::BigInteger( "115792089237316195423570985008687907853269984665640564039457584007913129639935" );
QCOMPARE( result.toString(), QString( "231584178474632390847141970017375815706539969331281128078915168015826259279870" ) );
QCOMPARE( result, QBigInteger( "231584178474632390847141970017375815706539969331281128078915168015826259279870" ) );
QCOMPARE( result, QCA::BigInteger( "231584178474632390847141970017375815706539969331281128078915168015826259279870" ) );
result = QBigInteger( "115792089237316195423570985008687907853269984665640564039457584007913129639935" )
+= QBigInteger( "115792089237316195423570985008687907853269984665640564039457584007913129639919" );
result = QCA::BigInteger( "115792089237316195423570985008687907853269984665640564039457584007913129639935" )
+= QCA::BigInteger( "115792089237316195423570985008687907853269984665640564039457584007913129639919" );
QCOMPARE( result.toString(), QString( "231584178474632390847141970017375815706539969331281128078915168015826259279854") );
QCOMPARE( result, QBigInteger( "231584178474632390847141970017375815706539969331281128078915168015826259279854") );
QCOMPARE( result, QCA::BigInteger( "231584178474632390847141970017375815706539969331281128078915168015826259279854") );
result = QBigInteger( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084095" )
+= QBigInteger( "18446744073709551616" );
result = QCA::BigInteger( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084095" )
+= QCA::BigInteger( "18446744073709551616" );
QCOMPARE( result.toString(), QString( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946588393177722715635711" ) );
QCOMPARE( result, QBigInteger( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946588393177722715635711" ) );
QCOMPARE( result, QCA::BigInteger( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946588393177722715635711" ) );
result = QBigInteger( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084095" )
+= QBigInteger( "1" );
result = QCA::BigInteger( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084095" )
+= QCA::BigInteger( "1" );
QCOMPARE( result.toString(), QString( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084096" ) );
QCOMPARE( result, QBigInteger( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084096" ) );
QCOMPARE( result, QCA::BigInteger( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084096" ) );
result = QBigInteger( "-39794270013919406610834826960427146769766189764838473416502965291920535601112688579198627475284777498059330306128763345008528325994574657552726381901" )
+= QBigInteger( "-342238655038" );
result = QCA::BigInteger( "-39794270013919406610834826960427146769766189764838473416502965291920535601112688579198627475284777498059330306128763345008528325994574657552726381901" )
+= QCA::BigInteger( "-342238655038" );
QCOMPARE( result.toString(), QString( "-39794270013919406610834826960427146769766189764838473416502965291920535601112688579198627475284777498059330306128763345008528325994574657894965036939" ) );
QCOMPARE( result, QBigInteger( "-39794270013919406610834826960427146769766189764838473416502965291920535601112688579198627475284777498059330306128763345008528325994574657894965036939" ) );
QCOMPARE( result, QCA::BigInteger( "-39794270013919406610834826960427146769766189764838473416502965291920535601112688579198627475284777498059330306128763345008528325994574657894965036939" ) );
result = QBigInteger( "25110291853498940831251897922987678157346336093292373576945426289097725034326735312448621015537884914" )
+= QBigInteger( "-36551081154398645734533965739979697527373251608055056627686956281114038842935173436543461" );
result = QCA::BigInteger( "25110291853498940831251897922987678157346336093292373576945426289097725034326735312448621015537884914" )
+= QCA::BigInteger( "-36551081154398645734533965739979697527373251608055056627686956281114038842935173436543461" );
QCOMPARE( result.toString(), QString( "25110291853462389750097499277253144191606356395765000325337371232470038078045621273605685842101341453") );
QCOMPARE( result, QBigInteger( "25110291853462389750097499277253144191606356395765000325337371232470038078045621273605685842101341453") );
QCOMPARE( result, QCA::BigInteger( "25110291853462389750097499277253144191606356395765000325337371232470038078045621273605685842101341453") );
result = QBigInteger( "27802650352" )
+= QBigInteger( "660736146705288303126411072388564329913778942" );
result = QCA::BigInteger( "27802650352" )
+= QCA::BigInteger( "660736146705288303126411072388564329913778942" );
QCOMPARE( result.toString(), QString( "660736146705288303126411072388564357716429294" ) );
QCOMPARE( result, QBigInteger( "660736146705288303126411072388564357716429294" ) );
QCOMPARE( result, QCA::BigInteger( "660736146705288303126411072388564357716429294" ) );
result = QBigInteger( "-1348245899955041864800954463709881466231496038216683608715424566397833766910915722793041224478985289" )
+= QBigInteger( "11517149522866182358565152643595266257020228597058539113114732218008332987904361457299261161227276764386173666571334749062651694592291882972" );
result = QCA::BigInteger( "-1348245899955041864800954463709881466231496038216683608715424566397833766910915722793041224478985289" )
+= QCA::BigInteger( "11517149522866182358565152643595266257020228597058539113114732218008332987904361457299261161227276764386173666571334749062651694592291882972" );
QCOMPARE( result.toString(), QString( "11517149522866182358565152643595266257018880351158584071249931263544623106438129961261044477618561339819775832804423833339858653367812897683" ) );
QCOMPARE( result, QBigInteger( "11517149522866182358565152643595266257018880351158584071249931263544623106438129961261044477618561339819775832804423833339858653367812897683" ) );
QCOMPARE( result, QCA::BigInteger( "11517149522866182358565152643595266257018880351158584071249931263544623106438129961261044477618561339819775832804423833339858653367812897683" ) );
result = QBigInteger( "-17540530441681616962868251635133601915039026254996886583618243914226325157426408929602625346567256761818" )
+= QBigInteger( "865200427983527245206901810160356641402419461642082623179544681519016990" );
result = QCA::BigInteger( "-17540530441681616962868251635133601915039026254996886583618243914226325157426408929602625346567256761818" )
+= QCA::BigInteger( "865200427983527245206901810160356641402419461642082623179544681519016990" );
QCOMPARE( result.toString(), QString( "-17540530441681616962868251635132736714611042727751679681808083557584922737964766846979445801885737744828" ) );
QCOMPARE( result, QBigInteger( "-17540530441681616962868251635132736714611042727751679681808083557584922737964766846979445801885737744828" ) );
QCOMPARE( result, QCA::BigInteger( "-17540530441681616962868251635132736714611042727751679681808083557584922737964766846979445801885737744828" ) );
result = QBigInteger( "128844776074298261556398714096948603458177018275051329218555498374" )
+= QBigInteger( "443816313829150876362052235134610603220548928107697961229953611873695276391917150913346479060246759720475193648" );
result = QCA::BigInteger( "128844776074298261556398714096948603458177018275051329218555498374" )
+= QCA::BigInteger( "443816313829150876362052235134610603220548928107697961229953611873695276391917150913346479060246759720475193648" );
QCOMPARE( result.toString(), QString( "443816313829150876362052235134610603220548928236542737304251873430093990488865754371523497335298088939030692022" ) );
QCOMPARE( result, QBigInteger( "443816313829150876362052235134610603220548928236542737304251873430093990488865754371523497335298088939030692022" ) );
QCOMPARE( result, QCA::BigInteger( "443816313829150876362052235134610603220548928236542737304251873430093990488865754371523497335298088939030692022" ) );
result = QBigInteger( "1709484189262457846620911889502097055085989595277300243221975568275935717696463" )
+= QBigInteger( "-1646592344139809206374540620411514484579951199941360" );
result = QCA::BigInteger( "1709484189262457846620911889502097055085989595277300243221975568275935717696463" )
+= QCA::BigInteger( "-1646592344139809206374540620411514484579951199941360" );
QCOMPARE( result.toString(), QString( "1709484189262457846620911887855504710946180388902759622810461083695984517755103" ) );
QCOMPARE( result, QBigInteger( "1709484189262457846620911887855504710946180388902759622810461083695984517755103" ) );
QCOMPARE( result, QCA::BigInteger( "1709484189262457846620911887855504710946180388902759622810461083695984517755103" ) );
result = QBigInteger( "320175865429637176165709341576187102540180627806418015204928771170233538951323952509055929139673223273528062883083030595199153877335714942842" )
+= QBigInteger( "-2828241696960736089879965882386687935938570856545481227619497640844399275054327390050478930503975773972" );
result = QCA::BigInteger( "320175865429637176165709341576187102540180627806418015204928771170233538951323952509055929139673223273528062883083030595199153877335714942842" )
+= QCA::BigInteger( "-2828241696960736089879965882386687935938570856545481227619497640844399275054327390050478930503975773972" );
QCOMPARE( result.toString(), QString( "320175865429637176165709341576187102537352386109457279115048805287846851015385381652510447912053725632683663608028703205148674946831739168870" ) );
QCOMPARE( result, QBigInteger( "320175865429637176165709341576187102537352386109457279115048805287846851015385381652510447912053725632683663608028703205148674946831739168870" ) );
QCOMPARE( result, QCA::BigInteger( "320175865429637176165709341576187102537352386109457279115048805287846851015385381652510447912053725632683663608028703205148674946831739168870" ) );
result = QBigInteger( "-4035398360542181725908295312107496142105415014744259439963377204111754181625695349185753326709217" )
+= QBigInteger( "85450213703789913646546187382091037800" );
result = QCA::BigInteger( "-4035398360542181725908295312107496142105415014744259439963377204111754181625695349185753326709217" )
+= QCA::BigInteger( "85450213703789913646546187382091037800" );
QCOMPARE( result.toString(), QString( "-4035398360542181725908295312107496142105415014744259439963291753898050391712048802998371235671417" ) );
QCOMPARE( result, QBigInteger( "-4035398360542181725908295312107496142105415014744259439963291753898050391712048802998371235671417" ) );
QCOMPARE( result, QCA::BigInteger( "-4035398360542181725908295312107496142105415014744259439963291753898050391712048802998371235671417" ) );
result = QBigInteger( "-1292166446073479876801522363382357887431657639184151284775525387363973852756087726243671676713861533673009088319851" )
+= QBigInteger( "804538895874518175537499425282375058236245531798590350403343841766955572070643267141945695624895109330242749935754739434394691714971" );
result = QCA::BigInteger( "-1292166446073479876801522363382357887431657639184151284775525387363973852756087726243671676713861533673009088319851" )
+= QCA::BigInteger( "804538895874518175537499425282375058236245531798590350403343841766955572070643267141945695624895109330242749935754739434394691714971" );
QCOMPARE( result.toString(), QString( "804538895874518174245332979208895181434723168416232462971686202582804287295117879777971842868807383086571073221893205761385603395120" ) );
QCOMPARE( result, QBigInteger( "804538895874518174245332979208895181434723168416232462971686202582804287295117879777971842868807383086571073221893205761385603395120" ) );
QCOMPARE( result, QCA::BigInteger( "804538895874518174245332979208895181434723168416232462971686202582804287295117879777971842868807383086571073221893205761385603395120" ) );
result = QBigInteger( "-451986588700926309459451756852005697379481014956007968529234251884946522682901215022086432597024324062240835564200177389" )
+= QBigInteger( "15762983479" );
result = QCA::BigInteger( "-451986588700926309459451756852005697379481014956007968529234251884946522682901215022086432597024324062240835564200177389" )
+= QCA::BigInteger( "15762983479" );
QCOMPARE( result.toString(), QString( "-451986588700926309459451756852005697379481014956007968529234251884946522682901215022086432597024324062240835548437193910" ) );
QCOMPARE( result, QBigInteger( "-451986588700926309459451756852005697379481014956007968529234251884946522682901215022086432597024324062240835548437193910" ) );
QCOMPARE( result, QCA::BigInteger( "-451986588700926309459451756852005697379481014956007968529234251884946522682901215022086432597024324062240835548437193910" ) );
result = QBigInteger( "-3907475412115728816974567022055278374116794025624287474334038831885743634200801846649105209920908153587891040882946582394429615396962188674594744360388466" )
+= QBigInteger( "193893611236537854694879677478106237157079207398283117392998175454362643521031390" );
result = QCA::BigInteger( "-3907475412115728816974567022055278374116794025624287474334038831885743634200801846649105209920908153587891040882946582394429615396962188674594744360388466" )
+= QCA::BigInteger( "193893611236537854694879677478106237157079207398283117392998175454362643521031390" );
QCOMPARE( result.toString(), QString( "-3907475412115728816974567022055278374116794025624287474334038831885743634006908235412567355226028476109784803725867374996146498003964013220232100839357076" ) );
QCOMPARE( result, QBigInteger( "-3907475412115728816974567022055278374116794025624287474334038831885743634006908235412567355226028476109784803725867374996146498003964013220232100839357076" ) );
QCOMPARE( result, QCA::BigInteger( "-3907475412115728816974567022055278374116794025624287474334038831885743634006908235412567355226028476109784803725867374996146498003964013220232100839357076" ) );
result = QBigInteger( "-72603710637966201224690926289" )
+= QBigInteger( "-13618442642298533261581255034923612640512507150728017106768861506299813289801666559564532" );
result = QCA::BigInteger( "-72603710637966201224690926289" )
+= QCA::BigInteger( "-13618442642298533261581255034923612640512507150728017106768861506299813289801666559564532" );
QCOMPARE( result.toString(), QString( "-13618442642298533261581255034923612640512507150728017106768934110010451256002891250490821" ) );
QCOMPARE( result, QBigInteger( "-13618442642298533261581255034923612640512507150728017106768934110010451256002891250490821" ) );
QCOMPARE( result, QCA::BigInteger( "-13618442642298533261581255034923612640512507150728017106768934110010451256002891250490821" ) );
result = QBigInteger( "56077960835713056831402948406790747107889446769357509759472207603483968107693997028111823994257399379783658853302692762256851623103019589392739" )
+= QBigInteger( "-427057313888431079237360487703561848638868677065083968842" );
result = QCA::BigInteger( "56077960835713056831402948406790747107889446769357509759472207603483968107693997028111823994257399379783658853302692762256851623103019589392739" )
+= QCA::BigInteger( "-427057313888431079237360487703561848638868677065083968842" );
QCOMPARE( result.toString(), QString( "56077960835713056831402948406790747107889446769357509759472207603483968107693997028111396936943510948704421492814989200408212754425954505423897" ) );
QCOMPARE( result, QBigInteger( "56077960835713056831402948406790747107889446769357509759472207603483968107693997028111396936943510948704421492814989200408212754425954505423897" ) );
QCOMPARE( result, QCA::BigInteger( "56077960835713056831402948406790747107889446769357509759472207603483968107693997028111396936943510948704421492814989200408212754425954505423897" ) );
result = QBigInteger( "-2209800838508504443494783762534800337712101405156784708782197580824527899758308" )
+= QBigInteger( "42844076503039495864500213925837598507817708418354152774112078596443089606598570396235816327987463393971710495985285591895096794994387176281079" );
result = QCA::BigInteger( "-2209800838508504443494783762534800337712101405156784708782197580824527899758308" )
+= QCA::BigInteger( "42844076503039495864500213925837598507817708418354152774112078596443089606598570396235816327987463393971710495985285591895096794994387176281079" );
QCOMPARE( result.toString(), QString( "42844076503039495864500213925837598507817708418354152774112078594233288768090065952741032565452663056259609090828500883112899214169859276522771" ) );
QCOMPARE( result, QBigInteger( "42844076503039495864500213925837598507817708418354152774112078594233288768090065952741032565452663056259609090828500883112899214169859276522771" ) );
QCOMPARE( result, QCA::BigInteger( "42844076503039495864500213925837598507817708418354152774112078594233288768090065952741032565452663056259609090828500883112899214169859276522771" ) );
result = QBigInteger( "33887767308809826842417841176152232321272231788338404526859019370507113927387984766381329515371768224976188337692" )
+= QBigInteger( "349484339542971517481628970179002500341" );
result = QCA::BigInteger( "33887767308809826842417841176152232321272231788338404526859019370507113927387984766381329515371768224976188337692" )
+= QCA::BigInteger( "349484339542971517481628970179002500341" );
QCOMPARE( result.toString(), QString( "33887767308809826842417841176152232321272231788338404526859019370507113927737469105924301032853397195155190838033" ) );
QCOMPARE( result, QBigInteger( "33887767308809826842417841176152232321272231788338404526859019370507113927737469105924301032853397195155190838033" ) );
QCOMPARE( result, QCA::BigInteger( "33887767308809826842417841176152232321272231788338404526859019370507113927737469105924301032853397195155190838033" ) );
result = QBigInteger( "85748089639858660722587321621536298082690707526412426951630101551228144063151688592419555048867068162" )
+= QBigInteger( "-383634567691961960211191292397062452265352651123492760493087381707279" );
result = QCA::BigInteger( "85748089639858660722587321621536298082690707526412426951630101551228144063151688592419555048867068162" )
+= QCA::BigInteger( "-383634567691961960211191292397062452265352651123492760493087381707279" );
QCOMPARE( result.toString(), QString( "85748089639858660722587321621535914448123015564452215760337704488775878710500565099659061961485360883" ) );
QCOMPARE( result, QBigInteger( "85748089639858660722587321621535914448123015564452215760337704488775878710500565099659061961485360883" ) );
QCOMPARE( result, QCA::BigInteger( "85748089639858660722587321621535914448123015564452215760337704488775878710500565099659061961485360883" ) );
result = QBigInteger( "23889807888563742283608049816129153552608399262924421832404872043475" )
+= QBigInteger( "995" );
result = QCA::BigInteger( "23889807888563742283608049816129153552608399262924421832404872043475" )
+= QCA::BigInteger( "995" );
QCOMPARE( result.toString(), QString( "23889807888563742283608049816129153552608399262924421832404872044470" ) );
QCOMPARE( result, QBigInteger( "23889807888563742283608049816129153552608399262924421832404872044470" ) );
QCOMPARE( result, QCA::BigInteger( "23889807888563742283608049816129153552608399262924421832404872044470" ) );
result = QBigInteger( "-654786925833474864669230962582694222611472680701859262466465606239654996048306783957549697781271829257774329538985" )
+= QBigInteger( "-276137507159648540503039013089014674747" );
result = QCA::BigInteger( "-654786925833474864669230962582694222611472680701859262466465606239654996048306783957549697781271829257774329538985" )
+= QCA::BigInteger( "-276137507159648540503039013089014674747" );
QCOMPARE( result.toString(), QString( "-654786925833474864669230962582694222611472680701859262466465606239654996048582921464709346321774868270863344213732" ) );
QCOMPARE( result, QBigInteger( "-654786925833474864669230962582694222611472680701859262466465606239654996048582921464709346321774868270863344213732" ) );
QCOMPARE( result, QCA::BigInteger( "-654786925833474864669230962582694222611472680701859262466465606239654996048582921464709346321774868270863344213732" ) );
result = QBigInteger( "50463316268089933" )
+= QBigInteger( "-140591583463431806921000349498135287589005423318927850947894242995310138569473157521312413652439234324419130527702899917161307657443381774866237429" );
result = QCA::BigInteger( "50463316268089933" )
+= QCA::BigInteger( "-140591583463431806921000349498135287589005423318927850947894242995310138569473157521312413652439234324419130527702899917161307657443381774866237429" );
QCOMPARE( result.toString(), QString( "-140591583463431806921000349498135287589005423318927850947894242995310138569473157521312413652439234324419130527702899917161307657392918458598147496" ) );
QCOMPARE( result, QBigInteger( "-140591583463431806921000349498135287589005423318927850947894242995310138569473157521312413652439234324419130527702899917161307657392918458598147496" ) );
QCOMPARE( result, QCA::BigInteger( "-140591583463431806921000349498135287589005423318927850947894242995310138569473157521312413652439234324419130527702899917161307657392918458598147496" ) );
result = QBigInteger( "1339015021665554488163337105187026760232395594198925052890859936\
result = QCA::BigInteger( "1339015021665554488163337105187026760232395594198925052890859936\
418304234254229440059229155546157793544192" )
+= QBigInteger( "6294037420283433712414743361937677483761554699961644450461297486224793278823004487175687771163597590566132592591599249970281125781761944353272" );
+= QCA::BigInteger( "6294037420283433712414743361937677483761554699961644450461297486224793278823004487175687771163597590566132592591599249970281125781761944353272" );
QCOMPARE( result.toString(), QString( "6294037420283433712414743361937677485100569721627198938624634591411820039055400081374612824054457526984436826845828690029510281327919737897464" ) );
QCOMPARE( result, QBigInteger( "6294037420283433712414743361937677485100569721627198938624634591411820039055400081374612824054457526984436826845828690029510281327919737897464" ) );
QCOMPARE( result, QCA::BigInteger( "6294037420283433712414743361937677485100569721627198938624634591411820039055400081374612824054457526984436826845828690029510281327919737897464" ) );
result = QBigInteger( "-241446683" )
+= QBigInteger( "-282671163032866994488211995758272717472259277760825940523445628\
result = QCA::BigInteger( "-241446683" )
+= QCA::BigInteger( "-282671163032866994488211995758272717472259277760825940523445628\
442206062910449311538519756165635175664610569214430918184214" );
QCOMPARE( result.toString(), QString( "-282671163032866994488211995758272717472259277760825940523445628442206062910449311538519756165635175664610569214431159630897" ) );
QCOMPARE( result, QBigInteger( "-282671163032866994488211995758272717472259277760825940523445628442206062910449311538519756165635175664610569214431159630897" ) );
QCOMPARE( result, QCA::BigInteger( "-282671163032866994488211995758272717472259277760825940523445628442206062910449311538519756165635175664610569214431159630897" ) );
result = QBigInteger( "2358605503303452637996081421902056515951744611718383128442445119505739707550326378912342448355046239066896995563581" )
+= QBigInteger( "-3830437229145325165273364525551261440648845791949681661260946956860463720730123941973615" );
result = QCA::BigInteger( "2358605503303452637996081421902056515951744611718383128442445119505739707550326378912342448355046239066896995563581" )
+= QCA::BigInteger( "-3830437229145325165273364525551261440648845791949681661260946956860463720730123941973615" );
QCOMPARE( result.toString(), QString( "2358605503303452637996081418071619286806419446445018602891183678856893915600644717651395491494582518336773053589966" ) );
QCOMPARE( result, QBigInteger( "2358605503303452637996081418071619286806419446445018602891183678856893915600644717651395491494582518336773053589966" ) );
QCOMPARE( result, QCA::BigInteger( "2358605503303452637996081418071619286806419446445018602891183678856893915600644717651395491494582518336773053589966" ) );
result = QBigInteger( "1860794367587960058388097846258490" )
+= QBigInteger( "-237344494507203983863096991896035366478949095337787603280" );
result = QCA::BigInteger( "1860794367587960058388097846258490" )
+= QCA::BigInteger( "-237344494507203983863096991896035366478949095337787603280" );
QCOMPARE( result.toString(), QString( "-237344494507203983863095131101667778518890707239941344790" ) );
QCOMPARE( result, QBigInteger( "-237344494507203983863095131101667778518890707239941344790" ) );
QCOMPARE( result, QCA::BigInteger( "-237344494507203983863095131101667778518890707239941344790" ) );
result = QBigInteger( "-286399096802321907543674770412181810379003627366516307780436082546" )
+= QBigInteger( "6433131620680089024037442172197761714707480582555136398379812339597187475099646442833150194" );
result = QCA::BigInteger( "-286399096802321907543674770412181810379003627366516307780436082546" )
+= QCA::BigInteger( "6433131620680089024037442172197761714707480582555136398379812339597187475099646442833150194" );
QCOMPARE( result.toString(), QString( "6433131620680089024037441885798664912385573038880365986198001960593560108583338662397067648" ) );
QCOMPARE( result, QBigInteger( "6433131620680089024037441885798664912385573038880365986198001960593560108583338662397067648" ) );
QCOMPARE( result, QCA::BigInteger( "6433131620680089024037441885798664912385573038880365986198001960593560108583338662397067648" ) );
result = QBigInteger( "181180339077102369559537817583627894783322804181859729574752442572146800569023773490164987520541203125338295785763244283224569259250011493" )
+= QBigInteger( "-1199127665773503170250307078028035875479459397657178356959526245067549497129923023348187933280753018204983010837846725666878521137637491" );
result = QCA::BigInteger( "181180339077102369559537817583627894783322804181859729574752442572146800569023773490164987520541203125338295785763244283224569259250011493" )
+= QCA::BigInteger( "-1199127665773503170250307078028035875479459397657178356959526245067549497129923023348187933280753018204983010837846725666878521137637491" );
QCOMPARE( result.toString(), QString( "179981211411328866389287510505599858907843344784202551217792916327079251071893850466816799587260450107133312774925397557557690738112374002" ) );
QCOMPARE( result, QBigInteger( "179981211411328866389287510505599858907843344784202551217792916327079251071893850466816799587260450107133312774925397557557690738112374002" ) );
QCOMPARE( result, QCA::BigInteger( "179981211411328866389287510505599858907843344784202551217792916327079251071893850466816799587260450107133312774925397557557690738112374002" ) );
result = QBigInteger( "-64140201395555533811408642891620184652051275811075926176282032144915585503450776768366775652419022149512034611311149858695307750874152" )
+= QBigInteger( "174441039" );
result = QCA::BigInteger( "-64140201395555533811408642891620184652051275811075926176282032144915585503450776768366775652419022149512034611311149858695307750874152" )
+= QCA::BigInteger( "174441039" );
QCOMPARE( result.toString(), QString( "-64140201395555533811408642891620184652051275811075926176282032144915585503450776768366775652419022149512034611311149858695307576433113" ) );
QCOMPARE( result, QBigInteger( "-64140201395555533811408642891620184652051275811075926176282032144915585503450776768366775652419022149512034611311149858695307576433113" ) );
QCOMPARE( result, QCA::BigInteger( "-64140201395555533811408642891620184652051275811075926176282032144915585503450776768366775652419022149512034611311149858695307576433113" ) );
result = QBigInteger( "1272757944308835857208037878018507337530557445422230495561634616503724419877512717512360239259640193513601352202821462208896049331599624285621" )
+= QBigInteger( "7326562354017884140300121264633612334070903165496641915889499701\
result = QCA::BigInteger( "1272757944308835857208037878018507337530557445422230495561634616503724419877512717512360239259640193513601352202821462208896049331599624285621" )
+= QCA::BigInteger( "7326562354017884140300121264633612334070903165496641915889499701\
38457507491850467631029977010" );
QCOMPARE( result.toString(), QString( "1272757944308835857208037878018507337530557445422963151797036404917754432003976078745767329576189857705190302172959919716387899799230654262631" ) );
QCOMPARE( result, QBigInteger( "1272757944308835857208037878018507337530557445422963151797036404917754432003976078745767329576189857705190302172959919716387899799230654262631" ) );
QCOMPARE( result, QCA::BigInteger( "1272757944308835857208037878018507337530557445422963151797036404917754432003976078745767329576189857705190302172959919716387899799230654262631" ) );
result = QBigInteger( "-296171972628230" )
+= QBigInteger( "-8295766099121843219000823699362222865173820102569731517716391727126741710202086962877467940292139" );
result = QCA::BigInteger( "-296171972628230" )
+= QCA::BigInteger( "-8295766099121843219000823699362222865173820102569731517716391727126741710202086962877467940292139" );
QCOMPARE( result.toString(), QString( "-8295766099121843219000823699362222865173820102569731517716391727126741710202086963173639912920369" ) );
QCOMPARE( result, QBigInteger( "-8295766099121843219000823699362222865173820102569731517716391727126741710202086963173639912920369" ) );
QCOMPARE( result, QCA::BigInteger( "-8295766099121843219000823699362222865173820102569731517716391727126741710202086963173639912920369" ) );
result = QBigInteger( "746985914068199510024843682108839444828414222769191520615967632362127522466922882591" )
+= QBigInteger( "-20487191102299831461877807785745372724903547246374023" );
result = QCA::BigInteger( "746985914068199510024843682108839444828414222769191520615967632362127522466922882591" )
+= QCA::BigInteger( "-20487191102299831461877807785745372724903547246374023" );
QCOMPARE( result.toString(), QString( "746985914068199510024843682108818957637311922937729642808181886989402618919676508568" ) );
QCOMPARE( result, QBigInteger( "746985914068199510024843682108818957637311922937729642808181886989402618919676508568" ) );
QCOMPARE( result, QCA::BigInteger( "746985914068199510024843682108818957637311922937729642808181886989402618919676508568" ) );
result = QBigInteger( "-4" )
+= QBigInteger( "-2344390090753264806043234960981151613122271366762590006930318876906455201397017135" );
result = QCA::BigInteger( "-4" )
+= QCA::BigInteger( "-2344390090753264806043234960981151613122271366762590006930318876906455201397017135" );
QCOMPARE( result.toString(), QString( "-2344390090753264806043234960981151613122271366762590006930318876906455201397017139" ) );
QCOMPARE( result, QBigInteger( "-2344390090753264806043234960981151613122271366762590006930318876906455201397017139" ) );
QCOMPARE( result, QCA::BigInteger( "-2344390090753264806043234960981151613122271366762590006930318876906455201397017139" ) );
result = QBigInteger( "-44876180273995737337769331875058141129678736711749946388832275767882143882764" )
+= QBigInteger( "20982187786" );
result = QCA::BigInteger( "-44876180273995737337769331875058141129678736711749946388832275767882143882764" )
+= QCA::BigInteger( "20982187786" );
QCOMPARE( result.toString(), QString( "-44876180273995737337769331875058141129678736711749946388832275767861161694978" ) );
QCOMPARE( result, QBigInteger( "-44876180273995737337769331875058141129678736711749946388832275767861161694978" ) );
QCOMPARE( result, QCA::BigInteger( "-44876180273995737337769331875058141129678736711749946388832275767861161694978" ) );
result = QBigInteger( "-6019440082648243511340058232981487443695615379104154368957939907896782179207195666302228625496897271988494" )
+= QBigInteger( "532566302499155416003316607801593784583652720754079760364736422291735917382015688217276924340984564880" );
result = QCA::BigInteger( "-6019440082648243511340058232981487443695615379104154368957939907896782179207195666302228625496897271988494" )
+= QCA::BigInteger( "532566302499155416003316607801593784583652720754079760364736422291735917382015688217276924340984564880" );
QCOMPARE( result.toString(), QString( "-6018907516345744355924054916373685849911031726383400289197575171474490443289813650614011348572556287423614" ) );
QCOMPARE( result, QBigInteger( "-6018907516345744355924054916373685849911031726383400289197575171474490443289813650614011348572556287423614" ) );
QCOMPARE( result, QCA::BigInteger( "-6018907516345744355924054916373685849911031726383400289197575171474490443289813650614011348572556287423614" ) );
result = QBigInteger( "-73755471563616026847726349357167530833850959662921059052928229237814728719448868719278211294785998253117976812683153264088230182865250970217610487" )
+= QBigInteger( "-30100016097092378349958946184353117306134810372681" );
result = QCA::BigInteger( "-73755471563616026847726349357167530833850959662921059052928229237814728719448868719278211294785998253117976812683153264088230182865250970217610487" )
+= QCA::BigInteger( "-30100016097092378349958946184353117306134810372681" );
QCOMPARE( result.toString(), QString( "-73755471563616026847726349357167530833850959662921059052928229237814728719448868719278211294786028353134073905061503223034414535982557105027983168" ) );
QCOMPARE( result, QBigInteger( "-73755471563616026847726349357167530833850959662921059052928229237814728719448868719278211294786028353134073905061503223034414535982557105027983168" ) );
QCOMPARE( result, QCA::BigInteger( "-73755471563616026847726349357167530833850959662921059052928229237814728719448868719278211294786028353134073905061503223034414535982557105027983168" ) );
result = QBigInteger( "-2211177066689704345686852756638946306674958952044447080285364283965878599873864667094550865713828159912" )
+= QBigInteger( "-5365560439372456892007565798761606781997269201538475736814780300517383963455858081652308237033460360040921820049494698892905680307378540208" );
result = QCA::BigInteger( "-2211177066689704345686852756638946306674958952044447080285364283965878599873864667094550865713828159912" )
+= QCA::BigInteger( "-5365560439372456892007565798761606781997269201538475736814780300517383963455858081652308237033460360040921820049494698892905680307378540208" );
QCOMPARE( result.toString(), QString( "-5365560439372456892007565798761606784208446268228180082501633057156330270130817033696755317318824644006800419923359365987456546021206700120" ) );
QCOMPARE( result, QBigInteger( "-5365560439372456892007565798761606784208446268228180082501633057156330270130817033696755317318824644006800419923359365987456546021206700120" ) );
QCOMPARE( result, QCA::BigInteger( "-5365560439372456892007565798761606784208446268228180082501633057156330270130817033696755317318824644006800419923359365987456546021206700120" ) );
result = QBigInteger( "6074122512337108841968521649035076841633691574254417104144285970819068715158037023149867252146570418484850234979838064249373816163440" )
+= QBigInteger( "301843614094506325875637699" );
result = QCA::BigInteger( "6074122512337108841968521649035076841633691574254417104144285970819068715158037023149867252146570418484850234979838064249373816163440" )
+= QCA::BigInteger( "301843614094506325875637699" );
QCOMPARE( result.toString(), QString( "6074122512337108841968521649035076841633691574254417104144285970819068715158037023149867252146570418484850536823452158755699691801139" ) );
QCOMPARE( result, QBigInteger( "6074122512337108841968521649035076841633691574254417104144285970819068715158037023149867252146570418484850536823452158755699691801139" ) );
QCOMPARE( result, QCA::BigInteger( "6074122512337108841968521649035076841633691574254417104144285970819068715158037023149867252146570418484850536823452158755699691801139" ) );
result = QBigInteger( "-518214776931158149908771340564348982010543985108065053479219152734659892042499774128809654713651547833087206893256740737426200715673766732196603988" )
+= QBigInteger( "-29835172557747693726115525887386137004674545311422557345658884038760353928226157702249175218280718951979" );
result = QCA::BigInteger( "-518214776931158149908771340564348982010543985108065053479219152734659892042499774128809654713651547833087206893256740737426200715673766732196603988" )
+= QCA::BigInteger( "-29835172557747693726115525887386137004674545311422557345658884038760353928226157702249175218280718951979" );
QCOMPARE( result.toString(), QString( "-518214776931158149908771340564348982010544014943237611226912878850185779428636778803354966136208893491971245653610668963583902964848985012915555967" ) );
QCOMPARE( result, QBigInteger( "-518214776931158149908771340564348982010544014943237611226912878850185779428636778803354966136208893491971245653610668963583902964848985012915555967" ) );
QCOMPARE( result, QCA::BigInteger( "-518214776931158149908771340564348982010544014943237611226912878850185779428636778803354966136208893491971245653610668963583902964848985012915555967" ) );
result = QBigInteger( "15937412249227240968245047444122" )
+= QBigInteger( "186214680376169426108822450700978827886569053440254258585576645530381613666540347032550716844628275956253" );
result = QCA::BigInteger( "15937412249227240968245047444122" )
+= QCA::BigInteger( "186214680376169426108822450700978827886569053440254258585576645530381613666540347032550716844628275956253" );
QCOMPARE( result.toString(), QString( "186214680376169426108822450700978827886569053440254258585576645530381613682477759281777957812873323400375" ) );
QCOMPARE( result, QBigInteger( "186214680376169426108822450700978827886569053440254258585576645530381613682477759281777957812873323400375" ) );
QCOMPARE( result, QCA::BigInteger( "186214680376169426108822450700978827886569053440254258585576645530381613682477759281777957812873323400375" ) );
result = QBigInteger( "-12528010116258685855047504252928107623923105458701761707911969527003855713485846140551107967495813584097081777160" )
+= QBigInteger( "-539986280927242338236008809854961759996986302156061552378097160849129372827386927545686899193598721998757419572890" );
result = QCA::BigInteger( "-12528010116258685855047504252928107623923105458701761707911969527003855713485846140551107967495813584097081777160" )
+= QCA::BigInteger( "-539986280927242338236008809854961759996986302156061552378097160849129372827386927545686899193598721998757419572890" );
QCOMPARE( result.toString(), QString( "-552514291043501024091056314107889867620909407614763314086009130376133228540872773686238007161094535582854501350050" ) );
QCOMPARE( result, QBigInteger( "-552514291043501024091056314107889867620909407614763314086009130376133228540872773686238007161094535582854501350050" ) );
QCOMPARE( result, QCA::BigInteger( "-552514291043501024091056314107889867620909407614763314086009130376133228540872773686238007161094535582854501350050" ) );
result = QBigInteger( "-2454746908" )
+= QBigInteger( "-3822957127889394780055242156360370187075592078655552376050604679934415014573879513870030211860839641756441626913419699098985245833920954444218" );
result = QCA::BigInteger( "-2454746908" )
+= QCA::BigInteger( "-3822957127889394780055242156360370187075592078655552376050604679934415014573879513870030211860839641756441626913419699098985245833920954444218" );
QCOMPARE( result.toString(), QString( "-3822957127889394780055242156360370187075592078655552376050604679934415014573879513870030211860839641756441626913419699098985245833923409191126" ) );
QCOMPARE( result, QBigInteger( "-3822957127889394780055242156360370187075592078655552376050604679934415014573879513870030211860839641756441626913419699098985245833923409191126" ) );
QCOMPARE( result, QCA::BigInteger( "-3822957127889394780055242156360370187075592078655552376050604679934415014573879513870030211860839641756441626913419699098985245833923409191126" ) );
result = QBigInteger( "-54288706131860071583318409080596095357980447323635" )
+= QBigInteger( "-425339410556015631098973742993327323051438456819027069606294261157940297643297240559452124432779202181589763874" );
result = QCA::BigInteger( "-54288706131860071583318409080596095357980447323635" )
+= QCA::BigInteger( "-425339410556015631098973742993327323051438456819027069606294261157940297643297240559452124432779202181589763874" );
QCOMPARE( result.toString(), QString( "-425339410556015631098973742993327323051438456819027069606294315446646429503368823877861205028874560162037087509" ) );
QCOMPARE( result, QBigInteger( "-425339410556015631098973742993327323051438456819027069606294315446646429503368823877861205028874560162037087509" ) );
QCOMPARE( result, QCA::BigInteger( "-425339410556015631098973742993327323051438456819027069606294315446646429503368823877861205028874560162037087509" ) );
result = QBigInteger( "1418766894051319870818496026367686195459604395660119754151922014257535705077512233275240217434104" )
+= QBigInteger( "-111987390206074845527" );
result = QCA::BigInteger( "1418766894051319870818496026367686195459604395660119754151922014257535705077512233275240217434104" )
+= QCA::BigInteger( "-111987390206074845527" );
QCOMPARE( result.toString(), QString( "1418766894051319870818496026367686195459604395660119754151922014257535705077400245885034142588577" ) );
QCOMPARE( result, QBigInteger( "1418766894051319870818496026367686195459604395660119754151922014257535705077400245885034142588577" ) );
QCOMPARE( result, QCA::BigInteger( "1418766894051319870818496026367686195459604395660119754151922014257535705077400245885034142588577" ) );
result = QBigInteger( "-690410131860410477456103857594543515409677479242833618634809302452962600476353286822550168231234854116465153078845744722987447719420052500874721214723" )
+= QBigInteger( "-2584690377433946747311356992432788361455494791066739384837409609897387109736539600623155880918146331681272708396146283818299" );
result = QCA::BigInteger( "-690410131860410477456103857594543515409677479242833618634809302452962600476353286822550168231234854116465153078845744722987447719420052500874721214723" )
+= QCA::BigInteger( "-2584690377433946747311356992432788361455494791066739384837409609897387109736539600623155880918146331681272708396146283818299" );
QCOMPARE( result.toString(), QString( "-690410131860410477456103860179233892843624226554190611067597663908457391543092671659959778128621963853004753702001625641133779400692760897021005033022" ) );
QCOMPARE( result, QBigInteger( "-690410131860410477456103860179233892843624226554190611067597663908457391543092671659959778128621963853004753702001625641133779400692760897021005033022" ) );
QCOMPARE( result, QCA::BigInteger( "-690410131860410477456103860179233892843624226554190611067597663908457391543092671659959778128621963853004753702001625641133779400692760897021005033022" ) );
result = QBigInteger( "-2326153002179462643778624079324592172489363679671158" )
+= QBigInteger( "-109819757548464054181938329012610459679" );
result = QCA::BigInteger( "-2326153002179462643778624079324592172489363679671158" )
+= QCA::BigInteger( "-109819757548464054181938329012610459679" );
QCOMPARE( result.toString(), QString( "-2326153002179572463536172543378774110818376290130837" ) );
QCOMPARE( result, QBigInteger( "-2326153002179572463536172543378774110818376290130837" ) );
QCOMPARE( result, QCA::BigInteger( "-2326153002179572463536172543378774110818376290130837" ) );
result = QBigInteger( "-4428752250566525488353857709194941742993785578807911414016959206453045495320705299466107784149485981354180907411034982168391" )
+= QBigInteger( "-39247778259374215325521768005388007526581235832446540589720560855741992694947322437679214611686905696" );
result = QCA::BigInteger( "-4428752250566525488353857709194941742993785578807911414016959206453045495320705299466107784149485981354180907411034982168391" )
+= QCA::BigInteger( "-39247778259374215325521768005388007526581235832446540589720560855741992694947322437679214611686905696" );
QCOMPARE( result.toString(), QString( "-4428752250566525488353896956973201117209111100575916802024485787688877941861295020026963526142180928676618586625646669074087" ) );
QCOMPARE( result, QBigInteger( "-4428752250566525488353896956973201117209111100575916802024485787688877941861295020026963526142180928676618586625646669074087" ) );
QCOMPARE( result, QCA::BigInteger( "-4428752250566525488353896956973201117209111100575916802024485787688877941861295020026963526142180928676618586625646669074087" ) );
result = QBigInteger( "3047" )
+= QBigInteger( "-73564587850313153523776932163719610733433776890390204618040173797196000100856070829277943048343156165795282307508135277641315214" );
result = QCA::BigInteger( "3047" )
+= QCA::BigInteger( "-73564587850313153523776932163719610733433776890390204618040173797196000100856070829277943048343156165795282307508135277641315214" );
QCOMPARE( result.toString(), QString( "-73564587850313153523776932163719610733433776890390204618040173797196000100856070829277943048343156165795282307508135277641312167" ) );
QCOMPARE( result, QBigInteger( "-73564587850313153523776932163719610733433776890390204618040173797196000100856070829277943048343156165795282307508135277641312167" ) );
QCOMPARE( result, QCA::BigInteger( "-73564587850313153523776932163719610733433776890390204618040173797196000100856070829277943048343156165795282307508135277641312167" ) );
result = QBigInteger( "71397189765381049110362731262243394989390499523719445987286843598407339615555456955143712741779487184644001767776382991377987516772847242986" )
+= QBigInteger( "-5821969555717973232123574849275726788359152255219972775831" );
result = QCA::BigInteger( "71397189765381049110362731262243394989390499523719445987286843598407339615555456955143712741779487184644001767776382991377987516772847242986" )
+= QCA::BigInteger( "-5821969555717973232123574849275726788359152255219972775831" );
QCOMPARE( result.toString(), QString( "71397189765381049110362731262243394989390499523719445987286843598407339615555456949321743186061513952520426918500656203018835261552874467155" ) );
QCOMPARE( result, QBigInteger( "71397189765381049110362731262243394989390499523719445987286843598407339615555456949321743186061513952520426918500656203018835261552874467155" ) );
QCOMPARE( result, QCA::BigInteger( "71397189765381049110362731262243394989390499523719445987286843598407339615555456949321743186061513952520426918500656203018835261552874467155" ) );
result = QBigInteger( "-181409752656613138777964092635909379021826360390960647186726991165227400176766831466541160049935205507919070233410228328274" )
+= QBigInteger( "-523301382154855044703947051892202646490840761177533623732372519689918420769842424772676407501350528096714904915297347684247802773107355881667545916901" );
result = QCA::BigInteger( "-181409752656613138777964092635909379021826360390960647186726991165227400176766831466541160049935205507919070233410228328274" )
+= QCA::BigInteger( "-523301382154855044703947051892202646490840761177533623732372519689918420769842424772676407501350528096714904915297347684247802773107355881667545916901" );
QCOMPARE( result.toString(), QString( "-523301382154855044703947052073612399147453899955497716368281898711744781160803071959403398666577928273481736381838507734183008281026426115077774245175" ) );
QCOMPARE( result, QBigInteger( "-523301382154855044703947052073612399147453899955497716368281898711744781160803071959403398666577928273481736381838507734183008281026426115077774245175" ) );
QCOMPARE( result, QCA::BigInteger( "-523301382154855044703947052073612399147453899955497716368281898711744781160803071959403398666577928273481736381838507734183008281026426115077774245175" ) );
result = QBigInteger( "6858961373707073067" )
+= QBigInteger( "-334051508933893061433844279764271107181974906283364991309903077649971606436918071327072869826471946094594594115614990907" );
result = QCA::BigInteger( "6858961373707073067" )
+= QCA::BigInteger( "-334051508933893061433844279764271107181974906283364991309903077649971606436918071327072869826471946094594594115614990907" );
QCOMPARE( result.toString(), QString( "-334051508933893061433844279764271107181974906283364991309903077649971606436918071327072869826471946087735632741907917840" ) );
QCOMPARE( result, QBigInteger( "-334051508933893061433844279764271107181974906283364991309903077649971606436918071327072869826471946087735632741907917840" ) );
QCOMPARE( result, QCA::BigInteger( "-334051508933893061433844279764271107181974906283364991309903077649971606436918071327072869826471946087735632741907917840" ) );
result = QBigInteger( "-23635098930374569407171906960429616870908424281519944658490940109956689534874971218650241680916564611" )
+= QBigInteger( "-18958917875779522833599589133142827952448539301142718746979271443846670235982743793439686626736428198541647202983677887505430060922528525205" );
result = QCA::BigInteger( "-23635098930374569407171906960429616870908424281519944658490940109956689534874971218650241680916564611" )
+= QCA::BigInteger( "-18958917875779522833599589133142827952448539301142718746979271443846670235982743793439686626736428198541647202983677887505430060922528525205" );
QCOMPARE( result.toString(), QString( "-18958917875779522833599589133142827952472174400073093316386443350807099852853652217721206571394919138651603892518552858724080302603445089816" ) );
QCOMPARE( result, QBigInteger( "-18958917875779522833599589133142827952472174400073093316386443350807099852853652217721206571394919138651603892518552858724080302603445089816" ) );
QCOMPARE( result, QCA::BigInteger( "-18958917875779522833599589133142827952472174400073093316386443350807099852853652217721206571394919138651603892518552858724080302603445089816" ) );
// Botan's subtraction tests
result = QBigInteger( "0" )
-= QBigInteger( "0" );
result = QCA::BigInteger( "0" )
-= QCA::BigInteger( "0" );
QCOMPARE( result.toString(), QString( "0" ) );
QCOMPARE( result, QBigInteger( "0" ) );
QCOMPARE( result, QCA::BigInteger( "0" ) );
result = QBigInteger( "0" )
-= QBigInteger( "1" );
result = QCA::BigInteger( "0" )
-= QCA::BigInteger( "1" );
QCOMPARE( result.toString(), QString( "-1" ) );
QCOMPARE( result, QBigInteger( "-1" ) );
QCOMPARE( result, QCA::BigInteger( "-1" ) );
result = QBigInteger( "0" )
-= QBigInteger( "4294967296" );
result = QCA::BigInteger( "0" )
-= QCA::BigInteger( "4294967296" );
QCOMPARE( result.toString(), QString( "-4294967296" ) );
QCOMPARE( result, QBigInteger( "-4294967296" ) );
QCOMPARE( result, QCA::BigInteger( "-4294967296" ) );
// Next test is labelled # 2^512 - 1
result = QBigInteger( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084095" )
-= QBigInteger( "1" );
result = QCA::BigInteger( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084095" )
-= QCA::BigInteger( "1" );
QCOMPARE( result.toString(), QString( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084094" ) );
QCOMPARE( result, QBigInteger( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084094" ) );
QCOMPARE( result, QCA::BigInteger( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084094" ) );
result = QBigInteger( "89094716573076464980713547115099137014719483620102078148320806773871083148864" )
-= QBigInteger( "49505213825110728957828173754776257356620450607893971553289366249708672306581" );
result = QCA::BigInteger( "89094716573076464980713547115099137014719483620102078148320806773871083148864" )
-= QCA::BigInteger( "49505213825110728957828173754776257356620450607893971553289366249708672306581" );
QCOMPARE( result.toString(), QString( "39589502747965736022885373360322879658099033012208106595031440524162410842283" ) );
QCOMPARE( result, QBigInteger( "39589502747965736022885373360322879658099033012208106595031440524162410842283" ) );
QCOMPARE( result, QCA::BigInteger( "39589502747965736022885373360322879658099033012208106595031440524162410842283" ) );
result = QBigInteger( "65894747009896006767807716946835412110318548717263922395390971078905789585431" )
-= QBigInteger( "3884269741925508225990715416862047284194603799902650748631039608684367281358" );
result = QCA::BigInteger( "65894747009896006767807716946835412110318548717263922395390971078905789585431" )
-= QCA::BigInteger( "3884269741925508225990715416862047284194603799902650748631039608684367281358" );
QCOMPARE( result.toString(), QString( "62010477267970498541817001529973364826123944917361271646759931470221422304073" ) );
QCOMPARE( result, QBigInteger( "62010477267970498541817001529973364826123944917361271646759931470221422304073" ) );
QCOMPARE( result, QCA::BigInteger( "62010477267970498541817001529973364826123944917361271646759931470221422304073" ) );
result = QBigInteger( "5950196396451977566902121301707054218364717196893101360011491777761952253736964709165962613347710607164178682987783755894811024288429224592316636383" )
-= QBigInteger( "8750653273562160761286422180115618621879821429145276197424652349306577311499807887070429373153777028581165316131683348567" );
result = QCA::BigInteger( "5950196396451977566902121301707054218364717196893101360011491777761952253736964709165962613347710607164178682987783755894811024288429224592316636383" )
-= QCA::BigInteger( "8750653273562160761286422180115618621879821429145276197424652349306577311499807887070429373153777028581165316131683348567" );
QCOMPARE( result.toString(), QString( "5950196396451977566902121292956400944802556435606679179895873155882130824591688511741310264041133295664370795917354382741033995707263908460633287816" ) );
QCOMPARE( result, QBigInteger( "5950196396451977566902121292956400944802556435606679179895873155882130824591688511741310264041133295664370795917354382741033995707263908460633287816" ) );
QCOMPARE( result, QCA::BigInteger( "5950196396451977566902121292956400944802556435606679179895873155882130824591688511741310264041133295664370795917354382741033995707263908460633287816" ) );
result = QBigInteger( "9815262808265519920770782360080149146267723690" )
-= QBigInteger( "14067005768891609281364919358115291341352189918255780397560060748765650205261663193732434161580120817" );
result = QCA::BigInteger( "9815262808265519920770782360080149146267723690" )
-= QCA::BigInteger( "14067005768891609281364919358115291341352189918255780397560060748765650205261663193732434161580120817" );
QCOMPARE( result.toString(), QString( "-14067005768891609281364919358115291341352189918255780387744797940500130284490880833652285015312397127" ) );
QCOMPARE( result, QBigInteger( "-14067005768891609281364919358115291341352189918255780387744797940500130284490880833652285015312397127" ) );
QCOMPARE( result, QCA::BigInteger( "-14067005768891609281364919358115291341352189918255780387744797940500130284490880833652285015312397127" ) );
result = QBigInteger( "-390149102941948621568479722346940666704376013734485343840154221605853412503154993878886490867020934777530894593416337175399865065870417717658815158195790" )
-= QBigInteger( "1456031684988128870809574635750149625240648487837308" );
result = QCA::BigInteger( "-390149102941948621568479722346940666704376013734485343840154221605853412503154993878886490867020934777530894593416337175399865065870417717658815158195790" )
-= QCA::BigInteger( "1456031684988128870809574635750149625240648487837308" );
QCOMPARE( result.toString(), QString( "-390149102941948621568479722346940666704376013734485343840154221605853412503154993878886490867020934778986926278404466046209439701620567342899463646033098" ) );
QCOMPARE( result, QBigInteger( "-390149102941948621568479722346940666704376013734485343840154221605853412503154993878886490867020934778986926278404466046209439701620567342899463646033098" ) );
QCOMPARE( result, QCA::BigInteger( "-390149102941948621568479722346940666704376013734485343840154221605853412503154993878886490867020934778986926278404466046209439701620567342899463646033098" ) );
result = QBigInteger( "7473774301764883450943" )
-= QBigInteger( "-26256369859367890755157372820052387483402723790185562908491933812453" );
result = QCA::BigInteger( "7473774301764883450943" )
-= QCA::BigInteger( "-26256369859367890755157372820052387483402723790185562908491933812453" );
QCOMPARE( result.toString(), QString( "26256369859367890755157372820052387483402723797659337210256817263396" ) );
QCOMPARE( result, QBigInteger( "26256369859367890755157372820052387483402723797659337210256817263396" ) );
QCOMPARE( result, QCA::BigInteger( "26256369859367890755157372820052387483402723797659337210256817263396" ) );
result = QBigInteger( "36246343251214922024139186757009148849295485593397952003237349660142296147421019916619944353877490544706223768684758263065399016597969" )
-= QBigInteger( "2574427901445527995149185461475228850098549655325125750771680756403104624569522792792597223218143154924988199562355517064962665954307425375180" );
result = QCA::BigInteger( "36246343251214922024139186757009148849295485593397952003237349660142296147421019916619944353877490544706223768684758263065399016597969" )
-= QCA::BigInteger( "2574427901445527995149185461475228850098549655325125750771680756403104624569522792792597223218143154924988199562355517064962665954307425375180" );
QCOMPARE( result.toString(), QString( "-2574427865199184743934263437336042093089400806029640157373728753165754964427226645371577306598198801047497654856131748380204402888908408777211" ) );
QCOMPARE( result, QBigInteger( "-2574427865199184743934263437336042093089400806029640157373728753165754964427226645371577306598198801047497654856131748380204402888908408777211" ) );
QCOMPARE( result, QCA::BigInteger( "-2574427865199184743934263437336042093089400806029640157373728753165754964427226645371577306598198801047497654856131748380204402888908408777211" ) );
result = QBigInteger( "30129746266682790628283889040897642317014108334116727" )
-= QBigInteger( "-1580480523895398762563721715474380903630073871362143915864398724834897608423" );
result = QCA::BigInteger( "30129746266682790628283889040897642317014108334116727" )
-= QCA::BigInteger( "-1580480523895398762563721715474380903630073871362143915864398724834897608423" );
QCOMPARE( result.toString(), QString( "1580480523895398762563751845220647586420702155251184813506715738943231725150" ) );
QCOMPARE( result, QBigInteger( "1580480523895398762563751845220647586420702155251184813506715738943231725150" ) );
QCOMPARE( result, QCA::BigInteger( "1580480523895398762563751845220647586420702155251184813506715738943231725150" ) );
result = QBigInteger( "-4614735863800137951667138933166372061" )
-= QBigInteger( "87175694379075561307234146162193190462135078700346746992273" );
result = QCA::BigInteger( "-4614735863800137951667138933166372061" )
-= QCA::BigInteger( "87175694379075561307234146162193190462135078700346746992273" );
QCOMPARE( result.toString(), QString( "-87175694379075561307238760898056990600086745839279913364334" ) );
QCOMPARE( result, QBigInteger( "-87175694379075561307238760898056990600086745839279913364334" ) );
QCOMPARE( result, QCA::BigInteger( "-87175694379075561307238760898056990600086745839279913364334" ) );
result = QBigInteger( "-3753904" )
-= QBigInteger( "-11269137783745339515071988205310702154422777729974" );
result = QCA::BigInteger( "-3753904" )
-= QCA::BigInteger( "-11269137783745339515071988205310702154422777729974" );
QCOMPARE( result.toString(), QString( "11269137783745339515071988205310702154422773976070" ) );
QCOMPARE( result, QBigInteger( "11269137783745339515071988205310702154422773976070" ) );
QCOMPARE( result, QCA::BigInteger( "11269137783745339515071988205310702154422773976070" ) );
result = QBigInteger( "592523948495379440082021279738170088402918858455470050140652787171830058864932939900794505955437856926902975870288" )
-= QBigInteger( "-205854658295495452479104108497931263758143158076949293929661651111" );
result = QCA::BigInteger( "592523948495379440082021279738170088402918858455470050140652787171830058864932939900794505955437856926902975870288" )
-= QCA::BigInteger( "-205854658295495452479104108497931263758143158076949293929661651111" );
QCOMPARE( result.toString(), QString( "592523948495379440082021279738170088402918858455675904798948282624309162973430871164552649113514806220832637521399" ) );
QCOMPARE( result, QBigInteger( "592523948495379440082021279738170088402918858455675904798948282624309162973430871164552649113514806220832637521399" ) );
QCOMPARE( result, QCA::BigInteger( "592523948495379440082021279738170088402918858455675904798948282624309162973430871164552649113514806220832637521399" ) );
result = QBigInteger( "-33993701617495591491176844355" )
-= QBigInteger( "3438065097398894672826284379125235190693300918673662774192379185002391232383325160416036963599856704698280" );
result = QCA::BigInteger( "-33993701617495591491176844355" )
-= QCA::BigInteger( "3438065097398894672826284379125235190693300918673662774192379185002391232383325160416036963599856704698280" );
QCOMPARE( result.toString(), QString( "-3438065097398894672826284379125235190693300918673662774192379185002391232383359154117654459191347881542635" ) );
QCOMPARE( result, QBigInteger( "-3438065097398894672826284379125235190693300918673662774192379185002391232383359154117654459191347881542635" ) );
QCOMPARE( result, QCA::BigInteger( "-3438065097398894672826284379125235190693300918673662774192379185002391232383359154117654459191347881542635" ) );
result = QBigInteger( "26876428790838270949718735111909136008255051776703" )
-= QBigInteger( "-1781128112966810373286192008831149275546995635268767241859967609117529616872536681035700534316457543887601645022" );
result = QCA::BigInteger( "26876428790838270949718735111909136008255051776703" )
-= QCA::BigInteger( "-1781128112966810373286192008831149275546995635268767241859967609117529616872536681035700534316457543887601645022" );
QCOMPARE( result.toString(), QString( "1781128112966810373286192008831149275546995635268767241859967635993958407710807630754435646225593552142653421725" ) );
QCOMPARE( result, QBigInteger( "1781128112966810373286192008831149275546995635268767241859967635993958407710807630754435646225593552142653421725" ) );
QCOMPARE( result, QCA::BigInteger( "1781128112966810373286192008831149275546995635268767241859967635993958407710807630754435646225593552142653421725" ) );
result = QBigInteger( "2059771092932179758019770618974659367350250375647433386639519387\
result = QCA::BigInteger( "2059771092932179758019770618974659367350250375647433386639519387\
69317693429941871882153770641334267205446421916220398066553188" )
-= QBigInteger( "3342500267594994347156312297990633112620923791590960237694328174171473763026" );
-= QCA::BigInteger( "3342500267594994347156312297990633112620923791590960237694328174171473763026" );
QCOMPARE( result.toString(), QString( "205977109293217975801977061897465936735025037564739996163684343774970537117643881249041149717542676245208727588046226592790162" ) );
QCOMPARE( result, QBigInteger( "205977109293217975801977061897465936735025037564739996163684343774970537117643881249041149717542676245208727588046226592790162" ) );
QCOMPARE( result, QCA::BigInteger( "205977109293217975801977061897465936735025037564739996163684343774970537117643881249041149717542676245208727588046226592790162" ) );
result = QBigInteger( "5545520403000578843599072515870982842927227412121917598877293331575380404618111609" )
-= QBigInteger( "5991287327241003718821424770352575362437680738923552868139860461945460339860477495902" );
result = QCA::BigInteger( "5545520403000578843599072515870982842927227412121917598877293331575380404618111609" )
-= QCA::BigInteger( "5991287327241003718821424770352575362437680738923552868139860461945460339860477495902" );
QCOMPARE( result.toString(), QString( "-5985741806838003139977825697836704379594753511511430950540983168613884959455859384293" ) );
QCOMPARE( result, QBigInteger( "-5985741806838003139977825697836704379594753511511430950540983168613884959455859384293" ) );
QCOMPARE( result, QCA::BigInteger( "-5985741806838003139977825697836704379594753511511430950540983168613884959455859384293" ) );
result = QBigInteger( "248039029608125071340" )
-= QBigInteger( "3664608673" );
result = QCA::BigInteger( "248039029608125071340" )
-= QCA::BigInteger( "3664608673" );
QCOMPARE( result.toString(), QString( "248039029604460462667" ) );
QCOMPARE( result, QBigInteger( "248039029604460462667" ) );
QCOMPARE( result, QCA::BigInteger( "248039029604460462667" ) );
result = QBigInteger( "15425705711415937103627" )
-= QBigInteger( "-1435504065517745703440045276868982910754081405474123003767554211132837427846963435621523810229738262235546179779885824" );
result = QCA::BigInteger( "15425705711415937103627" )
-= QCA::BigInteger( "-1435504065517745703440045276868982910754081405474123003767554211132837427846963435621523810229738262235546179779885824" );
QCOMPARE( result.toString(), QString( "1435504065517745703440045276868982910754081405474123003767554211132837427846963435621523810229753687941257595716989451" ) );
QCOMPARE( result, QBigInteger( "1435504065517745703440045276868982910754081405474123003767554211132837427846963435621523810229753687941257595716989451" ) );
QCOMPARE( result, QCA::BigInteger( "1435504065517745703440045276868982910754081405474123003767554211132837427846963435621523810229753687941257595716989451" ) );
result = QBigInteger( "50882847205108645607281568922683652688671738236030732914347600821086" )
-= QBigInteger( "12176160963158" );
result = QCA::BigInteger( "50882847205108645607281568922683652688671738236030732914347600821086" )
-= QCA::BigInteger( "12176160963158" );
QCOMPARE( result.toString(), QString( "50882847205108645607281568922683652688671738236030732902171439857928" ) );
QCOMPARE( result, QBigInteger( "50882847205108645607281568922683652688671738236030732902171439857928" ) );
QCOMPARE( result, QCA::BigInteger( "50882847205108645607281568922683652688671738236030732902171439857928" ) );
result = QBigInteger( "-35426518565985818947670047877033022885542172461973566228509771053416312543201815881190953762207629232160412058300173038824256783171761132" )
-= QBigInteger( "-4864862607366468843184694353123830534588538011093812418208808135799" );
result = QCA::BigInteger( "-35426518565985818947670047877033022885542172461973566228509771053416312543201815881190953762207629232160412058300173038824256783171761132" )
-= QCA::BigInteger( "-4864862607366468843184694353123830534588538011093812418208808135799" );
QCOMPARE( result.toString(), QString( "-35426518565985818947670047877033022885542172461973566228509771053416307678339208514722110577513276108329877469762161945011838574363625333" ) );
QCOMPARE( result, QBigInteger( "-35426518565985818947670047877033022885542172461973566228509771053416307678339208514722110577513276108329877469762161945011838574363625333" ) );
QCOMPARE( result, QCA::BigInteger( "-35426518565985818947670047877033022885542172461973566228509771053416307678339208514722110577513276108329877469762161945011838574363625333" ) );
result = QBigInteger( "-1428596214712268310382144828171384812520179141608121870013556402879770424002218157546599921571184" )
-= QBigInteger( "-4054101" );
result = QCA::BigInteger( "-1428596214712268310382144828171384812520179141608121870013556402879770424002218157546599921571184" )
-= QCA::BigInteger( "-4054101" );
QCOMPARE( result.toString(), QString( "-1428596214712268310382144828171384812520179141608121870013556402879770424002218157546599917517083" ) );
QCOMPARE( result, QBigInteger( "-1428596214712268310382144828171384812520179141608121870013556402879770424002218157546599917517083" ) );
QCOMPARE( result, QCA::BigInteger( "-1428596214712268310382144828171384812520179141608121870013556402879770424002218157546599917517083" ) );
result = QBigInteger( "-200931" )
-= QBigInteger( "-44558802460130495759482832913160717791151786725570519475449607659705171682283111490834930835045735142966847483009157514950177565952218520297258834187372" );
result = QCA::BigInteger( "-200931" )
-= QCA::BigInteger( "-44558802460130495759482832913160717791151786725570519475449607659705171682283111490834930835045735142966847483009157514950177565952218520297258834187372" );
QCOMPARE( result.toString(), QString( "44558802460130495759482832913160717791151786725570519475449607659705171682283111490834930835045735142966847483009157514950177565952218520297258833986441" ) );
QCOMPARE( result, QBigInteger( "44558802460130495759482832913160717791151786725570519475449607659705171682283111490834930835045735142966847483009157514950177565952218520297258833986441" ) );
QCOMPARE( result, QCA::BigInteger( "44558802460130495759482832913160717791151786725570519475449607659705171682283111490834930835045735142966847483009157514950177565952218520297258833986441" ) );
result = QBigInteger( "105704314890799915321259" )
-= QBigInteger( "827923545945076415574912438499169814414563066877494100831657761190490697473854369477784874118787495351405549803329615347120938123226038208" );
result = QCA::BigInteger( "105704314890799915321259" )
-= QCA::BigInteger( "827923545945076415574912438499169814414563066877494100831657761190490697473854369477784874118787495351405549803329615347120938123226038208" );
QCOMPARE( result.toString(), QString( "-827923545945076415574912438499169814414563066877494100831657761190490697473854369477784874118787495351405549803329509642806047323310716949" ) );
QCOMPARE( result, QBigInteger( "-827923545945076415574912438499169814414563066877494100831657761190490697473854369477784874118787495351405549803329509642806047323310716949" ) );
QCOMPARE( result, QCA::BigInteger( "-827923545945076415574912438499169814414563066877494100831657761190490697473854369477784874118787495351405549803329509642806047323310716949" ) );
result = QBigInteger( "1448979433940064018828919290452280235308901982649341" )
-= QBigInteger( "303926827425887072291878308433008512899006711759770318009" );
result = QCA::BigInteger( "1448979433940064018828919290452280235308901982649341" )
-= QCA::BigInteger( "303926827425887072291878308433008512899006711759770318009" );
QCOMPARE( result.toString(), QString( "-303925378446453132227859479513718060618771402857787668668" ) );
QCOMPARE( result, QBigInteger( "-303925378446453132227859479513718060618771402857787668668" ) );
QCOMPARE( result, QCA::BigInteger( "-303925378446453132227859479513718060618771402857787668668" ) );
result = QBigInteger( "-243237595290235750457450892290434789864" )
-= QBigInteger( "19817702076334276402981273067417321098467533300947463865383702005126562800253466403934608765512316565811954342319565128573969" );
result = QCA::BigInteger( "-243237595290235750457450892290434789864" )
-= QCA::BigInteger( "19817702076334276402981273067417321098467533300947463865383702005126562800253466403934608765512316565811954342319565128573969" );
QCOMPARE( result.toString(), QString( "-19817702076334276402981273067417321098467533300947463865383702005126562800253466403934852003107606801562411793211855563363833" ) );
QCOMPARE( result, QBigInteger( "-19817702076334276402981273067417321098467533300947463865383702005126562800253466403934852003107606801562411793211855563363833" ) );
QCOMPARE( result, QCA::BigInteger( "-19817702076334276402981273067417321098467533300947463865383702005126562800253466403934852003107606801562411793211855563363833" ) );
result = QBigInteger( "294037338365659932242802023634" )
-= QBigInteger( "4401245995535867764294876849802142926077599828776505639975554254356763769548465" );
result = QCA::BigInteger( "294037338365659932242802023634" )
-= QCA::BigInteger( "4401245995535867764294876849802142926077599828776505639975554254356763769548465" );
QCOMPARE( result.toString(), QString( "-4401245995535867764294876849802142926077599828776211602637188594424520967524831" ) );
QCOMPARE( result, QBigInteger( "-4401245995535867764294876849802142926077599828776211602637188594424520967524831" ) );
QCOMPARE( result, QCA::BigInteger( "-4401245995535867764294876849802142926077599828776211602637188594424520967524831" ) );
result = QBigInteger( "7303853946195223307036710881687367004566538357189824031021831088365362" )
-= QBigInteger( "119286025999378935715794641163321741" );
result = QCA::BigInteger( "7303853946195223307036710881687367004566538357189824031021831088365362" )
-= QCA::BigInteger( "119286025999378935715794641163321741" );
QCOMPARE( result.toString(), QString( "7303853946195223307036710881687366885280512357810888315227189925043621" ) );
QCOMPARE( result, QBigInteger( "7303853946195223307036710881687366885280512357810888315227189925043621" ) );
QCOMPARE( result, QCA::BigInteger( "7303853946195223307036710881687366885280512357810888315227189925043621" ) );
result = QBigInteger( "571167355343287235687602610714110416067426289363505412908804940696550592413192300554016875" )
-= QBigInteger( "15872188842802631759540597" );
result = QCA::BigInteger( "571167355343287235687602610714110416067426289363505412908804940696550592413192300554016875" )
-= QCA::BigInteger( "15872188842802631759540597" );
QCOMPARE( result.toString(), QString( "571167355343287235687602610714110416067426289363505412908804940680678403570389668794476278" ) );
QCOMPARE( result, QBigInteger( "571167355343287235687602610714110416067426289363505412908804940680678403570389668794476278" ) );
QCOMPARE( result, QCA::BigInteger( "571167355343287235687602610714110416067426289363505412908804940680678403570389668794476278" ) );
result = QBigInteger( "1002240129784524388754179399598974973256811336031329881209395070412702275169416754240" )
-= QBigInteger( "59429482478860591343145393540420033516478305952872349006715789477946474753657206800070515207967709079933420746952" );
result = QCA::BigInteger( "1002240129784524388754179399598974973256811336031329881209395070412702275169416754240" )
-= QCA::BigInteger( "59429482478860591343145393540420033516478305952872349006715789477946474753657206800070515207967709079933420746952" );
QCOMPARE( result.toString(), QString( "-59429482478860591343145393539417793386693781564118169607116814504689663417625876918861120137555006804764003992712" ) );
QCOMPARE( result, QBigInteger( "-59429482478860591343145393539417793386693781564118169607116814504689663417625876918861120137555006804764003992712" ) );
QCOMPARE( result, QCA::BigInteger( "-59429482478860591343145393539417793386693781564118169607116814504689663417625876918861120137555006804764003992712" ) );
result = QBigInteger( "1370431648825444838359719050380239722263203134555431526491525074601463042144798545817957389" )
-= QBigInteger( "3473869878" );
result = QCA::BigInteger( "1370431648825444838359719050380239722263203134555431526491525074601463042144798545817957389" )
-= QCA::BigInteger( "3473869878" );
QCOMPARE( result.toString(), QString( "1370431648825444838359719050380239722263203134555431526491525074601463042144798542344087511" ) );
QCOMPARE( result, QBigInteger( "1370431648825444838359719050380239722263203134555431526491525074601463042144798542344087511" ) );
QCOMPARE( result, QCA::BigInteger( "1370431648825444838359719050380239722263203134555431526491525074601463042144798542344087511" ) );
result = QBigInteger( "8548280229254726209" )
-= QBigInteger( "33066125035269904981849320434016892734943145935582141989968280846973981913056248918" );
result = QCA::BigInteger( "8548280229254726209" )
-= QCA::BigInteger( "33066125035269904981849320434016892734943145935582141989968280846973981913056248918" );
QCOMPARE( result.toString(), QString( "-33066125035269904981849320434016892734943145935582141989968280838425701683801522709" ) );
QCOMPARE( result, QBigInteger( "-33066125035269904981849320434016892734943145935582141989968280838425701683801522709" ) );
QCOMPARE( result, QCA::BigInteger( "-33066125035269904981849320434016892734943145935582141989968280838425701683801522709" ) );
result = QBigInteger( "-19023558832687506489508150795966332175990129963029928958584170111759630293276939647334082100169102538364437859846398095065171936899503" )
-= QBigInteger( "24899271127523545342283468762809653407638631966220124695751976894193103779443050843040771191227522843088079031762445684377195650493065096847292797" );
result = QCA::BigInteger( "-19023558832687506489508150795966332175990129963029928958584170111759630293276939647334082100169102538364437859846398095065171936899503" )
-= QCA::BigInteger( "24899271127523545342283468762809653407638631966220124695751976894193103779443050843040771191227522843088079031762445684377195650493065096847292797" );
QCOMPARE( result.toString(), QString( "-24899271127542568901116156269299161558434598298396114825715006823151687949554810473334048130874856925188248134300810122237042048588130268784192300" ) );
QCOMPARE( result, QBigInteger( "-24899271127542568901116156269299161558434598298396114825715006823151687949554810473334048130874856925188248134300810122237042048588130268784192300" ) );
QCOMPARE( result, QCA::BigInteger( "-24899271127542568901116156269299161558434598298396114825715006823151687949554810473334048130874856925188248134300810122237042048588130268784192300" ) );
result = QBigInteger( "-1800353575522706389288305623797196690530870204356722928042061228497437075035917720399302198953687023" )
-= QBigInteger( "-11875668261530466053708538730940776412171106483072624532757177471384128016458332544642788404765469924496127460164" );
result = QCA::BigInteger( "-1800353575522706389288305623797196690530870204356722928042061228497437075035917720399302198953687023" )
-= QCA::BigInteger( "-11875668261530466053708538730940776412171106483072624532757177471384128016458332544642788404765469924496127460164" );
QCOMPARE( result.toString(), QString( "11875668261528665700133016024551488106547309286382093662552820748456085955229835107567752487045070622297173773141" ) );
QCOMPARE( result, QBigInteger( "11875668261528665700133016024551488106547309286382093662552820748456085955229835107567752487045070622297173773141" ) );
QCOMPARE( result, QCA::BigInteger( "11875668261528665700133016024551488106547309286382093662552820748456085955229835107567752487045070622297173773141" ) );
result = QBigInteger( "-29861551039945217879" )
-= QBigInteger( "1113473025916855642353456146647542930581669082348409639697282960877889226500319996380838232582376232872868947624793789212829885934" );
result = QCA::BigInteger( "-29861551039945217879" )
-= QCA::BigInteger( "1113473025916855642353456146647542930581669082348409639697282960877889226500319996380838232582376232872868947624793789212829885934" );
QCOMPARE( result.toString(), QString( "-1113473025916855642353456146647542930581669082348409639697282960877889226500319996380838232582376232872868947654655340252775103813" ) );
QCOMPARE( result, QBigInteger( "-1113473025916855642353456146647542930581669082348409639697282960877889226500319996380838232582376232872868947654655340252775103813" ) );
QCOMPARE( result, QCA::BigInteger( "-1113473025916855642353456146647542930581669082348409639697282960877889226500319996380838232582376232872868947654655340252775103813" ) );
result = QBigInteger( "565532963656761153838218277564957917658707297649757920676303301655328103665512287797108510139837643506491641987188791892506290" )
-= QBigInteger( "-2188105671531473889939411772533707" );
result = QCA::BigInteger( "565532963656761153838218277564957917658707297649757920676303301655328103665512287797108510139837643506491641987188791892506290" )
-= QCA::BigInteger( "-2188105671531473889939411772533707" );
QCOMPARE( result.toString(), QString( "565532963656761153838218277564957917658707297649757920676303301655328103665512287797108510142025749178023115877128203665039997" ) );
QCOMPARE( result, QBigInteger( "565532963656761153838218277564957917658707297649757920676303301655328103665512287797108510142025749178023115877128203665039997" ) );
QCOMPARE( result, QCA::BigInteger( "565532963656761153838218277564957917658707297649757920676303301655328103665512287797108510142025749178023115877128203665039997" ) );
result = QBigInteger( "-349535960680522202843083381184496349093812380954435872337802226" )
-= QBigInteger( "-1829600726218222026679938" );
result = QCA::BigInteger( "-349535960680522202843083381184496349093812380954435872337802226" )
-= QCA::BigInteger( "-1829600726218222026679938" );
QCOMPARE( result.toString(), QString( "-349535960680522202843083381184496349091982780228217650311122288" ) );
QCOMPARE( result, QBigInteger( "-349535960680522202843083381184496349091982780228217650311122288" ) );
QCOMPARE( result, QCA::BigInteger( "-349535960680522202843083381184496349091982780228217650311122288" ) );
result = QBigInteger( "-1" ) -= QBigInteger( "-6726974989587128275" );
result = QCA::BigInteger( "-1" ) -= QCA::BigInteger( "-6726974989587128275" );
QCOMPARE( result.toString(), QString( "6726974989587128274" ) );
QCOMPARE( result, QBigInteger( "6726974989587128274" ) );
QCOMPARE( result, QCA::BigInteger( "6726974989587128274" ) );
result = QBigInteger( "-107142709838121196902389095205618516687047338619382145236348309762148611647954748824" )
-= QBigInteger( "42484103615491" );
result = QCA::BigInteger( "-107142709838121196902389095205618516687047338619382145236348309762148611647954748824" )
-= QCA::BigInteger( "42484103615491" );
QCOMPARE( result.toString(), QString( "-107142709838121196902389095205618516687047338619382145236348309762148654132058364315" ) );
QCOMPARE( result, QBigInteger( "-107142709838121196902389095205618516687047338619382145236348309762148654132058364315" ) );
QCOMPARE( result, QCA::BigInteger( "-107142709838121196902389095205618516687047338619382145236348309762148654132058364315" ) );
result = QBigInteger( "-90546630430085769764839607528116121381848878494574360812027599640018921358040178215575723" )
-= QBigInteger( "-118922408531468986902800063237122125617455464103913195171141030774109638861272017660698580914239435114280434761425243" );
result = QCA::BigInteger( "-90546630430085769764839607528116121381848878494574360812027599640018921358040178215575723" )
-= QCA::BigInteger( "-118922408531468986902800063237122125617455464103913195171141030774109638861272017660698580914239435114280434761425243" );
QCOMPARE( result.toString(), QString( "118922408531468986902800063146575495187369694339073587643024909392260760366697656848670981274220513756240256545849520" ) );
QCOMPARE( result, QBigInteger( "118922408531468986902800063146575495187369694339073587643024909392260760366697656848670981274220513756240256545849520" ) );
QCOMPARE( result, QCA::BigInteger( "118922408531468986902800063146575495187369694339073587643024909392260760366697656848670981274220513756240256545849520" ) );
result = QBigInteger( "-5545044667082427128801726416727657360001588430113578182850657573063241939882570324573086267287272360432363387213743735507218270373633222520429" )
-= QBigInteger( "-151423255459028627628896755237194376177115" );
result = QCA::BigInteger( "-5545044667082427128801726416727657360001588430113578182850657573063241939882570324573086267287272360432363387213743735507218270373633222520429" )
-= QCA::BigInteger( "-151423255459028627628896755237194376177115" );
QCOMPARE( result.toString(), QString( "-5545044667082427128801726416727657360001588430113578182850657573063241939882570324573086267287272360280940131754715107878321515136438846343314" ) );
QCOMPARE( result, QBigInteger( "-5545044667082427128801726416727657360001588430113578182850657573063241939882570324573086267287272360280940131754715107878321515136438846343314" ) );
QCOMPARE( result, QCA::BigInteger( "-5545044667082427128801726416727657360001588430113578182850657573063241939882570324573086267287272360280940131754715107878321515136438846343314" ) );
result = QBigInteger( "-5247636471953421659649611318164848102069" )
-= QBigInteger( "-4024324110573096565232590473170599175885004" );
result = QCA::BigInteger( "-5247636471953421659649611318164848102069" )
-= QCA::BigInteger( "-4024324110573096565232590473170599175885004" );
QCOMPARE( result.toString(), QString( "4019076474101143143572940861852434327782935" ) );
QCOMPARE( result, QBigInteger( "4019076474101143143572940861852434327782935" ) );
QCOMPARE( result, QCA::BigInteger( "4019076474101143143572940861852434327782935" ) );
result = QBigInteger( "39412892606015043322484854253879371723186457838590224795040178472832" )
-= QBigInteger( "-5038321321957452145034687815432890684825466579123474921848465393400312" );
result = QCA::BigInteger( "39412892606015043322484854253879371723186457838590224795040178472832" )
-= QCA::BigInteger( "-5038321321957452145034687815432890684825466579123474921848465393400312" );
QCOMPARE( result.toString(), QString( "5077734214563467188357172669686770056548653036962065146643505571873144" ) );
QCOMPARE( result, QBigInteger( "5077734214563467188357172669686770056548653036962065146643505571873144" ) );
QCOMPARE( result, QCA::BigInteger( "5077734214563467188357172669686770056548653036962065146643505571873144" ) );
result = QBigInteger( "-55979414588009227035683624505208766753187469727799640277204274207843317583292736333912783829528270272642583004969175230274821" )
-= QBigInteger( "-109633110576212669339535976775635762395927171313557427036242111476016398579345366908401334025571265714128108308032073779442181369365924213118258269679" );
result = QCA::BigInteger( "-55979414588009227035683624505208766753187469727799640277204274207843317583292736333912783829528270272642583004969175230274821" )
-= QCA::BigInteger( "-109633110576212669339535976775635762395927171313557427036242111476016398579345366908401334025571265714128108308032073779442181369365924213118258269679" );
QCOMPARE( result.toString(), QString( "109633110576212669339535920796221174386700135629932921827475358288546670779705089704127126182253682421391774395248244251171908726782919243943027994858" ) );
QCOMPARE( result, QBigInteger( "109633110576212669339535920796221174386700135629932921827475358288546670779705089704127126182253682421391774395248244251171908726782919243943027994858" ) );
QCOMPARE( result, QCA::BigInteger( "109633110576212669339535920796221174386700135629932921827475358288546670779705089704127126182253682421391774395248244251171908726782919243943027994858" ) );
result = QBigInteger( "-38752353898173389347479216285772999906325286421302866854350737050533204094183249691110" )
-= QBigInteger( "2428819407377764342156426895396654728835493564788997075896393065230009911546390816091652653701035085361" );
result = QCA::BigInteger( "-38752353898173389347479216285772999906325286421302866854350737050533204094183249691110" )
-= QCA::BigInteger( "2428819407377764342156426895396654728835493564788997075896393065230009911546390816091652653701035085361" );
QCOMPARE( result.toString(), QString( "-2428819407377764380908780793570044076314709850561996982221679486532876765897127866624856747884284776471" ) );
QCOMPARE( result, QBigInteger( "-2428819407377764380908780793570044076314709850561996982221679486532876765897127866624856747884284776471" ) );
QCOMPARE( result, QCA::BigInteger( "-2428819407377764380908780793570044076314709850561996982221679486532876765897127866624856747884284776471" ) );
result = QBigInteger( "-2784579005241382005249492720344" )
-= QBigInteger( "-164204542616919252351131740123094674" );
result = QCA::BigInteger( "-2784579005241382005249492720344" )
-= QCA::BigInteger( "-164204542616919252351131740123094674" );
QCOMPARE( result.toString(), QString( "164201758037914010969126490630374330" ) );
QCOMPARE( result, QBigInteger( "164201758037914010969126490630374330" ) );
QCOMPARE( result, QCA::BigInteger( "164201758037914010969126490630374330" ) );
result = QBigInteger( "200948857420871544747808060972375039052401280822505804851732868100" )
-= QBigInteger( "-795957177479360455258269298038670876462147576765875895105714" );
result = QCA::BigInteger( "200948857420871544747808060972375039052401280822505804851732868100" )
-= QCA::BigInteger( "-795957177479360455258269298038670876462147576765875895105714" );
QCOMPARE( result.toString(), QString( "200949653378049024108263319241673077723277742970082570727627973814" ) );
QCOMPARE( result, QBigInteger( "200949653378049024108263319241673077723277742970082570727627973814" ) );
QCOMPARE( result, QCA::BigInteger( "200949653378049024108263319241673077723277742970082570727627973814" ) );
result = QBigInteger( "217570540819" )
-= QBigInteger( "121955083597720420983384282166693307394185530431368476834980748302158718406063500763434561937200696970170700" );
result = QCA::BigInteger( "217570540819" )
-= QCA::BigInteger( "121955083597720420983384282166693307394185530431368476834980748302158718406063500763434561937200696970170700" );
QCOMPARE( result.toString(), QString( "-121955083597720420983384282166693307394185530431368476834980748302158718406063500763434561937200479399629881" ) );
QCOMPARE( result, QBigInteger( QString("-121955083597720420983384282166693307394185530431368476834980748302158718406063500763434561937200479399629881" ) ) );
QCOMPARE( result, QCA::BigInteger( QString("-121955083597720420983384282166693307394185530431368476834980748302158718406063500763434561937200479399629881" ) ) );
result = QBigInteger( QString("2335319252198456765380587281374076367944") )
-= QBigInteger( QString("-4500271") );
QCOMPARE( result, QBigInteger( QString( "2335319252198456765380587281374080868215" ) ) );
result = QCA::BigInteger( QString("2335319252198456765380587281374076367944") )
-= QCA::BigInteger( QString("-4500271") );
QCOMPARE( result, QCA::BigInteger( QString( "2335319252198456765380587281374080868215" ) ) );
result = QBigInteger( QString("-393694614027544181700073367147249369966344727230221941008713805434207925307052598" ) )
-= QBigInteger( QString("-153972676737062409261153899615588515236137907791841623991260363840680295565313157972489168132345521780658007459602823125797806770" ) );
result = QCA::BigInteger( QString("-393694614027544181700073367147249369966344727230221941008713805434207925307052598" ) )
-= QCA::BigInteger( QString("-153972676737062409261153899615588515236137907791841623991260363840680295565313157972489168132345521780658007459602823125797806770" ) );
QCOMPARE( result.toString(), QString( "153972676737062409261153899615588515236137907791447929377232819658980222198165908602522823405115299839649293654168615200490754172" ) );
QCOMPARE( result, QBigInteger( QString("153972676737062409261153899615588515236137907791447929377232819658980222198165908602522823405115299839649293654168615200490754172" ) ) );
QCOMPARE( result, QCA::BigInteger( QString("153972676737062409261153899615588515236137907791447929377232819658980222198165908602522823405115299839649293654168615200490754172" ) ) );
result = QBigInteger( QString("114832549702862263167") )
-= QBigInteger( QString("12921864907229959558745276418830287875386673600892281022286597165773569473039953984775959232814911435097412913078625") );
result = QCA::BigInteger( QString("114832549702862263167") )
-= QCA::BigInteger( QString("12921864907229959558745276418830287875386673600892281022286597165773569473039953984775959232814911435097412913078625") );
QCOMPARE( result.toString(), QString( "-12921864907229959558745276418830287875386673600892281022286597165773569473039953984775959232814796602547710050815458" ) );
QCOMPARE( result, QBigInteger( QString( "-12921864907229959558745276418830287875386673600892281022286597165773569473039953984775959232814796602547710050815458" ) ) );
QCOMPARE( result, QCA::BigInteger( QString( "-12921864907229959558745276418830287875386673600892281022286597165773569473039953984775959232814796602547710050815458" ) ) );
result = QBigInteger( QString( "6489502346837936889305337487724547956628371915228387374094443896266362105931065153072983425911767580294076594078932835008494777866083" ) )
-= QBigInteger( QString( "1099205476533612407829257935144627350486541654788267826664706620630745291371323154513322608446957760026881954001581" ) );
result = QCA::BigInteger( QString( "6489502346837936889305337487724547956628371915228387374094443896266362105931065153072983425911767580294076594078932835008494777866083" ) )
-= QCA::BigInteger( QString( "1099205476533612407829257935144627350486541654788267826664706620630745291371323154513322608446957760026881954001581" ) );
QCOMPARE( result.toString(), QString( "6489502346837936888206132011190935548799113980083760023607902241478094279266358532442238134540444425780753985631975074981612823864502" ) );
QCOMPARE( result, QBigInteger( QString("6489502346837936888206132011190935548799113980083760023607902241478094279266358532442238134540444425780753985631975074981612823864502" ) ) );
QCOMPARE( result, QCA::BigInteger( QString("6489502346837936888206132011190935548799113980083760023607902241478094279266358532442238134540444425780753985631975074981612823864502" ) ) );
result = QBigInteger( QString("169991144123958754253801313173662977337850870273358378951640521601077152994474340806917796870911557233689087716056557" ) )
-= QBigInteger( QString("-15409167") );
result = QCA::BigInteger( QString("169991144123958754253801313173662977337850870273358378951640521601077152994474340806917796870911557233689087716056557" ) )
-= QCA::BigInteger( QString("-15409167") );
QCOMPARE( result.toString(), QString( "169991144123958754253801313173662977337850870273358378951640521601077152994474340806917796870911557233689087731465724" ) );
QCOMPARE( result, QBigInteger( QString("169991144123958754253801313173662977337850870273358378951640521601077152994474340806917796870911557233689087731465724") ) );
QCOMPARE( result, QCA::BigInteger( QString("169991144123958754253801313173662977337850870273358378951640521601077152994474340806917796870911557233689087731465724") ) );
}

View File

@ -122,7 +122,7 @@ void CertUnitTest::CAcertstest()
QCOMPARE( ca1.isCA(), true );
QCOMPARE( ca1.isSelfSigned(), true );
QCOMPARE( ca1.serialNumber(), QBigInteger(0) );
QCOMPARE( ca1.serialNumber(), QCA::BigInteger(0) );
QCOMPARE( ca1.commonName(), QString("For Tests Only") );
@ -174,7 +174,7 @@ void CertUnitTest::qualitysslcatest()
QCOMPARE( ca1.signatureAlgorithm(), QCA::EMSA3_SHA1 );
QCOMPARE( ca1.serialNumber(), QBigInteger("33555098") );
QCOMPARE( ca1.serialNumber(), QCA::BigInteger("33555098") );
QCOMPARE( ca1.commonName(), QString("Comodo Class 3 Security Services CA") );
@ -223,7 +223,7 @@ void CertUnitTest::checkExpiredClientCerts()
QCOMPARE( client1.isCA(), false );
QCOMPARE( client1.isSelfSigned(), false );
QCOMPARE( client1.serialNumber(), QBigInteger(2) );
QCOMPARE( client1.serialNumber(), QCA::BigInteger(2) );
QCOMPARE( client1.commonName(), QString("Insecure User Test Cert") );
@ -298,7 +298,7 @@ void CertUnitTest::checkExpiredClientCerts()
QCOMPARE( client1.validate( trusted, untrusted, QCA::UsageTimeStamping ), QCA::ErrorExpired );
QCOMPARE( client1.validate( trusted, untrusted, QCA::UsageEmailProtection ), QCA::ErrorExpired );
QCOMPARE( client1.validate( trusted, untrusted, QCA::UsageCRLSigning ), QCA::ErrorExpired );
QSecureArray derClient1 = client1.toDER();
QCA::SecureArray derClient1 = client1.toDER();
QCOMPARE( derClient1.isEmpty(), false );
QCA::Certificate fromDer1 = QCA::Certificate::fromDER( derClient1, &resultClient1, provider );
QCOMPARE( resultClient1, QCA::ConvertGood );
@ -331,7 +331,7 @@ void CertUnitTest::checkClientCerts()
QCOMPARE( client2.isCA(), false );
QCOMPARE( client2.isSelfSigned(), false );
QCOMPARE( client2.serialNumber(), QBigInteger(4) );
QCOMPARE( client2.serialNumber(), QCA::BigInteger(4) );
QCOMPARE( client2.commonName(), QString("Insecure User Test Cert") );
@ -406,7 +406,7 @@ void CertUnitTest::checkClientCerts()
QCOMPARE( client2.validate( trusted, untrusted, QCA::UsageTimeStamping ), QCA::ErrorInvalidPurpose );
QCOMPARE( client2.validate( trusted, untrusted, QCA::UsageEmailProtection ), QCA::ValidityGood );
QCOMPARE( client2.validate( trusted, untrusted, QCA::UsageCRLSigning ), QCA::ErrorInvalidPurpose );
QSecureArray derClient2 = client2.toDER();
QCA::SecureArray derClient2 = client2.toDER();
QCOMPARE( derClient2.isEmpty(), false );
QCA::Certificate fromDer2 = QCA::Certificate::fromDER( derClient2, &resultClient2, provider );
QCOMPARE( resultClient2, QCA::ConvertGood );
@ -436,7 +436,7 @@ void CertUnitTest::derCAcertstest()
QVERIFY(f.open(QFile::ReadOnly));
QByteArray der = f.readAll();
QCA::ConvertResult resultca1;
QCA::Certificate ca1 = QCA::Certificate::fromDER( QSecureArray(der),
QCA::Certificate ca1 = QCA::Certificate::fromDER( QCA::SecureArray(der),
&resultca1,
provider);
@ -449,7 +449,7 @@ void CertUnitTest::derCAcertstest()
QCOMPARE( ca1.isSelfSigned(), true );
QCOMPARE( ca1.serialNumber(), QBigInteger(0) );
QCOMPARE( ca1.serialNumber(), QCA::BigInteger(0) );
QCOMPARE( ca1.commonName(), QString("For Tests Only") );
@ -513,7 +513,7 @@ void CertUnitTest::altName()
QCOMPARE( client1.isCA(), false );
QCOMPARE( client1.isSelfSigned(), false );
QCOMPARE( client1.serialNumber(), QBigInteger(1) );
QCOMPARE( client1.serialNumber(), QCA::BigInteger(1) );
QCOMPARE( client1.commonName(), QString("Valid RFC822 nameConstraints EE Certificate Test21") );
@ -589,7 +589,7 @@ void CertUnitTest::extXMPP()
QCOMPARE( client1.isCA(), false );
QCOMPARE( client1.isSelfSigned(), true );
QCOMPARE( client1.serialNumber(), QBigInteger("9635301556349760241") );
QCOMPARE( client1.serialNumber(), QCA::BigInteger("9635301556349760241") );
QCOMPARE( client1.commonName(), QString("demo.jabber.com") );
@ -631,7 +631,7 @@ void CertUnitTest::altNames76()
QCOMPARE( client1.isCA(), false );
QCOMPARE( client1.isSelfSigned(), false );
QCOMPARE( client1.serialNumber(), QBigInteger(118) );
QCOMPARE( client1.serialNumber(), QCA::BigInteger(118) );
QCOMPARE( client1.commonName(), QString("sip1.su.se") );
@ -726,7 +726,7 @@ void CertUnitTest::checkExpiredServerCerts()
QCOMPARE( server1.isCA(), false );
QCOMPARE( server1.isSelfSigned(), false );
QCOMPARE( server1.serialNumber(), QBigInteger(4) );
QCOMPARE( server1.serialNumber(), QCA::BigInteger(4) );
QCOMPARE( server1.commonName(), QString("Insecure Server Cert") );
@ -802,7 +802,7 @@ void CertUnitTest::checkExpiredServerCerts()
QCOMPARE( server1.validate( trusted, untrusted, QCA::UsageEmailProtection ), QCA::ErrorExpired );
QCOMPARE( server1.validate( trusted, untrusted, QCA::UsageCRLSigning ), QCA::ErrorExpired );
QSecureArray derServer1 = server1.toDER();
QCA::SecureArray derServer1 = server1.toDER();
QCOMPARE( derServer1.isEmpty(), false );
QCA::Certificate fromDer1 = QCA::Certificate::fromDER( derServer1, &resultServer1, provider );
QCOMPARE( resultServer1, QCA::ConvertGood );
@ -829,7 +829,7 @@ void CertUnitTest::checkServerCerts()
QCOMPARE( server1.isCA(), false );
QCOMPARE( server1.isSelfSigned(), false );
QCOMPARE( server1.serialNumber(), QBigInteger(6) );
QCOMPARE( server1.serialNumber(), QCA::BigInteger(6) );
QCOMPARE( server1.commonName(), QString("Insecure Server Cert") );
@ -905,7 +905,7 @@ void CertUnitTest::checkServerCerts()
QCOMPARE( server1.validate( trusted, untrusted, QCA::UsageEmailProtection ), QCA::ErrorInvalidPurpose );
QCOMPARE( server1.validate( trusted, untrusted, QCA::UsageCRLSigning ), QCA::ErrorInvalidPurpose );
QSecureArray derServer1 = server1.toDER();
QCA::SecureArray derServer1 = server1.toDER();
QCOMPARE( derServer1.isEmpty(), false );
QCA::Certificate fromDer1 = QCA::Certificate::fromDER( derServer1, &resultServer1, provider );
QCOMPARE( resultServer1, QCA::ConvertGood );
@ -965,15 +965,15 @@ void CertUnitTest::crl()
QList<QCA::CRLEntry> revokedList = crl1.revoked();
QCOMPARE( revokedList.size(), 2 );
qSort(revokedList);
QCOMPARE( revokedList[0].serialNumber(), QBigInteger("3") );
QCOMPARE( revokedList[1].serialNumber(), QBigInteger("5") );
QCOMPARE( revokedList[0].serialNumber(), QCA::BigInteger("3") );
QCOMPARE( revokedList[1].serialNumber(), QCA::BigInteger("5") );
QCOMPARE( revokedList[0].reason(), QCA::CRLEntry::Unspecified );
QCOMPARE( revokedList[1].reason(), QCA::CRLEntry::Unspecified );
QCOMPARE( revokedList[0].time(), QDateTime(QDate(2001, 8, 17), QTime(11, 10, 39)) );
QCOMPARE( revokedList[1].time(), QDateTime(QDate(2001, 8, 17), QTime(11, 11, 59)) );
// convert to DER
QSecureArray derCRL1 = crl1.toDER();
QCA::SecureArray derCRL1 = crl1.toDER();
// check we got something, at least
QCOMPARE( derCRL1.isEmpty(), false );
// convert back from DER
@ -1021,15 +1021,15 @@ void CertUnitTest::crl2()
QList<QCA::CRLEntry> revokedList = crl1.revoked();
QCOMPARE( revokedList.size(), 2 );
qSort(revokedList);
QCOMPARE( revokedList[0].serialNumber(), QBigInteger("14") );
QCOMPARE( revokedList[1].serialNumber(), QBigInteger("15") );
QCOMPARE( revokedList[0].serialNumber(), QCA::BigInteger("14") );
QCOMPARE( revokedList[1].serialNumber(), QCA::BigInteger("15") );
QCOMPARE( revokedList[0].reason(), QCA::CRLEntry::KeyCompromise );
QCOMPARE( revokedList[1].reason(), QCA::CRLEntry::KeyCompromise );
QCOMPARE( revokedList[0].time(), QDateTime(QDate(2001, 4, 19), QTime(14, 57, 20)) );
QCOMPARE( revokedList[1].time(), QDateTime(QDate(2001, 4, 19), QTime(14, 57, 20)) );
// convert to DER
QSecureArray derCRL1 = crl1.toDER();
QCA::SecureArray derCRL1 = crl1.toDER();
// check we got something, at least
QCOMPARE( derCRL1.isEmpty(), false );
// convert back from DER
@ -1089,8 +1089,8 @@ void CertUnitTest::csr()
QCA::RSAPublicKey rsaPkey = pkey.toRSA();
QCOMPARE( rsaPkey.isNull(), false );
QCOMPARE( rsaPkey.e(), QBigInteger(65537) );
QCOMPARE( rsaPkey.n(), QBigInteger("104853561647822232509211983664549572246855698961210758585652966258891659217901732470712446421431206166165309547771124747713609923038218156616083520796442797276676074122658684367500665423564881889504308700315044585826841844654287577169905826705891670004942854611681809539126326134927995969418712881512819058439") );
QCOMPARE( rsaPkey.e(), QCA::BigInteger(65537) );
QCOMPARE( rsaPkey.n(), QCA::BigInteger("104853561647822232509211983664549572246855698961210758585652966258891659217901732470712446421431206166165309547771124747713609923038218156616083520796442797276676074122658684367500665423564881889504308700315044585826841844654287577169905826705891670004942854611681809539126326134927995969418712881512819058439") );
QCOMPARE( csr1.signatureAlgorithm(), QCA::EMSA3_MD5 );
}
@ -1127,13 +1127,13 @@ void CertUnitTest::csr2()
QCA::RSAPublicKey rsaPkey = pkey.toRSA();
QCOMPARE( rsaPkey.isNull(), false );
QCOMPARE( rsaPkey.e(), QBigInteger(65537) );
QCOMPARE( rsaPkey.n(), QBigInteger("151872780463004414908584891835397365176526767139347372444365914360701714510188717169754430290680734981291754624394094502297070722505032645306680495915914243593438796635264236530526146243919417744996366836534380790370421346490191416041004278161146551997010463199760480957900518811859984176646089981367745961681" ) );
QCOMPARE( rsaPkey.e(), QCA::BigInteger(65537) );
QCOMPARE( rsaPkey.n(), QCA::BigInteger("151872780463004414908584891835397365176526767139347372444365914360701714510188717169754430290680734981291754624394094502297070722505032645306680495915914243593438796635264236530526146243919417744996366836534380790370421346490191416041004278161146551997010463199760480957900518811859984176646089981367745961681" ) );
QCOMPARE( csr1.signatureAlgorithm(), QCA::EMSA3_MD5 );
// convert to DER
QSecureArray derCSR1 = csr1.toDER();
QCA::SecureArray derCSR1 = csr1.toDER();
// check we got something, at least
QCOMPARE( derCSR1.isEmpty(), false );
// convert back from DER

View File

@ -120,7 +120,7 @@ void CMSut::xcrypt()
QCOMPARE( encryptedResult2.isEmpty(), false );
QCA::ConvertResult res;
QSecureArray passPhrase = "start";
QCA::SecureArray passPhrase = "start";
QCA::PrivateKey privKey = QCA::PrivateKey::fromPEMFile( "Userkey.pem", passPhrase, &res );
QCOMPARE( res, QCA::ConvertGood );
@ -180,7 +180,7 @@ void CMSut::signverify()
QWARN( QString( "CMS not supported for "+provider).toLocal8Bit() );
else {
QCA::ConvertResult res;
QSecureArray passPhrase = "start";
QCA::SecureArray passPhrase = "start";
QCA::PrivateKey privKey = QCA::PrivateKey::fromPEMFile( "Userkey.pem", passPhrase, &res, provider );
QCOMPARE( res, QCA::ConvertGood );
@ -312,7 +312,7 @@ void CMSut::signverify_message()
QWARN( QString( "CMS not supported for "+provider).toLocal8Bit() );
else {
QCA::ConvertResult res;
QSecureArray passPhrase = "start";
QCA::SecureArray passPhrase = "start";
QCA::PrivateKey privKey = QCA::PrivateKey::fromPEMFile( "Userkey.pem", passPhrase, &res, provider );
QCOMPARE( res, QCA::ConvertGood );
@ -430,7 +430,7 @@ void CMSut::signverify_message_invalid()
QWARN( QString( "CMS not supported for "+provider).toLocal8Bit() );
else {
QCA::ConvertResult res;
QSecureArray passPhrase = "start";
QCA::SecureArray passPhrase = "start";
QCA::PrivateKey privKey = QCA::PrivateKey::fromPEMFile( "Userkey.pem", passPhrase, &res, provider );
QCOMPARE( res, QCA::ConvertGood );

View File

@ -78,14 +78,14 @@ void DSAUnitTest::testdsa()
QCA::DSAPrivateKey dsaPrivKey = dsaKey.toDSA();
QCOMPARE( dsaPrivKey.bitSize(), 1024 );
QSecureArray dsaDER = dsaKey.toDER();
QCA::SecureArray dsaDER = dsaKey.toDER();
QCOMPARE( dsaDER.isEmpty(), false );
QString dsaPEM = dsaKey.toPEM();
QCOMPARE( dsaPEM.isEmpty(), false );
QCA::ConvertResult checkResult;
QCA::PrivateKey fromPEMkey = QCA::PrivateKey::fromPEM(dsaPEM, QSecureArray(), &checkResult);
QCA::PrivateKey fromPEMkey = QCA::PrivateKey::fromPEM(dsaPEM, QCA::SecureArray(), &checkResult);
QCOMPARE( checkResult, QCA::ConvertGood );
QCOMPARE( fromPEMkey.isNull(), false );
QCOMPARE( fromPEMkey.isRSA(), false );
@ -95,7 +95,7 @@ void DSAUnitTest::testdsa()
QCOMPARE( fromPEMkey.isPublic(), false );
QVERIFY( dsaKey == fromPEMkey );
QCA::PrivateKey fromDERkey = QCA::PrivateKey::fromDER(dsaDER, QSecureArray(), &checkResult);
QCA::PrivateKey fromDERkey = QCA::PrivateKey::fromDER(dsaDER, QCA::SecureArray(), &checkResult);
QCOMPARE( checkResult, QCA::ConvertGood );
QCOMPARE( fromDERkey.isNull(), false );
QCOMPARE( fromDERkey.isRSA(), false );

View File

@ -87,19 +87,19 @@ void HexUnitTest::testIncrementalUpdate()
hexObject.setup(QCA::Encode);
hexObject.clear();
QSecureArray result1 = hexObject.update(QSecureArray("ab"));
QCA::SecureArray result1 = hexObject.update(QCA::SecureArray("ab"));
QVERIFY( hexObject.ok() );
QCOMPARE( result1[0], '6' );
QCOMPARE( result1[1], '1' );
QCOMPARE( result1[2], '6' );
QCOMPARE( result1[3], '2' );
QSecureArray result2 = hexObject.update(QSecureArray("cd"));
QCA::SecureArray result2 = hexObject.update(QCA::SecureArray("cd"));
QCOMPARE( hexObject.ok(), true );
QCOMPARE( result2[0], '6' );
QCOMPARE( result2[1], '3' );
QCOMPARE( result2[2], '6' );
QCOMPARE( result2[3], '4' );
QCOMPARE( QSecureArray(), hexObject.final() );
QCOMPARE( QCA::SecureArray(), hexObject.final() );
QCOMPARE( hexObject.ok(), true );
}
@ -108,7 +108,7 @@ void HexUnitTest::testBrokenInput()
QCA::Hex hexObject;
hexObject.setup(QCA::Decode);
hexObject.update(QSecureArray("-="));
hexObject.update(QCA::SecureArray("-="));
QCOMPARE(hexObject.ok(), false);
}

View File

@ -110,7 +110,7 @@ void KDFUnitTest::pbkdf1md2Tests()
if(!QCA::isSupported("pbkdf1(md2)", provider))
QWARN(QString("PBKDF version 1 with MD2 not supported for "+provider).toLocal8Bit());
else {
QSecureArray password = QCA::hexToArray( secret );
QCA::SecureArray password = QCA::hexToArray( secret );
QCA::InitializationVector iv( QCA::hexToArray( salt) );
QCA::SymmetricKey key = QCA::PBKDF1("md2", provider).makeKey( password,
iv,
@ -179,7 +179,7 @@ void KDFUnitTest::pbkdf1sha1Tests()
if(!QCA::isSupported("pbkdf1(sha1)", provider))
QWARN(QString("PBKDF version 1 with SHA1 not supported for "+provider).toLocal8Bit());
else {
QSecureArray password = QCA::hexToArray( secret );
QCA::SecureArray password = QCA::hexToArray( secret );
QCA::InitializationVector iv( QCA::hexToArray( salt) );
QCA::SymmetricKey key = QCA::PBKDF1("sha1", provider).makeKey( password,
iv,
@ -273,7 +273,7 @@ void KDFUnitTest::pbkdf2Tests()
if(!QCA::isSupported("pbkdf2(sha1)", provider))
QWARN(QString("PBKDF version 2 with SHA1 not supported for "+provider).toLocal8Bit());
else {
QSecureArray password = QCA::hexToArray( secret );
QCA::SecureArray password = QCA::hexToArray( secret );
QCA::InitializationVector iv( QCA::hexToArray( salt) );
QCA::SymmetricKey key = QCA::PBKDF2("sha1", provider).makeKey( password,
iv,
@ -299,8 +299,8 @@ void KDFUnitTest::pbkdf2extraTests()
else {
// Not sure where this one came from...
{
QCA::InitializationVector salt(QSecureArray("what do ya want for nothing?"));
QSecureArray password("Jefe");
QCA::InitializationVector salt(QCA::SecureArray("what do ya want for nothing?"));
QCA::SecureArray password("Jefe");
int iterations = 1000;
QCA::SymmetricKey passwordOut = QCA::PBKDF2("sha1", provider).makeKey (password, salt, 16, iterations);
QCOMPARE( QCA::arrayToHex(passwordOut), QString( "6349e09cb6b8c1485cfa9780ee3264df" ) );
@ -308,8 +308,8 @@ void KDFUnitTest::pbkdf2extraTests()
// RFC3962, Appendix B
{
QCA::InitializationVector salt(QSecureArray("ATHENA.MIT.EDUraeburn"));
QSecureArray password("password");
QCA::InitializationVector salt(QCA::SecureArray("ATHENA.MIT.EDUraeburn"));
QCA::SecureArray password("password");
int iterations = 1;
QCA::SymmetricKey passwordOut = QCA::PBKDF2("sha1", provider).makeKey (password, salt, 16, iterations);
QCOMPARE( QCA::arrayToHex(passwordOut), QString( "cdedb5281bb2f801565a1122b2563515" ) );
@ -320,8 +320,8 @@ void KDFUnitTest::pbkdf2extraTests()
// RFC3962, Appendix B
{
QCA::InitializationVector salt(QSecureArray("ATHENA.MIT.EDUraeburn"));
QSecureArray password("password");
QCA::InitializationVector salt(QCA::SecureArray("ATHENA.MIT.EDUraeburn"));
QCA::SecureArray password("password");
int iterations = 2;
QCA::SymmetricKey passwordOut = QCA::PBKDF2("sha1", provider).makeKey (password, salt, 16, iterations);
QCOMPARE( QCA::arrayToHex(passwordOut), QString( "01dbee7f4a9e243e988b62c73cda935d" ) );
@ -332,8 +332,8 @@ void KDFUnitTest::pbkdf2extraTests()
// RFC3962, Appendix B
{
QCA::InitializationVector salt(QSecureArray("ATHENA.MIT.EDUraeburn"));
QSecureArray password("password");
QCA::InitializationVector salt(QCA::SecureArray("ATHENA.MIT.EDUraeburn"));
QCA::SecureArray password("password");
int iterations = 1200;
QCA::SymmetricKey passwordOut = QCA::PBKDF2("sha1", provider).makeKey (password, salt, 16, iterations);
QCOMPARE( QCA::arrayToHex(passwordOut), QString( "5c08eb61fdf71e4e4ec3cf6ba1f5512b" ) );
@ -345,7 +345,7 @@ void KDFUnitTest::pbkdf2extraTests()
// RFC3211 and RFC3962, Appendix B
{
QCA::InitializationVector salt(QCA::hexToArray("1234567878563412"));
QSecureArray password("password");
QCA::SecureArray password("password");
int iterations = 5;
QCA::SymmetricKey passwordOut = QCA::PBKDF2("sha1", provider).makeKey (password, salt, 16, iterations);
QCOMPARE( QCA::arrayToHex(passwordOut), QString( "d1daa78615f287e6a1c8b120d7062a49" ) );
@ -359,8 +359,8 @@ void KDFUnitTest::pbkdf2extraTests()
// RFC3962, Appendix B
{
QCA::InitializationVector salt(QSecureArray("pass phrase equals block size"));
QSecureArray password("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
QCA::InitializationVector salt(QCA::SecureArray("pass phrase equals block size"));
QCA::SecureArray password("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
int iterations = 1200;
QCA::SymmetricKey passwordOut = QCA::PBKDF2("sha1", provider).makeKey (password, salt, 16, iterations);
QCOMPARE( QCA::arrayToHex(passwordOut), QString( "139c30c0966bc32ba55fdbf212530ac9" ) );
@ -372,8 +372,8 @@ void KDFUnitTest::pbkdf2extraTests()
// RFC3962, Appendix B
{
try {
QCA::InitializationVector salt(QSecureArray("pass phrase exceeds block size"));
QSecureArray password("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
QCA::InitializationVector salt(QCA::SecureArray("pass phrase exceeds block size"));
QCA::SecureArray password("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
int iterations = 1200;
QCA::SymmetricKey passwordOut = QCA::PBKDF2("sha1", provider).makeKey (password, salt, 16, iterations);
QCOMPARE( QCA::arrayToHex(passwordOut), QString( "9ccad6d468770cd51b10e6a68721be61" ) );
@ -390,8 +390,8 @@ void KDFUnitTest::pbkdf2extraTests()
// RFC3962, Appendix B
{
QCA::InitializationVector salt(QSecureArray("EXAMPLE.COMpianist"));
QSecureArray password(QCA::hexToArray("f09d849e"));
QCA::InitializationVector salt(QCA::SecureArray("EXAMPLE.COMpianist"));
QCA::SecureArray password(QCA::hexToArray("f09d849e"));
int iterations = 50;
QCA::SymmetricKey passwordOut = QCA::PBKDF2("sha1", provider).makeKey (password, salt, 16, iterations);
QCOMPARE( QCA::arrayToHex(passwordOut), QString( "6b9cf26d45455a43a5b8bb276a403b39" ) );

View File

@ -66,19 +66,19 @@ void KeyGenUnitTest::testRSA()
QCA::PrivateKey priv1 = keygen.createRSA( 1024, 65537 );
QCA::RSAPrivateKey rsa1 = priv1.toRSA();
QCOMPARE( rsa1.isNull(), false );
QCOMPARE( rsa1.e(), QBigInteger(65537) );
QCOMPARE( rsa1.e(), QCA::BigInteger(65537) );
QCOMPARE( rsa1.bitSize(), 1024);
priv1 = keygen.createRSA( 512, 17 );
rsa1 = priv1.toRSA();
QCOMPARE( rsa1.isNull(), false );
QCOMPARE( rsa1.e(), QBigInteger(17) );
QCOMPARE( rsa1.e(), QCA::BigInteger(17) );
QCOMPARE( rsa1.bitSize(), 512);
priv1 = keygen.createRSA( 512, 3 );
rsa1 = priv1.toRSA();
QCOMPARE( rsa1.isNull(), false );
QCOMPARE( rsa1.e(), QBigInteger(3) );
QCOMPARE( rsa1.e(), QCA::BigInteger(3) );
QCOMPARE( rsa1.bitSize(), 512);
}

View File

@ -77,16 +77,16 @@ void MACUnitTest::HMACMD5()
// These tests are from RFC2202, Section 2.
// The first three are also in the Appendix to RFC2104
QCA::MessageAuthenticationCode md5hmac1( "hmac(md5)", QCA::SymmetricKey(), provider );
QCA::SymmetricKey key1( QSecureArray( "Jefe" ) );
QCA::SymmetricKey key1( QCA::SecureArray( "Jefe" ) );
md5hmac1.setup( key1 );
QSecureArray data1( "what do ya want for nothing?" );
QCA::SecureArray data1( "what do ya want for nothing?" );
md5hmac1.update( data1 );
QCOMPARE( QCA::arrayToHex( md5hmac1.final() ), QString( "750c783e6ab0b503eaa86e310a5db738" ) );
QCA::MessageAuthenticationCode md5hmac2( "hmac(md5)", QCA::SymmetricKey(), provider );
QCA::SymmetricKey key2( QCA::hexToArray( "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b" ) );
md5hmac2.setup( key2 );
QSecureArray data2 = QSecureArray( "Hi There" );
QCA::SecureArray data2 = QCA::SecureArray( "Hi There" );
md5hmac2.update( data2 );
QCOMPARE( QCA::arrayToHex( md5hmac2.final() ), QString( "9294727a3638bb1c13f48ef8158bfc9d" ) );
@ -94,7 +94,7 @@ void MACUnitTest::HMACMD5()
md5hmac2.clear();
QCA::SymmetricKey key3( QCA::hexToArray( "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" ) );
md5hmac2.setup ( key3 );
QSecureArray data3( 50 );
QCA::SecureArray data3( 50 );
for ( int i = 0; i < data3.size(); i++ )
data3[ i ] = (char)0xDD;
md5hmac2.update( data3 );
@ -102,16 +102,16 @@ void MACUnitTest::HMACMD5()
QCA::SymmetricKey key4( QCA::hexToArray( "0102030405060708090a0b0c0d0e0f10111213141516171819") );
QCA::MessageAuthenticationCode md5hmac4( "hmac(md5)", key4, provider );
QSecureArray data4( 50 );
QCA::SecureArray data4( 50 );
for (int i = 0; i < data4.size(); i++ )
data4[ i ] = (char)0xcd;
md5hmac4.update( data4 );
QCOMPARE( QCA::arrayToHex( md5hmac4.final() ), QString( "697eaf0aca3a3aea3a75164746ffaa79" ) );
QCA::MessageAuthenticationCode md5hmac5( "hmac(md5)", QSecureArray() );
QCA::MessageAuthenticationCode md5hmac5( "hmac(md5)", QCA::SecureArray() );
QCA::SymmetricKey key5( QCA::hexToArray( "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c" ) );
md5hmac5.setup( key5 );
QSecureArray data5( "Test With Truncation" );
QCA::SecureArray data5( "Test With Truncation" );
md5hmac5.update( data5 );
QCOMPARE( QCA::arrayToHex( md5hmac5.final() ), QString( "56461ef2342edc00f9bab995690efd4c" ) );
@ -120,12 +120,12 @@ void MACUnitTest::HMACMD5()
for (int i = 0; i < key6.size(); i++)
key6[ i ] = (char)0xaa;
md5hmac6.setup( key6 );
QSecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
QCA::SecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
md5hmac6.update( data6 );
QCOMPARE( QCA::arrayToHex( md5hmac6.final() ), QString( "6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd" ) );
md5hmac6.clear(); // reuse the same key
QSecureArray data7( "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data" );
QCA::SecureArray data7( "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data" );
md5hmac6.update( data7 );
QCOMPARE( QCA::arrayToHex( md5hmac6.final() ), QString( "6f630fad67cda0ee1fb1f562db3aa53e" ) );
}
@ -152,9 +152,9 @@ void MACUnitTest::HMACSHA256()
QCOMPARE( hmacLenTest.validKeyLength( -2 ), false );
QCA::MessageAuthenticationCode hmac1( "hmac(sha256)", QCA::SymmetricKey(), provider );
QCA::SymmetricKey key1( QSecureArray( "Jefe" ) );
QCA::SymmetricKey key1( QCA::SecureArray( "Jefe" ) );
hmac1.setup( key1 );
QSecureArray data1( "what do ya want for nothing?" );
QCA::SecureArray data1( "what do ya want for nothing?" );
hmac1.update( data1 );
QCOMPARE( QCA::arrayToHex( hmac1.final() ),
QString( "5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843" ) );
@ -162,7 +162,7 @@ void MACUnitTest::HMACSHA256()
QCA::MessageAuthenticationCode hmac2( "hmac(sha256)", QCA::SymmetricKey(), provider );
QCA::SymmetricKey key2( QCA::hexToArray( "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b" ) );
hmac2.setup( key2 );
QSecureArray data2 = QSecureArray( "Hi There" );
QCA::SecureArray data2 = QCA::SecureArray( "Hi There" );
hmac2.update( data2 );
QCOMPARE( QCA::arrayToHex( hmac2.final() ),
QString( "b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7" ) );
@ -171,7 +171,7 @@ void MACUnitTest::HMACSHA256()
hmac2.clear();
QCA::SymmetricKey key3( QCA::hexToArray( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ) );
hmac2.setup ( key3 );
QSecureArray data3( 50 );
QCA::SecureArray data3( 50 );
for ( int i = 0; i < data3.size(); i++ )
data3[ i ] = (char)0xDD;
hmac2.update( data3 );
@ -180,7 +180,7 @@ void MACUnitTest::HMACSHA256()
QCA::SymmetricKey key4( QCA::hexToArray( "0102030405060708090a0b0c0d0e0f10111213141516171819") );
QCA::MessageAuthenticationCode hmac4( "hmac(sha256)", key4, provider );
QSecureArray data4( 50 );
QCA::SecureArray data4( 50 );
for (int i = 0; i < data4.size(); i++ )
data4[ i ] = (char)0xcd;
hmac4.update( data4 );
@ -190,7 +190,7 @@ void MACUnitTest::HMACSHA256()
QCA::MessageAuthenticationCode hmac5( "hmac(sha256)", QCA::SymmetricKey(), provider );
QCA::SymmetricKey key5( QCA::hexToArray( "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c" ) );
hmac5.setup( key5 );
QSecureArray data5( "Test With Truncation" );
QCA::SecureArray data5( "Test With Truncation" );
hmac5.update( data5 );
QString resultWithTrunc = QCA::arrayToHex( hmac5.final() );
resultWithTrunc.resize(32);
@ -201,13 +201,13 @@ void MACUnitTest::HMACSHA256()
for (int i = 0; i < key6.size(); i++)
key6[ i ] = (char)0xaa;
hmac6.setup( key6 );
QSecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
QCA::SecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
hmac6.update( data6 );
QCOMPARE( QCA::arrayToHex( hmac6.final() ),
QString( "60e431591ee0b67f0d8a26aacbf5b77f8e0bc6213728c5140546040f0ee37f54" ) );
hmac6.clear(); // reuse the same key
QSecureArray data7( "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm." );
QCA::SecureArray data7( "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm." );
hmac6.update( data7 );
QCOMPARE( QCA::arrayToHex( hmac6.final() ),
QString( "9b09ffa71b942fcb27635fbcd5b0e944bfdc63644f0713938a7f51535c3a35e2" ) );
@ -233,9 +233,9 @@ void MACUnitTest::HMACSHA224()
QCOMPARE( hmacLenTest.validKeyLength( -2 ), false );
QCA::MessageAuthenticationCode hmac1( "hmac(sha224)", QCA::SymmetricKey(), provider );
QCA::SymmetricKey key1( QSecureArray( "Jefe" ) );
QCA::SymmetricKey key1( QCA::SecureArray( "Jefe" ) );
hmac1.setup( key1 );
QSecureArray data1( "what do ya want for nothing?" );
QCA::SecureArray data1( "what do ya want for nothing?" );
hmac1.update( data1 );
QCOMPARE( QCA::arrayToHex( hmac1.final() ),
QString( "a30e01098bc6dbbf45690f3a7e9e6d0f8bbea2a39e6148008fd05e44" ) );
@ -243,7 +243,7 @@ void MACUnitTest::HMACSHA224()
QCA::MessageAuthenticationCode hmac2( "hmac(sha224)", QCA::SymmetricKey(), provider );
QCA::SymmetricKey key2( QCA::hexToArray( "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b" ) );
hmac2.setup( key2 );
QSecureArray data2 = QSecureArray( "Hi There" );
QCA::SecureArray data2 = QCA::SecureArray( "Hi There" );
hmac2.update( data2 );
QCOMPARE( QCA::arrayToHex( hmac2.final() ),
QString( "896fb1128abbdf196832107cd49df33f47b4b1169912ba4f53684b22" ) );
@ -252,7 +252,7 @@ void MACUnitTest::HMACSHA224()
hmac2.clear();
QCA::SymmetricKey key3( QCA::hexToArray( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ) );
hmac2.setup ( key3 );
QSecureArray data3( 50 );
QCA::SecureArray data3( 50 );
for ( int i = 0; i < data3.size(); i++ )
data3[ i ] = (char)0xDD;
hmac2.update( data3 );
@ -261,7 +261,7 @@ void MACUnitTest::HMACSHA224()
QCA::SymmetricKey key4( QCA::hexToArray( "0102030405060708090a0b0c0d0e0f10111213141516171819") );
QCA::MessageAuthenticationCode hmac4( "hmac(sha224)", key4, provider );
QSecureArray data4( 50 );
QCA::SecureArray data4( 50 );
for (int i = 0; i < data4.size(); i++ )
data4[ i ] = (char)0xcd;
hmac4.update( data4 );
@ -271,7 +271,7 @@ void MACUnitTest::HMACSHA224()
QCA::MessageAuthenticationCode hmac5( "hmac(sha224)", QCA::SymmetricKey(), provider );
QCA::SymmetricKey key5( QCA::hexToArray( "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c" ) );
hmac5.setup( key5 );
QSecureArray data5( "Test With Truncation" );
QCA::SecureArray data5( "Test With Truncation" );
hmac5.update( data5 );
QString resultWithTrunc = QCA::arrayToHex( hmac5.final() );
resultWithTrunc.resize(32);
@ -282,13 +282,13 @@ void MACUnitTest::HMACSHA224()
for (int i = 0; i < key6.size(); i++)
key6[ i ] = (char)0xaa;
hmac6.setup( key6 );
QSecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
QCA::SecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
hmac6.update( data6 );
QCOMPARE( QCA::arrayToHex( hmac6.final() ),
QString( "95e9a0db962095adaebe9b2d6f0dbce2d499f112f2d2b7273fa6870e" ) );
hmac6.clear(); // reuse the same key
QSecureArray data7( "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm." );
QCA::SecureArray data7( "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm." );
hmac6.update( data7 );
QCOMPARE( QCA::arrayToHex( hmac6.final() ),
QString( "3a854166ac5d9f023f54d517d0b39dbd946770db9c2b95c9f6f565d1" ) );
@ -315,9 +315,9 @@ void MACUnitTest::HMACSHA384()
QCOMPARE( hmacLenTest.validKeyLength( -2 ), false );
QCA::MessageAuthenticationCode hmac1( "hmac(sha384)", QCA::SymmetricKey(), provider );
QCA::SymmetricKey key1( QSecureArray( "Jefe" ) );
QCA::SymmetricKey key1( QCA::SecureArray( "Jefe" ) );
hmac1.setup( key1 );
QSecureArray data1( "what do ya want for nothing?" );
QCA::SecureArray data1( "what do ya want for nothing?" );
hmac1.update( data1 );
QCOMPARE( QCA::arrayToHex( hmac1.final() ),
QString( "af45d2e376484031617f78d2b58a6b1b9c7ef464f5a01b47e42ec3736322445e8e2240ca5e69e2c78b3239ecfab21649" ) );
@ -325,7 +325,7 @@ void MACUnitTest::HMACSHA384()
QCA::MessageAuthenticationCode hmac2( "hmac(sha384)", QCA::SymmetricKey(), provider );
QCA::SymmetricKey key2( QCA::hexToArray( "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b" ) );
hmac2.setup( key2 );
QSecureArray data2 = QSecureArray( "Hi There" );
QCA::SecureArray data2 = QCA::SecureArray( "Hi There" );
hmac2.update( data2 );
QCOMPARE( QCA::arrayToHex( hmac2.final() ),
QString( "afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6" ) );
@ -334,7 +334,7 @@ void MACUnitTest::HMACSHA384()
hmac2.clear();
QCA::SymmetricKey key3( QCA::hexToArray( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ) );
hmac2.setup ( key3 );
QSecureArray data3( 50 );
QCA::SecureArray data3( 50 );
for ( int i = 0; i < data3.size(); i++ )
data3[ i ] = (char)0xDD;
hmac2.update( data3 );
@ -343,17 +343,17 @@ void MACUnitTest::HMACSHA384()
QCA::SymmetricKey key4( QCA::hexToArray( "0102030405060708090a0b0c0d0e0f10111213141516171819") );
QCA::MessageAuthenticationCode hmac4( "hmac(sha384)", key4, provider );
QSecureArray data4( 50 );
QCA::SecureArray data4( 50 );
for (int i = 0; i < data4.size(); i++ )
data4[ i ] = (char)0xcd;
hmac4.update( data4 );
QCOMPARE( QCA::arrayToHex( hmac4.final() ),
QString( "3e8a69b7783c25851933ab6290af6ca77a9981480850009cc5577c6e1f573b4e6801dd23c4a7d679ccf8a386c674cffb" ) );
QCA::MessageAuthenticationCode hmac5( "hmac(sha384)", QSecureArray(), provider );
QCA::MessageAuthenticationCode hmac5( "hmac(sha384)", QCA::SecureArray(), provider );
QCA::SymmetricKey key5( QCA::hexToArray( "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c" ) );
hmac5.setup( key5 );
QSecureArray data5( "Test With Truncation" );
QCA::SecureArray data5( "Test With Truncation" );
hmac5.update( data5 );
QString resultWithTrunc = QCA::arrayToHex( hmac5.final() );
resultWithTrunc.resize(32);
@ -364,13 +364,13 @@ void MACUnitTest::HMACSHA384()
for (int i = 0; i < key6.size(); i++)
key6[ i ] = (char)0xaa;
hmac6.setup( key6 );
QSecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
QCA::SecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
hmac6.update( data6 );
QCOMPARE( QCA::arrayToHex( hmac6.final() ),
QString( "4ece084485813e9088d2c63a041bc5b44f9ef1012a2b588f3cd11f05033ac4c60c2ef6ab4030fe8296248df163f44952" ) );
hmac6.clear(); // reuse the same key
QSecureArray data7( "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm." );
QCA::SecureArray data7( "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm." );
hmac6.update( data7 );
QCOMPARE( QCA::arrayToHex( hmac6.final() ),
QString( "6617178e941f020d351e2f254e8fd32c602420feb0b8fb9adccebb82461e99c5a678cc31e799176d3860e6110c46523e" ) );
@ -397,9 +397,9 @@ void MACUnitTest::HMACSHA512()
QCOMPARE( hmacLenTest.validKeyLength( -2 ), false );
QCA::MessageAuthenticationCode hmac1( "hmac(sha512)", QCA::SymmetricKey(), provider );
QCA::SymmetricKey key1( QSecureArray( "Jefe" ) );
QCA::SymmetricKey key1( QCA::SecureArray( "Jefe" ) );
hmac1.setup( key1 );
QSecureArray data1( "what do ya want for nothing?" );
QCA::SecureArray data1( "what do ya want for nothing?" );
hmac1.update( data1 );
QCOMPARE( QCA::arrayToHex( hmac1.final() ),
QString( "164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737" ) );
@ -407,7 +407,7 @@ void MACUnitTest::HMACSHA512()
QCA::MessageAuthenticationCode hmac2( "hmac(sha512)", QCA::SymmetricKey(), provider );
QCA::SymmetricKey key2( QCA::hexToArray( "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b" ) );
hmac2.setup( key2 );
QSecureArray data2 = QSecureArray( "Hi There" );
QCA::SecureArray data2 = QCA::SecureArray( "Hi There" );
hmac2.update( data2 );
QCOMPARE( QCA::arrayToHex( hmac2.final() ),
QString( "87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b30545e17cdedaa833b7d6b8a702038b274eaea3f4e4be9d914eeb61f1702e696c203a126854" ) );
@ -416,7 +416,7 @@ void MACUnitTest::HMACSHA512()
hmac2.clear();
QCA::SymmetricKey key3( QCA::hexToArray( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ) );
hmac2.setup ( key3 );
QSecureArray data3( 50 );
QCA::SecureArray data3( 50 );
for ( int i = 0; i < data3.size(); i++ )
data3[ i ] = (char)0xDD;
hmac2.update( data3 );
@ -425,17 +425,17 @@ void MACUnitTest::HMACSHA512()
QCA::SymmetricKey key4( QCA::hexToArray( "0102030405060708090a0b0c0d0e0f10111213141516171819") );
QCA::MessageAuthenticationCode hmac4( "hmac(sha512)", key4, provider );
QSecureArray data4( 50 );
QCA::SecureArray data4( 50 );
for (int i = 0; i < data4.size(); i++ )
data4[ i ] = (char)0xcd;
hmac4.update( data4 );
QCOMPARE( QCA::arrayToHex( hmac4.final() ),
QString( "b0ba465637458c6990e5a8c5f61d4af7e576d97ff94b872de76f8050361ee3dba91ca5c11aa25eb4d679275cc5788063a5f19741120c4f2de2adebeb10a298dd" ) );
QCA::MessageAuthenticationCode hmac5( "hmac(sha512)", QSecureArray(), provider );
QCA::MessageAuthenticationCode hmac5( "hmac(sha512)", QCA::SecureArray(), provider );
QCA::SymmetricKey key5( QCA::hexToArray( "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c" ) );
hmac5.setup( key5 );
QSecureArray data5( "Test With Truncation" );
QCA::SecureArray data5( "Test With Truncation" );
hmac5.update( data5 );
QString resultWithTrunc = QCA::arrayToHex( hmac5.final() );
resultWithTrunc.resize(32);
@ -446,13 +446,13 @@ void MACUnitTest::HMACSHA512()
for (int i = 0; i < key6.size(); i++)
key6[ i ] = (char)0xaa;
hmac6.setup( key6 );
QSecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
QCA::SecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
hmac6.update( data6 );
QCOMPARE( QCA::arrayToHex( hmac6.final() ),
QString( "80b24263c7c1a3ebb71493c1dd7be8b49b46d1f41b4aeec1121b013783f8f3526b56d037e05f2598bd0fd2215d6a1e5295e64f73f63f0aec8b915a985d786598" ) );
hmac6.clear(); // reuse the same key
QSecureArray data7( "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm." );
QCA::SecureArray data7( "This is a test using a larger than block-size key and a larger than block-size data. The key needs to be hashed before being used by the HMAC algorithm." );
hmac6.update( data7 );
QCOMPARE( QCA::arrayToHex( hmac6.final() ),
QString( "e37b6a775dc87dbaa4dfa9f96e5e3ffddebd71f8867289865df5a32d20cdc944b6022cac3c4982b10d5eeb55c3e4de15134676fb6de0446065c97440fa8c6a58" ) );
@ -479,24 +479,24 @@ void MACUnitTest::HMACSHA1()
QCOMPARE( sha1hmacLenTest.validKeyLength( -2 ), false );
// These tests are from RFC2202, Section 3.
QCA::MessageAuthenticationCode test1( "hmac(sha1)", QSecureArray() );
QCA::MessageAuthenticationCode test1( "hmac(sha1)", QCA::SecureArray() );
QCA::SymmetricKey key1( QCA::hexToArray( "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b" ) );
test1.setup( key1 );
QSecureArray data1( "Hi There" );
QCA::SecureArray data1( "Hi There" );
test1.update( data1 );
QCOMPARE( QCA::arrayToHex( test1.final() ), QString( "b617318655057264e28bc0b6fb378c8ef146be00" ) );
QCA::MessageAuthenticationCode test2( "hmac(sha1)", QCA::SymmetricKey(), provider);
QCA::SymmetricKey key2( QSecureArray( "Jefe" ) );
QCA::SymmetricKey key2( QCA::SecureArray( "Jefe" ) );
test2.setup( key2 );
QSecureArray data2( "what do ya want for nothing?" );
QCA::SecureArray data2( "what do ya want for nothing?" );
test2.update( data2 );
QCOMPARE( QCA::arrayToHex( test2.final() ), QString( "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79" ) );
QCA::MessageAuthenticationCode test3( "hmac(sha1)", QCA::SymmetricKey(), provider);
QCA::SymmetricKey key3( QCA::hexToArray( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ) );
test3.setup( key3 );
QSecureArray data3( 50 );
QCA::SecureArray data3( 50 );
for ( int i = 0; i < data3.size(); i++ )
data3[ i ] = (char)0xDD;
test3.update( data3 );
@ -505,7 +505,7 @@ void MACUnitTest::HMACSHA1()
QCA::MessageAuthenticationCode test4( "hmac(sha1)", QCA::SymmetricKey(), provider);
QCA::SymmetricKey key4( QCA::hexToArray( "0102030405060708090a0b0c0d0e0f10111213141516171819" ) );
test4.setup( key4 );
QSecureArray data4( 50 );
QCA::SecureArray data4( 50 );
for ( int i = 0; i < data4.size(); i++ )
data4[ i ] = (char)0xcd;
test4.update( data4 );
@ -514,7 +514,7 @@ void MACUnitTest::HMACSHA1()
QCA::MessageAuthenticationCode test5( "hmac(sha1)", QCA::SymmetricKey(), provider);
QCA::SymmetricKey key5 ( QCA::hexToArray( "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c" ) );
test5.setup( key5 );
QSecureArray data5( "Test With Truncation" );
QCA::SecureArray data5( "Test With Truncation" );
test5.update( data5 );
QCOMPARE( QCA::arrayToHex( test5.final() ), QString( "4c1a03424b55e07fe7f27be1d58bb9324a9a5a04" ) );
@ -523,12 +523,12 @@ void MACUnitTest::HMACSHA1()
for ( int i = 0; i < key6.size(); i++ )
key6[i] = (char)0xAA;
test6.setup( key6 );
QSecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
QCA::SecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
test6.update( data6 );
QCOMPARE( QCA::arrayToHex( test6.final() ), QString( "aa4ae5e15272d00e95705637ce8a3b55ed402112" ) );
test6.clear(); // this should reuse the same key
QSecureArray data7( "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data" );
QCA::SecureArray data7( "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data" );
test6.update( data7 );
QCOMPARE( QCA::arrayToHex( test6.final() ), QString( "e8e99d0f45237d786d6bbaa7965c7808bbff1a91" ) );
}
@ -557,21 +557,21 @@ void MACUnitTest::HMACRMD160()
QCA::MessageAuthenticationCode test1( "hmac(ripemd160)", QCA::SymmetricKey(), provider );
QCA::SymmetricKey key1 ( QCA::hexToArray( "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b" ) );
test1.setup( key1 );
QSecureArray data1( "Hi There" );
QCA::SecureArray data1( "Hi There" );
test1.update( data1 );
QCOMPARE( QCA::arrayToHex( test1.final() ), QString( "24cb4bd67d20fc1a5d2ed7732dcc39377f0a5668" ) );
QCA::MessageAuthenticationCode test2( "hmac(ripemd160)", QCA::SymmetricKey(), provider );
QCA::SymmetricKey key2( QSecureArray( "Jefe" ) );
QCA::SymmetricKey key2( QCA::SecureArray( "Jefe" ) );
test2.setup( key2 );
QSecureArray data2( "what do ya want for nothing?" );
QCA::SecureArray data2( "what do ya want for nothing?" );
test2.update( data2 );
QCOMPARE( QCA::arrayToHex( test2.final() ), QString( "dda6c0213a485a9e24f4742064a7f033b43c4069" ) );
QCA::MessageAuthenticationCode test3( "hmac(ripemd160)", QCA::SymmetricKey(), provider );
QCA::SymmetricKey key3( QCA::hexToArray( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ) );
test3.setup( key3 );
QSecureArray data3( 50 );
QCA::SecureArray data3( 50 );
for ( int i = 0; i < data3.size(); i++ )
data3[ i ] = (char)0xDD;
test3.update( data3 );
@ -579,7 +579,7 @@ void MACUnitTest::HMACRMD160()
QCA::SymmetricKey key4( QCA::hexToArray( "0102030405060708090a0b0c0d0e0f10111213141516171819" ) );
QCA::MessageAuthenticationCode test4( "hmac(ripemd160)", key4, provider );
QSecureArray data4( 50 );
QCA::SecureArray data4( 50 );
for ( int i = 0; i < data4.size(); i++ )
data4[ i ] = (char)0xcd;
test4.update( data4 );
@ -588,7 +588,7 @@ void MACUnitTest::HMACRMD160()
QCA::MessageAuthenticationCode test5( "hmac(ripemd160)", QCA::SymmetricKey(), provider );
QCA::SymmetricKey key5 ( QCA::hexToArray( "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c" ) );
test5.setup( key5 );
QSecureArray data5( "Test With Truncation" );
QCA::SecureArray data5( "Test With Truncation" );
test5.update( data5 );
QCOMPARE( QCA::arrayToHex( test5.final() ), QString( "7619693978f91d90539ae786500ff3d8e0518e39" ) );
@ -597,12 +597,12 @@ void MACUnitTest::HMACRMD160()
for ( int i = 0; i < key6.size(); i++ )
key6[i] = (char)0xAA;
test6.setup( key6 );
QSecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
QCA::SecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
test6.update( data6 );
QCOMPARE( QCA::arrayToHex( test6.final() ), QString( "6466ca07ac5eac29e1bd523e5ada7605b791fd8b" ) );
test6.clear(); // reuse the key
QSecureArray data7( "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data" );
QCA::SecureArray data7( "Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data" );
test6.update( data7 );
QCOMPARE( QCA::arrayToHex( test6.final() ), QString( "69ea60798d71616cce5fd0871e23754cd75d5a0a" ) );
}

View File

@ -86,7 +86,7 @@ void RSAUnitTest::testrsa()
QCOMPARE( rsaPEM.isEmpty(), false );
QCA::ConvertResult checkResult;
QCA::PrivateKey fromPEMkey = QCA::PrivateKey::fromPEM(rsaPEM, QSecureArray(), &checkResult);
QCA::PrivateKey fromPEMkey = QCA::PrivateKey::fromPEM(rsaPEM, QCA::SecureArray(), &checkResult);
QCOMPARE( checkResult, QCA::ConvertGood );
QCOMPARE( fromPEMkey.isNull(), false );
QCOMPARE( fromPEMkey.isRSA(), true );
@ -96,10 +96,10 @@ void RSAUnitTest::testrsa()
QCOMPARE( fromPEMkey.isPublic(), false );
QCOMPARE( rsaKey == fromPEMkey, true );
QSecureArray rsaDER = rsaKey.toDER(QSecureArray("foo"));
QCA::SecureArray rsaDER = rsaKey.toDER(QCA::SecureArray("foo"));
QCOMPARE( rsaDER.isEmpty(), false );
QCA::PrivateKey fromDERkey = QCA::PrivateKey::fromDER(rsaDER, QSecureArray("foo"), &checkResult);
QCA::PrivateKey fromDERkey = QCA::PrivateKey::fromDER(rsaDER, QCA::SecureArray("foo"), &checkResult);
QCOMPARE( checkResult, QCA::ConvertGood );
QCOMPARE( fromDERkey.isNull(), false );
QCOMPARE( fromDERkey.isRSA(), true );
@ -113,7 +113,7 @@ void RSAUnitTest::testrsa()
rsaDER = rsaKey.toDER();
QCOMPARE( rsaDER.isEmpty(), false );
fromDERkey = QCA::PrivateKey::fromDER(rsaDER, QSecureArray(), &checkResult);
fromDERkey = QCA::PrivateKey::fromDER(rsaDER, QCA::SecureArray(), &checkResult);
QCOMPARE( checkResult, QCA::ConvertGood );
QCOMPARE( fromDERkey.isNull(), false );
QCOMPARE( fromDERkey.isRSA(), true );
@ -132,7 +132,7 @@ void RSAUnitTest::testrsa()
QCOMPARE( pubKey.isPublic(), true );
QCA::RSAPublicKey RSApubKey = pubKey.toRSA();
QCOMPARE( RSApubKey.e(), QBigInteger(65537) );
QCOMPARE( RSApubKey.e(), QCA::BigInteger(65537) );
QCOMPARE( RSApubKey.isNull(), false );
QCOMPARE( RSApubKey.isRSA(), true );
QCOMPARE( RSApubKey.isDSA(), false );

View File

@ -54,15 +54,15 @@ void SecureArrayUnitTest::cleanupTestCase()
void SecureArrayUnitTest::testAll()
{
QSecureArray emptyArray;
QCA::SecureArray emptyArray;
QCOMPARE( emptyArray.size(), 0 );
QVERIFY( emptyArray.isEmpty() );
QSecureArray testArray(10);
QCA::SecureArray testArray(10);
QCOMPARE( testArray.size(), 10 );
QCOMPARE( testArray.isEmpty(), false );
QSecureArray testArray64(64);
QCA::SecureArray testArray64(64);
QCOMPARE( testArray64.size(), 64 );
QCOMPARE( testArray64.isEmpty(), false );
@ -77,21 +77,21 @@ void SecureArrayUnitTest::testAll()
QCOMPARE( QCA::arrayToHex( testArray ), QString( "62626262626262006262" ) );
QByteArray byteArray(10, 'c');
QSecureArray secureArray( byteArray );
QCA::SecureArray secureArray( byteArray );
QCOMPARE( secureArray.size(), 10 );
QCOMPARE( QCA::arrayToHex ( secureArray ), QString( "63636363636363636363" ) );
byteArray.fill( 'd' );
// it should be a copy, so no effect
QCOMPARE( QCA::arrayToHex ( secureArray ), QString( "63636363636363636363" ) );
QSecureArray copyArray( secureArray );
QCA::SecureArray copyArray( secureArray );
QCOMPARE( QCA::arrayToHex ( copyArray ), QString( "63636363636363636363" ) );
copyArray.fill(0x64);
QCOMPARE( QCA::arrayToHex ( copyArray ), QString( "64646464646464646464" ) );
QCOMPARE( QCA::arrayToHex ( secureArray ), QString( "63636363636363636363" ) );
// test for detaching
QSecureArray detachArray1 = secureArray; // currently the same
QCA::SecureArray detachArray1 = secureArray; // currently the same
QCOMPARE( QCA::arrayToHex ( detachArray1 ), QString( "63636363636363636363" ) );
for (int i = 0; i < detachArray1.size(); i++) {
detachArray1[i] = 0x66; // implicit detach
@ -99,7 +99,7 @@ void SecureArrayUnitTest::testAll()
QCOMPARE( QCA::arrayToHex ( secureArray ), QString( "63636363636363636363" ) );
QCOMPARE( QCA::arrayToHex ( detachArray1 ), QString( "66666666666666666666" ) );
QSecureArray detachArray2 = secureArray; // currently the same
QCA::SecureArray detachArray2 = secureArray; // currently the same
QCOMPARE( QCA::arrayToHex ( detachArray2 ), QString( "63636363636363636363" ) );
//implicit detach
for (int i = 0; i < detachArray2.size(); i++) {
@ -108,7 +108,7 @@ void SecureArrayUnitTest::testAll()
QCOMPARE( QCA::arrayToHex ( secureArray ), QString( "63636363636363636363" ) );
QCOMPARE( QCA::arrayToHex ( detachArray2 ), QString( "67676767676767676767" ) );
QSecureArray detachArray3 = secureArray; // implicitly shared copy
QCA::SecureArray detachArray3 = secureArray; // implicitly shared copy
QCOMPARE( QCA::arrayToHex ( detachArray3 ), QString( "63636363636363636363" ) );
for (int i = 0; i < detachArray3.size(); i++) {
detachArray3.data()[i] = 0x68;
@ -118,7 +118,7 @@ void SecureArrayUnitTest::testAll()
// test for resizing
QSecureArray resizeArray = emptyArray;
QCA::SecureArray resizeArray = emptyArray;
QCOMPARE( resizeArray.size(), 0 );
resizeArray.resize(20);
QCOMPARE( resizeArray.size(), 20 );
@ -129,13 +129,13 @@ void SecureArrayUnitTest::testAll()
// test for append
QSecureArray appendArray = secureArray;
appendArray.append( QSecureArray() );
QCA::SecureArray appendArray = secureArray;
appendArray.append( QCA::SecureArray() );
QCOMPARE( QCA::arrayToHex( secureArray), QCA::arrayToHex( appendArray ) );
appendArray.append( secureArray );
QCOMPARE( QCA::arrayToHex ( secureArray ), QString( "63636363636363636363" ) );
QCOMPARE( QCA::arrayToHex ( appendArray ), QString( "6363636363636363636363636363636363636363" ) );
QSecureArray appendArray2 = secureArray;
QCA::SecureArray appendArray2 = secureArray;
QCOMPARE( QCA::arrayToHex ( appendArray2.append(secureArray) ), QString( "6363636363636363636363636363636363636363" ) );
// test for a possible problem with operator[]

View File

@ -63,7 +63,7 @@ void StaticUnitTest::hexConversions()
QCOMPARE( test == QCA::hexToArray(QString("62626262626262006262")), true );
QSecureArray testArray(10);
QCA::SecureArray testArray(10);
//testArray.fill( 'a' );
for (int i = 0; i < testArray.size(); i++) {
testArray[ i ] = 0x61;

View File

@ -60,7 +60,7 @@ void SymmetricKeyUnitTest::test1()
QCOMPARE( randomKey.size(),10 );
QByteArray byteArray(10, 'c');
QSecureArray secureArray( byteArray );
QCA::SecureArray secureArray( byteArray );
QCA::SymmetricKey keyArray = secureArray;
QCOMPARE( secureArray.size(), 10 );
QCOMPARE( keyArray.size(), secureArray.size() );