mirror of
https://github.com/QuasarApp/qca.git
synced 2025-05-15 03:49:33 +00:00
some nit api changes
svn path=/trunk/kdesupport/qca/; revision=673037
This commit is contained in:
parent
c025229198
commit
2171081a29
include/QtCrypto
src
unittest
dsaunittest
hashunittest
keygenunittest
rsaunittest
@ -286,12 +286,12 @@ QFile f( "file.dat" );
|
||||
if ( f1.open( IO_ReadOnly ) )
|
||||
{
|
||||
QCA::Hash hashObj("sha1");
|
||||
hashObj.update( f1 );
|
||||
hashObj.update( &f1 );
|
||||
QString output = hashObj.final() ) ),
|
||||
}
|
||||
\endcode
|
||||
*/
|
||||
virtual void update(QIODevice &file);
|
||||
virtual void update(QIODevice *file);
|
||||
|
||||
/**
|
||||
Finalises input and returns the hash result
|
||||
|
@ -1013,9 +1013,9 @@ public:
|
||||
|
||||
\return true if the key generator is in blocking mode
|
||||
|
||||
\sa setBlocking
|
||||
\sa setBlockingEnabled
|
||||
*/
|
||||
bool blocking() const;
|
||||
bool blockingEnabled() const;
|
||||
|
||||
/**
|
||||
Set whether the key generator is in blocking mode, nor not
|
||||
@ -1023,9 +1023,9 @@ public:
|
||||
\param b if true, the key generator will be set to operate in
|
||||
blocking mode, otherwise it will operate in non-blocking mode
|
||||
|
||||
\sa blocking()
|
||||
\sa blockingEnabled()
|
||||
*/
|
||||
void setBlocking(bool b);
|
||||
void setBlockingEnabled(bool b);
|
||||
|
||||
/**
|
||||
Test if the key generator is currently busy, or not
|
||||
|
@ -838,7 +838,7 @@ public:
|
||||
\param addr the address of the local part of the connection
|
||||
\param port the port number of the local part of the connection
|
||||
*/
|
||||
void setLocalAddr(const QString &addr, quint16 port);
|
||||
void setLocalAddress(const QString &addr, quint16 port);
|
||||
|
||||
/**
|
||||
Specify the peer address.
|
||||
@ -846,7 +846,7 @@ public:
|
||||
\param addr the address of the peer side of the connection
|
||||
\param port the port number of the peer side of the connection
|
||||
*/
|
||||
void setRemoteAddr(const QString &addr, quint16 port);
|
||||
void setRemoteAddress(const QString &addr, quint16 port);
|
||||
|
||||
/**
|
||||
Specify the id of the externally secured connection
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2003-2005 Justin Karneges <justin@affinix.com>
|
||||
* Copyright (C) 2003-2007 Justin Karneges <justin@affinix.com>
|
||||
* Copyright (C) 2004,2005,2007 Brad Hards <bradh@frogmouth.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@ -140,12 +140,12 @@ void Hash::update(const char *data, int len)
|
||||
}
|
||||
|
||||
// Reworked from KMD5, from KDE's kdelibs
|
||||
void Hash::update(QIODevice &file)
|
||||
void Hash::update(QIODevice *file)
|
||||
{
|
||||
char buffer[1024];
|
||||
int len;
|
||||
|
||||
while ((len=file.read(reinterpret_cast<char*>(buffer), sizeof(buffer))) > 0)
|
||||
while ((len=file->read(reinterpret_cast<char*>(buffer), sizeof(buffer))) > 0)
|
||||
update(buffer, len);
|
||||
}
|
||||
|
||||
|
@ -1145,12 +1145,12 @@ KeyGenerator::~KeyGenerator()
|
||||
delete d;
|
||||
}
|
||||
|
||||
bool KeyGenerator::blocking() const
|
||||
bool KeyGenerator::blockingEnabled() const
|
||||
{
|
||||
return d->blocking;
|
||||
}
|
||||
|
||||
void KeyGenerator::setBlocking(bool b)
|
||||
void KeyGenerator::setBlockingEnabled(bool b)
|
||||
{
|
||||
d->blocking = b;
|
||||
}
|
||||
|
@ -939,14 +939,14 @@ void SASL::setExternalSSF(int x)
|
||||
d->ext_ssf = x;
|
||||
}
|
||||
|
||||
void SASL::setLocalAddr(const QString &addr, quint16 port)
|
||||
void SASL::setLocalAddress(const QString &addr, quint16 port)
|
||||
{
|
||||
d->localSet = true;
|
||||
d->local.addr = addr;
|
||||
d->local.port = port;
|
||||
}
|
||||
|
||||
void SASL::setRemoteAddr(const QString &addr, quint16 port)
|
||||
void SASL::setRemoteAddress(const QString &addr, quint16 port)
|
||||
{
|
||||
d->remoteSet = true;
|
||||
d->remote.addr = addr;
|
||||
|
@ -60,7 +60,7 @@ void DSAUnitTest::testdsa()
|
||||
else {
|
||||
QCA::KeyGenerator keygen;
|
||||
QCOMPARE( keygen.isBusy(), false );
|
||||
QCOMPARE( keygen.blocking(), true );
|
||||
QCOMPARE( keygen.blockingEnabled(), true );
|
||||
QCA::DLGroup group = keygen.createDLGroup(QCA::DSA_1024);
|
||||
QCOMPARE( group.isNull(), false );
|
||||
|
||||
|
@ -222,7 +222,7 @@ void HashUnitTest::md5filetest()
|
||||
QFile f1( "./data/empty" );
|
||||
if ( f1.open( QIODevice::ReadOnly ) ) {
|
||||
QCA::Hash hashObj("md5", provider);
|
||||
hashObj.update( f1 );
|
||||
hashObj.update( &f1 );
|
||||
QCOMPARE( QString( QCA::arrayToHex( hashObj.final() ) ),
|
||||
QString( "d41d8cd98f00b204e9800998ecf8427e" ) );
|
||||
} else {
|
||||
@ -232,7 +232,7 @@ void HashUnitTest::md5filetest()
|
||||
QFile f2( "./data/Botan-1.4.1.tar.bz2" );
|
||||
if ( f2.open( QIODevice::ReadOnly ) ) {
|
||||
QCA::Hash hashObj("md5", provider);
|
||||
hashObj.update( f2 );
|
||||
hashObj.update( &f2 );
|
||||
QCOMPARE( QString( QCA::arrayToHex( hashObj.final() ) ),
|
||||
QString( "7c4b3d8a360c6c3cb647160fa9adfe71" ) );
|
||||
} else {
|
||||
@ -243,7 +243,7 @@ void HashUnitTest::md5filetest()
|
||||
QFile f3( "./data/linux-2.6.7.tar.bz2" );
|
||||
if ( f3.open( QIODevice::ReadOnly ) ) {
|
||||
QCA::Hash hashObj("md5", provider);
|
||||
hashObj.update( f3 );
|
||||
hashObj.update( &f3 );
|
||||
QCOMPARE( QString( QCA::arrayToHex( hashObj.final() ) ),
|
||||
QString( "a74671ea68b0e3c609e8785ed8497c14" ) );
|
||||
} else {
|
||||
@ -253,7 +253,7 @@ void HashUnitTest::md5filetest()
|
||||
QFile f4( "./data/scribus-1.2.tar.bz2" );
|
||||
if ( f4.open( QIODevice::ReadOnly ) ) {
|
||||
QCA::Hash hashObj("md5", provider);
|
||||
hashObj.update( f4 );
|
||||
hashObj.update( &f4 );
|
||||
QCOMPARE( QString( QCA::arrayToHex( hashObj.final() ) ),
|
||||
QString( "7d2c2b228f9a6ff82c9401fd54bdbe16" ) );
|
||||
} else {
|
||||
@ -400,7 +400,7 @@ void HashUnitTest::sha1longtest()
|
||||
QFile f1( "./data/empty" );
|
||||
if ( f1.open( QIODevice::ReadOnly ) ) {
|
||||
QCA::Hash hashObj("sha1", provider);
|
||||
hashObj.update( f1 );
|
||||
hashObj.update( &f1 );
|
||||
QCOMPARE( QString( QCA::arrayToHex( hashObj.final() ) ),
|
||||
QString( "da39a3ee5e6b4b0d3255bfef95601890afd80709" ) );
|
||||
} else {
|
||||
@ -410,7 +410,7 @@ void HashUnitTest::sha1longtest()
|
||||
QFile f2( "./data/Botan-1.4.1.tar.bz2" );
|
||||
if ( f2.open( QIODevice::ReadOnly ) ) {
|
||||
QCA::Hash hashObj("sha1", provider);
|
||||
hashObj.update( f2 );
|
||||
hashObj.update( &f2 );
|
||||
QCOMPARE( QString( QCA::arrayToHex( hashObj.final() ) ),
|
||||
QString( "cda343591428a68e22bd2e349b890cbafb642cf7" ) );
|
||||
} else {
|
||||
@ -420,7 +420,7 @@ void HashUnitTest::sha1longtest()
|
||||
QFile f3( "./data/linux-2.6.7.tar.bz2" );
|
||||
if ( f3.open( QIODevice::ReadOnly ) ) {
|
||||
QCA::Hash hashObj("sha1", provider);
|
||||
hashObj.update( f3 );
|
||||
hashObj.update( &f3 );
|
||||
QCOMPARE( QString( QCA::arrayToHex( hashObj.final() ) ),
|
||||
QString( "a030a9c6dcd10c5d90a86f915ad4710084cbca71" ) );
|
||||
} else {
|
||||
@ -430,7 +430,7 @@ void HashUnitTest::sha1longtest()
|
||||
QFile f4( "./data/scribus-1.2.tar.bz2" );
|
||||
if ( f4.open( QIODevice::ReadOnly ) ) {
|
||||
QCA::Hash hashObj("sha1", provider);
|
||||
hashObj.update( f4 );
|
||||
hashObj.update( &f4 );
|
||||
QCOMPARE( QString( QCA::arrayToHex( hashObj.final() ) ),
|
||||
QString( "a1fb6ed6acfd92381055b310d926d6e83e76ff1e" ) );
|
||||
} else {
|
||||
|
@ -56,7 +56,7 @@ void KeyGenUnitTest::testRSA()
|
||||
{
|
||||
QCA::KeyGenerator keygen;
|
||||
QCOMPARE( keygen.isBusy(), false );
|
||||
QCOMPARE( keygen.blocking(), true );
|
||||
QCOMPARE( keygen.blockingEnabled(), true );
|
||||
|
||||
if(!QCA::isSupported("pkey") ||
|
||||
!QCA::PKey::supportedTypes().contains(QCA::PKey::RSA) ||
|
||||
@ -86,7 +86,7 @@ void KeyGenUnitTest::testDSA()
|
||||
{
|
||||
QCA::KeyGenerator keygen;
|
||||
QCOMPARE( keygen.isBusy(), false );
|
||||
QCOMPARE( keygen.blocking(), true );
|
||||
QCOMPARE( keygen.blockingEnabled(), true );
|
||||
|
||||
if(!QCA::isSupported("pkey") ||
|
||||
!QCA::PKey::supportedTypes().contains(QCA::PKey::DSA) ||
|
||||
@ -116,7 +116,7 @@ void KeyGenUnitTest::testDH()
|
||||
{
|
||||
QCA::KeyGenerator keygen;
|
||||
QCOMPARE( keygen.isBusy(), false );
|
||||
QCOMPARE( keygen.blocking(), true );
|
||||
QCOMPARE( keygen.blockingEnabled(), true );
|
||||
|
||||
if(!QCA::isSupported("pkey") ||
|
||||
!QCA::PKey::supportedTypes().contains(QCA::PKey::DH) ||
|
||||
|
@ -64,7 +64,7 @@ void RSAUnitTest::testrsa()
|
||||
else {
|
||||
QCA::KeyGenerator keygen;
|
||||
QCOMPARE( keygen.isBusy(), false );
|
||||
QCOMPARE( keygen.blocking(), true );
|
||||
QCOMPARE( keygen.blockingEnabled(), true );
|
||||
|
||||
QList<int> keySizes;
|
||||
keySizes << 512 << 1024 << 768 << 2048;
|
||||
|
Loading…
x
Reference in New Issue
Block a user