mirror of
https://github.com/QuasarApp/qca.git
synced 2025-05-10 17:59:33 +00:00
clazy: enable qstring allocation warning
This commit is contained in:
parent
4a98dbdcd9
commit
8b171279e9
.gitlab-ci.yml
examples
aes-cmac
ciphertest
cms
eventhandlerdemo
hashtest
keyloader
mactest
md5crypt
providertest
publickeyexample
rsatest
saslclient
saslserver
ssltest
tlssocket
plugins
qca-botan
qca-cyrus-sasl
qca-gcrypt
qca-gnupg
gpgaction.cppgpgop.cpp
gpgproc
mykeystoreentry.cppmykeystorelist.cppmymessagecontext.cppmyopenpgpcontext.cppqca-gnupg.cpputils.cppqca-logger
qca-nss
qca-ossl
qca-pkcs11
qca-softstore
src
qca_basic.cppqca_cert.cppqca_core.cppqca_default.cppqca_keystore.cppqca_plugin.cppqca_publickey.cppqca_securelayer.cppqca_securemessage.cppqca_systemstore_flatfile.cpp
support
tools/qcatool
unittest
base64unittest
bigintunittest
certunittest
cipherunittest
clientplugin
cms
hashunittest
hexunittest
kdfunittest
keybundle
keystore
logger
macunittest
metatype
pgpunittest
pkits
rsaunittest
securearrayunittest
staticunittest
symmetrickeyunittest
tls
velox
@ -22,5 +22,5 @@ build_clazy_clang_tidy:
|
||||
- apt-get install --yes --no-install-recommends ninja-build libbotan-2-dev libnss3-dev libgcrypt20-dev libpkcs11-helper1-dev clazy clang clang-tidy jq
|
||||
script:
|
||||
- srcdir=`pwd` && mkdir -p /tmp/qca_build && cd /tmp/qca_build && CC=clang CXX=clazy CXXFLAGS="-Werror -Wno-deprecated-declarations" cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -G Ninja $srcdir && cat compile_commands.json | jq '[.[] | select(.file | contains("'"$srcdir"'"))]' > compile_commands.aux.json && mv compile_commands.aux.json compile_commands.json
|
||||
- CLAZY_CHECKS="level0,level1,level2,no-copyable-polymorphic,no-ctor-missing-parent-argument,no-qstring-allocations,isempty-vs-count,qhash-with-char-pointer-key,qproperty-type-mismatch,qrequiredresult-candidates,signal-with-return-value,thread-with-slots,tr-non-literal,unneeded-cast" ninja
|
||||
- CLAZY_CHECKS="level0,level1,level2,no-copyable-polymorphic,no-ctor-missing-parent-argument,isempty-vs-count,qhash-with-char-pointer-key,qproperty-type-mismatch,qrequiredresult-candidates,signal-with-return-value,thread-with-slots,tr-non-literal,unneeded-cast" ninja
|
||||
- "run-clang-tidy -header-filter='.*/qca/.*' -checks='-*,performance-*,modernize-deprecated-headers,modernize-make-unique,modernize-make-shared,modernize-use-override,modernize-use-equals-delete,modernize-use-emplace,modernize-use-bool-literals,modernize-redundant-void-arg,modernize-loop-convert,modernize-use-nullptr' -config=\"{WarningsAsErrors: '*'}\""
|
||||
|
@ -33,7 +33,7 @@ class AESCMACContext : public QCA::MACContext
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
AESCMACContext(QCA::Provider *p) : QCA::MACContext(p, "cmac(aes)")
|
||||
AESCMACContext(QCA::Provider *p) : QCA::MACContext(p, QStringLiteral("cmac(aes)"))
|
||||
{
|
||||
}
|
||||
|
||||
@ -95,7 +95,7 @@ public:
|
||||
m_residual = QCA::SecureArray();
|
||||
|
||||
// Figure 2.2, step 1.
|
||||
QCA::Cipher aesObj(QString("aes128"),
|
||||
QCA::Cipher aesObj(QStringLiteral("aes128"),
|
||||
QCA::Cipher::ECB, QCA::Cipher::DefaultPadding,
|
||||
QCA::Encode, key);
|
||||
QCA::SecureArray L = aesObj.process(const_Zero);
|
||||
@ -144,7 +144,7 @@ public:
|
||||
|
||||
m_Y = xorArray(m_X, thisBlock);
|
||||
|
||||
QCA::Cipher aesObj(QString("aes128"),
|
||||
QCA::Cipher aesObj(QStringLiteral("aes128"),
|
||||
QCA::Cipher::ECB, QCA::Cipher::DefaultPadding,
|
||||
QCA::Encode, m_key);
|
||||
m_X = aesObj.process(m_Y);
|
||||
@ -172,7 +172,7 @@ public:
|
||||
lastBlock = xorArray(m_residual, m_k1);
|
||||
}
|
||||
m_Y = xorArray(m_X, lastBlock);
|
||||
QCA::Cipher aesObj(QString("aes128"),
|
||||
QCA::Cipher aesObj(QStringLiteral("aes128"),
|
||||
QCA::Cipher::ECB, QCA::Cipher::DefaultPadding,
|
||||
QCA::Encode, m_key);
|
||||
*out = aesObj.process(m_Y);
|
||||
@ -205,20 +205,20 @@ public:
|
||||
|
||||
QString name() const override
|
||||
{
|
||||
return "exampleClientSideProvider";
|
||||
return QStringLiteral("exampleClientSideProvider");
|
||||
}
|
||||
|
||||
QStringList features() const override
|
||||
{
|
||||
QStringList list;
|
||||
list += "cmac(aes)";
|
||||
list += QStringLiteral("cmac(aes)");
|
||||
// you can add more features in here, if you have some.
|
||||
return list;
|
||||
}
|
||||
|
||||
Provider::Context *createContext(const QString &type) override
|
||||
{
|
||||
if(type == "cmac(aes)")
|
||||
if(type == QLatin1String("cmac(aes)"))
|
||||
return new AESCMACContext(this);
|
||||
// else if (type == some other feature)
|
||||
// return some other context.
|
||||
@ -236,7 +236,7 @@ class AES_CMAC: public QCA::MessageAuthenticationCode
|
||||
public:
|
||||
AES_CMAC(const QCA::SymmetricKey &key = QCA::SymmetricKey(),
|
||||
const QString &provider = QString()):
|
||||
QCA::MessageAuthenticationCode( "cmac(aes)", key, provider)
|
||||
QCA::MessageAuthenticationCode( QStringLiteral("cmac(aes)"), key, provider)
|
||||
{}
|
||||
};
|
||||
|
||||
@ -268,7 +268,7 @@ int main(int argc, char **argv)
|
||||
AES_CMAC cmacObject;
|
||||
|
||||
// create the key
|
||||
QCA::SymmetricKey key(QCA::hexToArray("2b7e151628aed2a6abf7158809cf4f3c"));
|
||||
QCA::SymmetricKey key(QCA::hexToArray(QStringLiteral("2b7e151628aed2a6abf7158809cf4f3c")));
|
||||
|
||||
// set the MAC to use the key
|
||||
cmacObject.setup(key);
|
||||
|
@ -56,7 +56,7 @@ int main(int argc, char **argv)
|
||||
QCA::InitializationVector iv(16);
|
||||
|
||||
// create a 128 bit AES cipher object using Cipher Block Chaining (CBC) mode
|
||||
QCA::Cipher cipher(QString("aes128"),QCA::Cipher::CBC,
|
||||
QCA::Cipher cipher(QStringLiteral("aes128"),QCA::Cipher::CBC,
|
||||
// use Default padding, which is equivalent to PKCS7 for CBC
|
||||
QCA::Cipher::DefaultPadding,
|
||||
// this object will encrypt
|
||||
|
@ -46,7 +46,7 @@ int main(int argc, char** argv)
|
||||
|
||||
// Read in a public key cert
|
||||
// you could also build this using the fromPEMFile() method
|
||||
QCA::Certificate pubCert( "User.pem" );
|
||||
QCA::Certificate pubCert( QStringLiteral("User.pem") );
|
||||
if ( pubCert.isNull() ) {
|
||||
qWarning() << "Sorry, could not import public key certificate";
|
||||
return 1;
|
||||
@ -98,7 +98,7 @@ int main(int argc, char** argv)
|
||||
QCA::PrivateKey privKey;
|
||||
QCA::ConvertResult convRes;
|
||||
QCA::SecureArray passPhrase = "start";
|
||||
privKey = QCA::PrivateKey::fromPEMFile( "Userkey.pem", passPhrase, &convRes );
|
||||
privKey = QCA::PrivateKey::fromPEMFile( QStringLiteral("Userkey.pem"), passPhrase, &convRes );
|
||||
if ( convRes != QCA::ConvertGood ) {
|
||||
qWarning() << "Sorry, could not import Private Key";
|
||||
return 1;
|
||||
|
@ -140,7 +140,7 @@ void asker_procedure()
|
||||
{
|
||||
QCA::PasswordAsker pwAsker;
|
||||
|
||||
pwAsker.ask( QCA::Event::StylePassword, "foo.tmp", nullptr );
|
||||
pwAsker.ask( QCA::Event::StylePassword, QStringLiteral("foo.tmp"), nullptr );
|
||||
|
||||
pwAsker.waitForResponse();
|
||||
|
||||
@ -150,7 +150,7 @@ void asker_procedure()
|
||||
|
||||
QCA::TokenAsker tokenAsker;
|
||||
|
||||
tokenAsker.ask( QCA::KeyStoreInfo( QCA::KeyStore::SmartCard, "Token Id", "Token Name" ), QCA::KeyStoreEntry(), nullptr );
|
||||
tokenAsker.ask( QCA::KeyStoreInfo( QCA::KeyStore::SmartCard, QStringLiteral("Token Id"), QStringLiteral("Token Name") ), QCA::KeyStoreEntry(), nullptr );
|
||||
|
||||
tokenAsker.waitForResponse();
|
||||
|
||||
|
@ -47,7 +47,7 @@ int main(int argc, char **argv)
|
||||
printf("SHA1 not supported!\n");
|
||||
else {
|
||||
// this shows the "all in one" approach
|
||||
QString result = QCA::Hash("sha1").hashToString(arg);
|
||||
QString result = QCA::Hash(QStringLiteral("sha1")).hashToString(arg);
|
||||
printf("sha1(\"%s\") = [%s]\n", arg.data(), qPrintable(result));
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ int main(int argc, char **argv)
|
||||
QCA::SecureArray part2(arg.toByteArray().mid(3)); // the rest - "lo"
|
||||
|
||||
// create the required object.
|
||||
QCA::Hash hashObject("md5");
|
||||
QCA::Hash hashObject(QStringLiteral("md5"));
|
||||
// we split it into two parts to show incremental update
|
||||
hashObject.update(part1);
|
||||
hashObject.update(part2);
|
||||
|
@ -50,7 +50,7 @@ private Q_SLOTS:
|
||||
{
|
||||
QCA::SecureArray pass;
|
||||
QCA::ConsolePrompt prompt;
|
||||
prompt.getHidden("Passphrase");
|
||||
prompt.getHidden(QStringLiteral("Passphrase"));
|
||||
prompt.waitForFinished();
|
||||
pass = prompt.result();
|
||||
handler.submitPassword(id, pass);
|
||||
|
@ -57,7 +57,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)", QCA::SecureArray() );
|
||||
QCA::MessageAuthenticationCode hmacObject( QStringLiteral("hmac(sha1)"), QCA::SecureArray() );
|
||||
|
||||
// create the key
|
||||
QCA::SymmetricKey keyObject(key);
|
||||
|
@ -38,7 +38,7 @@ QString to64 ( long v , int size )
|
||||
{
|
||||
|
||||
// Character set of the encrypted password: A-Za-z0-9./
|
||||
QString itoa64 = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
QString itoa64 = QStringLiteral("./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz");
|
||||
QString result;
|
||||
|
||||
while ( --size >= 0 )
|
||||
@ -66,8 +66,8 @@ QString qca_md5crypt( const QCA::SecureArray &password, const QCA::SecureArray &
|
||||
QCA::SecureArray finalState, magic_string = "$1$";
|
||||
|
||||
// The md5crypt algorithm uses two separate hashes
|
||||
QCA::Hash hash1( "md5" );
|
||||
QCA::Hash hash2( "md5" );
|
||||
QCA::Hash hash1( QStringLiteral("md5") );
|
||||
QCA::Hash hash2( QStringLiteral("md5") );
|
||||
|
||||
// MD5 Hash #1: pwd, magic string and salt
|
||||
hash1.update ( password );
|
||||
|
@ -52,7 +52,7 @@ int main(int argc, char **argv)
|
||||
QStringList capabilities = provider->features();
|
||||
// we turn the string list back into a single string,
|
||||
// and display it as well
|
||||
std::cout << capabilities.join(", ").toLatin1().data() << std::endl;
|
||||
std::cout << capabilities.join(QStringLiteral(", ")).toLatin1().data() << std::endl;
|
||||
}
|
||||
|
||||
// Note that the default provider isn't included in
|
||||
@ -61,7 +61,7 @@ int main(int argc, char **argv)
|
||||
// However it is still possible to get the features
|
||||
// supported by the default provider
|
||||
QStringList capabilities = QCA::defaultFeatures();
|
||||
std::cout << capabilities.join(", ").toLatin1().data() << std::endl;
|
||||
std::cout << capabilities.join(QStringLiteral(", ")).toLatin1().data() << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ int main(int argc, char** argv)
|
||||
QCA::PrivateKey privKey;
|
||||
QCA::ConvertResult convRes;
|
||||
QCA::SecureArray passPhrase = "start";
|
||||
privKey = QCA::PrivateKey::fromPEMFile( "Userkey.pem", passPhrase, &convRes );
|
||||
privKey = QCA::PrivateKey::fromPEMFile( QStringLiteral("Userkey.pem"), passPhrase, &convRes );
|
||||
if ( convRes != QCA::ConvertGood ) {
|
||||
std::cout << "Sorry, could not import Private Key" << std::endl;
|
||||
return 1;
|
||||
@ -57,7 +57,7 @@ int main(int argc, char** argv)
|
||||
|
||||
// Read in a matching public key cert
|
||||
// you could also build this using the fromPEMFile() method
|
||||
QCA::Certificate pubCert( "User.pem" );
|
||||
QCA::Certificate pubCert( QStringLiteral("User.pem") );
|
||||
if ( pubCert.isNull() ) {
|
||||
std::cout << "Sorry, could not import public key certificate" << std::endl;
|
||||
return 1;
|
||||
|
@ -86,11 +86,11 @@ int main(int argc, char **argv)
|
||||
// somewhere secure and has a good pass phrase
|
||||
// You can use the same technique with the public key too.
|
||||
QCA::SecureArray passPhrase = "pass phrase";
|
||||
seckey.toPEMFile("keyprivate.pem", passPhrase);
|
||||
seckey.toPEMFile(QStringLiteral("keyprivate.pem"), passPhrase);
|
||||
|
||||
// Read that key back in, checking if the read succeeded
|
||||
QCA::ConvertResult conversionResult;
|
||||
QCA::PrivateKey privateKey = QCA::PrivateKey::fromPEMFile( "keyprivate.pem",
|
||||
QCA::PrivateKey privateKey = QCA::PrivateKey::fromPEMFile( QStringLiteral("keyprivate.pem"),
|
||||
passPhrase,
|
||||
&conversionResult);
|
||||
if (! (QCA::ConvertGood == conversionResult) ) {
|
||||
|
@ -51,29 +51,29 @@ static QString socketErrorToString(QAbstractSocket::SocketError x)
|
||||
switch(x)
|
||||
{
|
||||
case QAbstractSocket::ConnectionRefusedError:
|
||||
s = "connection refused or timed out"; break;
|
||||
s = QStringLiteral("connection refused or timed out"); break;
|
||||
case QAbstractSocket::RemoteHostClosedError:
|
||||
s = "remote host closed the connection"; break;
|
||||
s = QStringLiteral("remote host closed the connection"); break;
|
||||
case QAbstractSocket::HostNotFoundError:
|
||||
s = "host not found"; break;
|
||||
s = QStringLiteral("host not found"); break;
|
||||
case QAbstractSocket::SocketAccessError:
|
||||
s = "access error"; break;
|
||||
s = QStringLiteral("access error"); break;
|
||||
case QAbstractSocket::SocketResourceError:
|
||||
s = "too many sockets"; break;
|
||||
s = QStringLiteral("too many sockets"); break;
|
||||
case QAbstractSocket::SocketTimeoutError:
|
||||
s = "operation timed out"; break;
|
||||
s = QStringLiteral("operation timed out"); break;
|
||||
case QAbstractSocket::DatagramTooLargeError:
|
||||
s = "datagram was larger than system limit"; break;
|
||||
s = QStringLiteral("datagram was larger than system limit"); break;
|
||||
case QAbstractSocket::NetworkError:
|
||||
s = "network error"; break;
|
||||
s = QStringLiteral("network error"); break;
|
||||
case QAbstractSocket::AddressInUseError:
|
||||
s = "address is already in use"; break;
|
||||
s = QStringLiteral("address is already in use"); break;
|
||||
case QAbstractSocket::SocketAddressNotAvailableError:
|
||||
s = "address does not belong to the host"; break;
|
||||
s = QStringLiteral("address does not belong to the host"); break;
|
||||
case QAbstractSocket::UnsupportedSocketOperationError:
|
||||
s = "operation is not supported by the local operating system"; break;
|
||||
s = QStringLiteral("operation is not supported by the local operating system"); break;
|
||||
default:
|
||||
s = "unknown socket error"; break;
|
||||
s = QStringLiteral("unknown socket error"); break;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
@ -84,14 +84,14 @@ static QString saslAuthConditionToString(QCA::SASL::AuthCondition x)
|
||||
switch(x)
|
||||
{
|
||||
case QCA::SASL::NoMechanism:
|
||||
s = "no appropriate mechanism could be negotiated"; break;
|
||||
s = QStringLiteral("no appropriate mechanism could be negotiated"); break;
|
||||
case QCA::SASL::BadProtocol:
|
||||
s = "bad SASL protocol"; break;
|
||||
s = QStringLiteral("bad SASL protocol"); break;
|
||||
case QCA::SASL::BadServer:
|
||||
s = "server failed mutual authentication"; break;
|
||||
s = QStringLiteral("server failed mutual authentication"); break;
|
||||
// AuthFail or unknown (including those defined for server only)
|
||||
default:
|
||||
s = "generic authentication failure"; break;
|
||||
s = QStringLiteral("generic authentication failure"); break;
|
||||
};
|
||||
return s;
|
||||
}
|
||||
@ -257,7 +257,7 @@ private Q_SLOTS:
|
||||
|
||||
void sasl_nextStep(const QByteArray &stepData)
|
||||
{
|
||||
QString line = "C";
|
||||
QString line = QStringLiteral("C");
|
||||
if(!stepData.isEmpty())
|
||||
{
|
||||
line += ',';
|
||||
@ -270,13 +270,13 @@ private Q_SLOTS:
|
||||
{
|
||||
if(params.needUsername())
|
||||
{
|
||||
user = prompt("Username:");
|
||||
user = prompt(QStringLiteral("Username:"));
|
||||
sasl->setUsername(user);
|
||||
}
|
||||
|
||||
if(params.canSendAuthzid() && !no_authzid)
|
||||
{
|
||||
authzid = prompt("Authorize As (enter to skip):");
|
||||
authzid = prompt(QStringLiteral("Authorize As (enter to skip):"));
|
||||
if(!authzid.isEmpty())
|
||||
sasl->setAuthzid(authzid);
|
||||
}
|
||||
@ -284,7 +284,7 @@ private Q_SLOTS:
|
||||
if(params.needPassword())
|
||||
{
|
||||
QCA::ConsolePrompt prompt;
|
||||
prompt.getHidden("* Password");
|
||||
prompt.getHidden(QStringLiteral("* Password"));
|
||||
prompt.waitForFinished();
|
||||
QCA::SecureArray pass = prompt.result();
|
||||
sasl->setPassword(pass);
|
||||
@ -298,7 +298,7 @@ private Q_SLOTS:
|
||||
printf(" (none specified)\n");
|
||||
foreach(const QString &s, realms)
|
||||
printf(" %s\n", qPrintable(s));
|
||||
realm = prompt("Realm (enter to skip):");
|
||||
realm = prompt(QStringLiteral("Realm (enter to skip):"));
|
||||
if(!realm.isEmpty())
|
||||
sasl->setRealm(realm);
|
||||
}
|
||||
@ -434,11 +434,11 @@ private:
|
||||
else
|
||||
type = line;
|
||||
|
||||
if(type == "C")
|
||||
if(type == QLatin1String("C"))
|
||||
{
|
||||
sasl->putStep(stringToArray(rest));
|
||||
}
|
||||
else if(type == "E")
|
||||
else if(type == QLatin1String("E"))
|
||||
{
|
||||
if(!rest.isEmpty())
|
||||
printf("Error: server says: %s.\n", qPrintable(rest));
|
||||
@ -447,7 +447,7 @@ private:
|
||||
emit quit();
|
||||
return;
|
||||
}
|
||||
else if(type == "A")
|
||||
else if(type == QLatin1String("A"))
|
||||
{
|
||||
printf("Authentication success.\n");
|
||||
mode = 2; // switch to app mode
|
||||
@ -483,13 +483,13 @@ int main(int argc, char **argv)
|
||||
args.removeFirst();
|
||||
|
||||
// options
|
||||
QString proto = "qcatest"; // default protocol
|
||||
QString proto = QStringLiteral("qcatest"); // default protocol
|
||||
QString authzid, realm;
|
||||
bool no_authzid = false;
|
||||
bool no_realm = false;
|
||||
for(int n = 0; n < args.count(); ++n)
|
||||
{
|
||||
if(!args[n].startsWith("--"))
|
||||
if(!args[n].startsWith(QLatin1String("--")))
|
||||
continue;
|
||||
|
||||
QString opt = args[n].mid(2);
|
||||
@ -503,11 +503,11 @@ int main(int argc, char **argv)
|
||||
else
|
||||
var = opt;
|
||||
|
||||
if(var == "proto")
|
||||
if(var == QLatin1String("proto"))
|
||||
{
|
||||
proto = val;
|
||||
}
|
||||
else if(var == "authzid")
|
||||
else if(var == QLatin1String("authzid"))
|
||||
{
|
||||
// specifying empty authzid means force unspecified
|
||||
if(val.isEmpty())
|
||||
@ -515,7 +515,7 @@ int main(int argc, char **argv)
|
||||
else
|
||||
authzid = val;
|
||||
}
|
||||
else if(var == "realm")
|
||||
else if(var == QLatin1String("realm"))
|
||||
{
|
||||
// specifying empty realm means force unspecified
|
||||
if(val.isEmpty())
|
||||
|
@ -39,29 +39,29 @@ static QString socketErrorToString(QAbstractSocket::SocketError x)
|
||||
switch(x)
|
||||
{
|
||||
case QAbstractSocket::ConnectionRefusedError:
|
||||
s = "connection refused or timed out"; break;
|
||||
s = QStringLiteral("connection refused or timed out"); break;
|
||||
case QAbstractSocket::RemoteHostClosedError:
|
||||
s = "remote host closed the connection"; break;
|
||||
s = QStringLiteral("remote host closed the connection"); break;
|
||||
case QAbstractSocket::HostNotFoundError:
|
||||
s = "host not found"; break;
|
||||
s = QStringLiteral("host not found"); break;
|
||||
case QAbstractSocket::SocketAccessError:
|
||||
s = "access error"; break;
|
||||
s = QStringLiteral("access error"); break;
|
||||
case QAbstractSocket::SocketResourceError:
|
||||
s = "too many sockets"; break;
|
||||
s = QStringLiteral("too many sockets"); break;
|
||||
case QAbstractSocket::SocketTimeoutError:
|
||||
s = "operation timed out"; break;
|
||||
s = QStringLiteral("operation timed out"); break;
|
||||
case QAbstractSocket::DatagramTooLargeError:
|
||||
s = "datagram was larger than system limit"; break;
|
||||
s = QStringLiteral("datagram was larger than system limit"); break;
|
||||
case QAbstractSocket::NetworkError:
|
||||
s = "network error"; break;
|
||||
s = QStringLiteral("network error"); break;
|
||||
case QAbstractSocket::AddressInUseError:
|
||||
s = "address is already in use"; break;
|
||||
s = QStringLiteral("address is already in use"); break;
|
||||
case QAbstractSocket::SocketAddressNotAvailableError:
|
||||
s = "address does not belong to the host"; break;
|
||||
s = QStringLiteral("address does not belong to the host"); break;
|
||||
case QAbstractSocket::UnsupportedSocketOperationError:
|
||||
s = "operation is not supported by the local operating system"; break;
|
||||
s = QStringLiteral("operation is not supported by the local operating system"); break;
|
||||
default:
|
||||
s = "unknown socket error"; break;
|
||||
s = QStringLiteral("unknown socket error"); break;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
@ -72,28 +72,28 @@ static QString saslAuthConditionToString(QCA::SASL::AuthCondition x)
|
||||
switch(x)
|
||||
{
|
||||
case QCA::SASL::NoMechanism:
|
||||
s = "no appropriate mechanism could be negotiated"; break;
|
||||
s = QStringLiteral("no appropriate mechanism could be negotiated"); break;
|
||||
case QCA::SASL::BadProtocol:
|
||||
s = "bad SASL protocol"; break;
|
||||
s = QStringLiteral("bad SASL protocol"); break;
|
||||
case QCA::SASL::BadAuth:
|
||||
s = "authentication failed"; break;
|
||||
s = QStringLiteral("authentication failed"); break;
|
||||
case QCA::SASL::NoAuthzid:
|
||||
s = "authorization failed"; break;
|
||||
s = QStringLiteral("authorization failed"); break;
|
||||
case QCA::SASL::TooWeak:
|
||||
s = "mechanism too weak for this user"; break;
|
||||
s = QStringLiteral("mechanism too weak for this user"); break;
|
||||
case QCA::SASL::NeedEncrypt:
|
||||
s = "encryption is needed to use this mechanism"; break;
|
||||
s = QStringLiteral("encryption is needed to use this mechanism"); break;
|
||||
case QCA::SASL::Expired:
|
||||
s = "passphrase expired"; break;
|
||||
s = QStringLiteral("passphrase expired"); break;
|
||||
case QCA::SASL::Disabled:
|
||||
s = "account is disabled"; break;
|
||||
s = QStringLiteral("account is disabled"); break;
|
||||
case QCA::SASL::NoUser:
|
||||
s = "user not found"; break;
|
||||
s = QStringLiteral("user not found"); break;
|
||||
case QCA::SASL::RemoteUnavailable:
|
||||
s = "needed remote service is unavailable"; break;
|
||||
s = QStringLiteral("needed remote service is unavailable"); break;
|
||||
// AuthFail or unknown (including those defined for client only)
|
||||
default:
|
||||
s = "generic authentication failure"; break;
|
||||
s = QStringLiteral("generic authentication failure"); break;
|
||||
};
|
||||
return s;
|
||||
}
|
||||
@ -187,7 +187,7 @@ public:
|
||||
private Q_SLOTS:
|
||||
void sasl_serverStarted()
|
||||
{
|
||||
sendLine(sasl->mechanismList().join(" "));
|
||||
sendLine(sasl->mechanismList().join(QStringLiteral(" ")));
|
||||
}
|
||||
|
||||
void sock_disconnected()
|
||||
@ -234,7 +234,7 @@ private Q_SLOTS:
|
||||
|
||||
void sasl_nextStep(const QByteArray &stepData)
|
||||
{
|
||||
QString line = "C";
|
||||
QString line = QStringLiteral("C");
|
||||
if(!stepData.isEmpty())
|
||||
{
|
||||
line += ',';
|
||||
@ -263,7 +263,7 @@ private Q_SLOTS:
|
||||
|
||||
void sasl_authenticated()
|
||||
{
|
||||
sendLine("A");
|
||||
sendLine(QStringLiteral("A"));
|
||||
printf("%d: Authentication success.\n", id);
|
||||
mode = 2; // switch to app mode
|
||||
printf("%d: SSF: %d\n", id, sasl->ssf());
|
||||
@ -291,7 +291,7 @@ private Q_SLOTS:
|
||||
else if(e == QCA::SASL::ErrorHandshake)
|
||||
{
|
||||
QString errstr = saslAuthConditionToString(sasl->authCondition());
|
||||
sendLine(QString("E,") + errstr);
|
||||
sendLine(QStringLiteral("E,") + errstr);
|
||||
printf("%d: Error: sasl: %s.\n", id, qPrintable(errstr));
|
||||
}
|
||||
else if(e == QCA::SASL::ErrorCrypt)
|
||||
@ -340,10 +340,10 @@ private:
|
||||
else
|
||||
{
|
||||
type = line;
|
||||
rest = "";
|
||||
rest = QLatin1String("");
|
||||
}
|
||||
|
||||
if(type == "C")
|
||||
if(type == QLatin1String("C"))
|
||||
{
|
||||
sasl->putStep(stringToArray(rest));
|
||||
}
|
||||
@ -441,17 +441,17 @@ int main(int argc, char **argv)
|
||||
QCA::Initializer init;
|
||||
QCoreApplication qapp(argc, argv);
|
||||
|
||||
QCA::setAppName("saslserver");
|
||||
QCA::setAppName(QStringLiteral("saslserver"));
|
||||
|
||||
QStringList args = qapp.arguments();
|
||||
args.removeFirst();
|
||||
|
||||
// options
|
||||
QString proto = "qcatest"; // default protocol
|
||||
QString proto = QStringLiteral("qcatest"); // default protocol
|
||||
QString realm;
|
||||
for(int n = 0; n < args.count(); ++n)
|
||||
{
|
||||
if(!args[n].startsWith("--"))
|
||||
if(!args[n].startsWith(QLatin1String("--")))
|
||||
continue;
|
||||
|
||||
QString opt = args[n].mid(2);
|
||||
@ -465,9 +465,9 @@ int main(int argc, char **argv)
|
||||
else
|
||||
var = opt;
|
||||
|
||||
if(var == "proto")
|
||||
if(var == QLatin1String("proto"))
|
||||
proto = val;
|
||||
else if(var == "realm")
|
||||
else if(var == QLatin1String("realm"))
|
||||
realm = val;
|
||||
|
||||
args.removeAt(n);
|
||||
@ -484,7 +484,7 @@ int main(int argc, char **argv)
|
||||
int port = 8001; // default port
|
||||
|
||||
QString hostinput = args[0];
|
||||
QString str = "Hello, World";
|
||||
QString str = QStringLiteral("Hello, World");
|
||||
if(args.count() >= 2)
|
||||
str = args[1];
|
||||
|
||||
|
@ -61,41 +61,41 @@ static QString validityToString(QCA::Validity v)
|
||||
switch(v)
|
||||
{
|
||||
case QCA::ValidityGood:
|
||||
s = "Validated";
|
||||
s = QStringLiteral("Validated");
|
||||
break;
|
||||
case QCA::ErrorRejected:
|
||||
s = "Root CA is marked to reject the specified purpose";
|
||||
s = QStringLiteral("Root CA is marked to reject the specified purpose");
|
||||
break;
|
||||
case QCA::ErrorUntrusted:
|
||||
s = "Certificate not trusted for the required purpose";
|
||||
s = QStringLiteral("Certificate not trusted for the required purpose");
|
||||
break;
|
||||
case QCA::ErrorSignatureFailed:
|
||||
s = "Invalid signature";
|
||||
s = QStringLiteral("Invalid signature");
|
||||
break;
|
||||
case QCA::ErrorInvalidCA:
|
||||
s = "Invalid CA certificate";
|
||||
s = QStringLiteral("Invalid CA certificate");
|
||||
break;
|
||||
case QCA::ErrorInvalidPurpose:
|
||||
s = "Invalid certificate purpose";
|
||||
s = QStringLiteral("Invalid certificate purpose");
|
||||
break;
|
||||
case QCA::ErrorSelfSigned:
|
||||
s = "Certificate is self-signed";
|
||||
s = QStringLiteral("Certificate is self-signed");
|
||||
break;
|
||||
case QCA::ErrorRevoked:
|
||||
s = "Certificate has been revoked";
|
||||
s = QStringLiteral("Certificate has been revoked");
|
||||
break;
|
||||
case QCA::ErrorPathLengthExceeded:
|
||||
s = "Maximum certificate chain length exceeded";
|
||||
s = QStringLiteral("Maximum certificate chain length exceeded");
|
||||
break;
|
||||
case QCA::ErrorExpired:
|
||||
s = "Certificate has expired";
|
||||
s = QStringLiteral("Certificate has expired");
|
||||
break;
|
||||
case QCA::ErrorExpiredCA:
|
||||
s = "CA has expired";
|
||||
s = QStringLiteral("CA has expired");
|
||||
break;
|
||||
case QCA::ErrorValidityUnknown:
|
||||
default:
|
||||
s = "General certificate validation error";
|
||||
s = QStringLiteral("General certificate validation error");
|
||||
break;
|
||||
}
|
||||
return s;
|
||||
@ -221,16 +221,16 @@ private Q_SLOTS:
|
||||
showCertInfo(cert);
|
||||
}
|
||||
|
||||
QString str = "Peer Identity: ";
|
||||
QString str = QStringLiteral("Peer Identity: ");
|
||||
if(r == QCA::TLS::Valid)
|
||||
str += "Valid";
|
||||
str += QStringLiteral("Valid");
|
||||
else if(r == QCA::TLS::HostMismatch)
|
||||
str += "Error: Wrong certificate";
|
||||
str += QStringLiteral("Error: Wrong certificate");
|
||||
else if(r == QCA::TLS::InvalidCertificate)
|
||||
str += "Error: Invalid certificate.\n -> Reason: " +
|
||||
str += QStringLiteral("Error: Invalid certificate.\n -> Reason: ") +
|
||||
validityToString(ssl->peerCertificateValidity());
|
||||
else
|
||||
str += "Error: No certificate";
|
||||
str += QStringLiteral("Error: No certificate");
|
||||
printf("%s\n", qPrintable(str));
|
||||
|
||||
ssl->continueAfterStep();
|
||||
@ -316,7 +316,7 @@ int main(int argc, char **argv)
|
||||
QCA::Initializer init;
|
||||
|
||||
QCoreApplication app(argc, argv);
|
||||
QString host = argc > 1 ? argv[1] : "andbit.net";
|
||||
QString host = argc > 1 ? argv[1] : QStringLiteral("andbit.net");
|
||||
|
||||
if(!QCA::isSupported("tls"))
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ int main(int argc, char **argv)
|
||||
QCoreApplication qapp(argc, argv);
|
||||
|
||||
TLSSocket socket;
|
||||
socket.connectToHostEncrypted("www.paypal.com", 443);
|
||||
socket.connectToHostEncrypted(QStringLiteral("www.paypal.com"), 443);
|
||||
socket.write("GET / HTTP/1.0\r\n\r\n");
|
||||
while(socket.waitForReadyRead())
|
||||
printf("%s", socket.readAll().constData());
|
||||
|
@ -61,22 +61,22 @@ public:
|
||||
|
||||
static QString qcaHashToBotanHash(const QString &type)
|
||||
{
|
||||
if ( type == "md2" )
|
||||
return QString("MD2");
|
||||
else if ( type == "md4" )
|
||||
return QString("MD4");
|
||||
else if ( type == "md5" )
|
||||
return QString("MD5");
|
||||
else if ( type == "sha1" )
|
||||
return QString("SHA-1");
|
||||
else if ( type == "sha256" )
|
||||
return QString("SHA-256");
|
||||
else if ( type == "sha384" )
|
||||
return QString("SHA-384");
|
||||
else if ( type == "sha512" )
|
||||
return QString("SHA-512");
|
||||
else if ( type == "ripemd160" )
|
||||
return QString("RIPEMD-160");
|
||||
if ( type == QLatin1String("md2") )
|
||||
return QStringLiteral("MD2");
|
||||
else if ( type == QLatin1String("md4") )
|
||||
return QStringLiteral("MD4");
|
||||
else if ( type == QLatin1String("md5") )
|
||||
return QStringLiteral("MD5");
|
||||
else if ( type == QLatin1String("sha1") )
|
||||
return QStringLiteral("SHA-1");
|
||||
else if ( type == QLatin1String("sha256") )
|
||||
return QStringLiteral("SHA-256");
|
||||
else if ( type == QLatin1String("sha384") )
|
||||
return QStringLiteral("SHA-384");
|
||||
else if ( type == QLatin1String("sha512") )
|
||||
return QStringLiteral("SHA-512");
|
||||
else if ( type == QLatin1String("ripemd160") )
|
||||
return QStringLiteral("RIPEMD-160");
|
||||
|
||||
return {};
|
||||
}
|
||||
@ -130,18 +130,18 @@ private:
|
||||
|
||||
static QString qcaHmacToBotanHmac(const QString &type)
|
||||
{
|
||||
if ( type == "hmac(md5)" )
|
||||
return QString("MD5");
|
||||
else if ( type == "hmac(sha1)" )
|
||||
return QString("SHA-1");
|
||||
else if ( type == "hmac(sha256)" )
|
||||
return QString("SHA-256");
|
||||
else if ( type == "hmac(sha384)" )
|
||||
return QString("SHA-384");
|
||||
else if ( type == "hmac(sha512)" )
|
||||
return QString("SHA-512");
|
||||
else if ( type == "hmac(ripemd160)" )
|
||||
return QString("RIPEMD-160");
|
||||
if ( type == QLatin1String("hmac(md5)") )
|
||||
return QStringLiteral("MD5");
|
||||
else if ( type == QLatin1String("hmac(sha1)") )
|
||||
return QStringLiteral("SHA-1");
|
||||
else if ( type == QLatin1String("hmac(sha256)") )
|
||||
return QStringLiteral("SHA-256");
|
||||
else if ( type == QLatin1String("hmac(sha384)") )
|
||||
return QStringLiteral("SHA-384");
|
||||
else if ( type == QLatin1String("hmac(sha512)") )
|
||||
return QStringLiteral("SHA-512");
|
||||
else if ( type == QLatin1String("hmac(ripemd160)") )
|
||||
return QStringLiteral("RIPEMD-160");
|
||||
|
||||
return {};
|
||||
}
|
||||
@ -290,8 +290,8 @@ protected:
|
||||
|
||||
static QString qcaHkdfToBotanHkdf(const QString &type)
|
||||
{
|
||||
if ( type == "hkdf(sha256)" )
|
||||
return QString("SHA-256");
|
||||
if ( type == QLatin1String("hkdf(sha256)") )
|
||||
return QStringLiteral("SHA-256");
|
||||
|
||||
return {};
|
||||
}
|
||||
@ -338,99 +338,99 @@ protected:
|
||||
|
||||
static void qcaCipherToBotanCipher(const QString &type, std::string *algoName, std::string *algoMode, std::string *algoPadding)
|
||||
{
|
||||
if (type == "aes128-ecb" ) {
|
||||
if (type == QLatin1String("aes128-ecb") ) {
|
||||
*algoName = "AES-128";
|
||||
*algoMode = "ECB";
|
||||
*algoPadding = "NoPadding";
|
||||
} else if ( type == "aes128-cbc" ) {
|
||||
} else if ( type == QLatin1String("aes128-cbc") ) {
|
||||
*algoName = "AES-128";
|
||||
*algoMode = "CBC";
|
||||
*algoPadding = "NoPadding";
|
||||
} else if ( type == "aes128-cfb" ) {
|
||||
} else if ( type == QLatin1String("aes128-cfb") ) {
|
||||
*algoName = "AES-128";
|
||||
*algoMode = "CFB";
|
||||
*algoPadding = "NoPadding";
|
||||
} else if ( type == "aes128-ofb" ) {
|
||||
} else if ( type == QLatin1String("aes128-ofb") ) {
|
||||
*algoName = "AES-128";
|
||||
*algoMode = "OFB";
|
||||
*algoPadding = "NoPadding";
|
||||
} else if ( type == "aes192-ecb" ) {
|
||||
} else if ( type == QLatin1String("aes192-ecb") ) {
|
||||
*algoName = "AES-192";
|
||||
*algoMode = "ECB";
|
||||
*algoPadding = "NoPadding";
|
||||
} else if ( type == "aes192-cbc" ) {
|
||||
} else if ( type == QLatin1String("aes192-cbc") ) {
|
||||
*algoName = "AES-192";
|
||||
*algoMode = "CBC";
|
||||
*algoPadding = "NoPadding";
|
||||
} else if ( type == "aes192-cfb" ) {
|
||||
} else if ( type == QLatin1String("aes192-cfb") ) {
|
||||
*algoName = "AES-192";
|
||||
*algoMode = "CFB";
|
||||
*algoPadding = "NoPadding";
|
||||
} else if ( type == "aes192-ofb" ) {
|
||||
} else if ( type == QLatin1String("aes192-ofb") ) {
|
||||
*algoName = "AES-192";
|
||||
*algoMode = "OFB";
|
||||
*algoPadding = "NoPadding";
|
||||
} else if ( type == "aes256-ecb" ) {
|
||||
} else if ( type == QLatin1String("aes256-ecb") ) {
|
||||
*algoName = "AES-256";
|
||||
*algoMode = "ECB";
|
||||
*algoPadding = "NoPadding";
|
||||
} else if ( type == "aes256-cbc" ) {
|
||||
} else if ( type == QLatin1String("aes256-cbc") ) {
|
||||
*algoName = "AES-256";
|
||||
*algoMode = "CBC";
|
||||
*algoPadding = "NoPadding";
|
||||
} else if ( type == "aes256-cfb" ) {
|
||||
} else if ( type == QLatin1String("aes256-cfb") ) {
|
||||
*algoName = "AES-256";
|
||||
*algoMode = "CFB";
|
||||
*algoPadding = "NoPadding";
|
||||
} else if ( type == "aes256-ofb" ) {
|
||||
} else if ( type == QLatin1String("aes256-ofb") ) {
|
||||
*algoName = "AES-256";
|
||||
*algoMode = "OFB";
|
||||
*algoPadding = "NoPadding";
|
||||
} else if ( type == "blowfish-ecb" ) {
|
||||
} else if ( type == QLatin1String("blowfish-ecb") ) {
|
||||
*algoName = "Blowfish";
|
||||
*algoMode = "ECB";
|
||||
*algoPadding = "NoPadding";
|
||||
} else if ( type == "blowfish-cbc" ) {
|
||||
} else if ( type == QLatin1String("blowfish-cbc") ) {
|
||||
*algoName = "Blowfish";
|
||||
*algoMode = "CBC";
|
||||
*algoPadding = "NoPadding";
|
||||
} else if ( type == "blowfish-cbc-pkcs7" ) {
|
||||
} else if ( type == QLatin1String("blowfish-cbc-pkcs7") ) {
|
||||
*algoName = "Blowfish";
|
||||
*algoMode = "CBC";
|
||||
*algoPadding = "PKCS7";
|
||||
} else if ( type == "blowfish-cfb" ) {
|
||||
} else if ( type == QLatin1String("blowfish-cfb") ) {
|
||||
*algoName = "Blowfish";
|
||||
*algoMode = "CFB";
|
||||
*algoPadding = "NoPadding";
|
||||
} else if ( type == "blowfish-ofb" ) {
|
||||
} else if ( type == QLatin1String("blowfish-ofb") ) {
|
||||
*algoName = "Blowfish";
|
||||
*algoMode = "OFB";
|
||||
*algoPadding = "NoPadding";
|
||||
} else if ( type == "des-ecb" ) {
|
||||
} else if ( type == QLatin1String("des-ecb") ) {
|
||||
*algoName = "DES";
|
||||
*algoMode = "ECB";
|
||||
*algoPadding = "NoPadding";
|
||||
} else if ( type == "des-ecb-pkcs7" ) {
|
||||
} else if ( type == QLatin1String("des-ecb-pkcs7") ) {
|
||||
*algoName = "DES";
|
||||
*algoMode = "ECB";
|
||||
*algoPadding = "PKCS7";
|
||||
} else if ( type == "des-cbc" ) {
|
||||
} else if ( type == QLatin1String("des-cbc") ) {
|
||||
*algoName = "DES";
|
||||
*algoMode = "CBC";
|
||||
*algoPadding = "NoPadding";
|
||||
} else if ( type == "des-cbc-pkcs7" ) {
|
||||
} else if ( type == QLatin1String("des-cbc-pkcs7") ) {
|
||||
*algoName = "DES";
|
||||
*algoMode = "CBC";
|
||||
*algoPadding = "PKCS7";
|
||||
} else if ( type == "des-cfb" ) {
|
||||
} else if ( type == QLatin1String("des-cfb") ) {
|
||||
*algoName = "DES";
|
||||
*algoMode = "CFB";
|
||||
*algoPadding = "NoPadding";
|
||||
} else if ( type == "des-ofb" ) {
|
||||
} else if ( type == QLatin1String("des-ofb") ) {
|
||||
*algoName = "DES";
|
||||
*algoMode = "OFB";
|
||||
*algoPadding = "NoPadding";
|
||||
} else if ( type == "tripledes-ecb" ) {
|
||||
} else if ( type == QLatin1String("tripledes-ecb") ) {
|
||||
*algoName = "TripleDES";
|
||||
*algoMode = "ECB";
|
||||
*algoPadding = "NoPadding";
|
||||
@ -578,18 +578,18 @@ public:
|
||||
|
||||
QString name() const override
|
||||
{
|
||||
return "qca-botan";
|
||||
return QStringLiteral("qca-botan");
|
||||
}
|
||||
|
||||
const QStringList &pbkdfTypes() const
|
||||
{
|
||||
static QStringList list;
|
||||
if (list.isEmpty()) {
|
||||
list += "pbkdf1(sha1)";
|
||||
std::unique_ptr<BotanPBKDFContext> pbkdf1md2(new BotanPBKDFContext( nullptr, "pbkdf1(md2)"));
|
||||
list += QStringLiteral("pbkdf1(sha1)");
|
||||
std::unique_ptr<BotanPBKDFContext> pbkdf1md2(new BotanPBKDFContext( nullptr, QStringLiteral("pbkdf1(md2)")));
|
||||
if (pbkdf1md2->isOk())
|
||||
list += "pbkdf1(md2)";
|
||||
list += "pbkdf2(sha1)";
|
||||
list += QStringLiteral("pbkdf1(md2)");
|
||||
list += QStringLiteral("pbkdf2(sha1)");
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@ -599,14 +599,14 @@ public:
|
||||
static QStringList supported;
|
||||
if (supported.isEmpty()) {
|
||||
QStringList list;
|
||||
list += "md2";
|
||||
list += "md4";
|
||||
list += "md5";
|
||||
list += "sha1";
|
||||
list += "sha256";
|
||||
list += "sha384";
|
||||
list += "sha512";
|
||||
list += "ripemd160";
|
||||
list += QStringLiteral("md2");
|
||||
list += QStringLiteral("md4");
|
||||
list += QStringLiteral("md5");
|
||||
list += QStringLiteral("sha1");
|
||||
list += QStringLiteral("sha256");
|
||||
list += QStringLiteral("sha384");
|
||||
list += QStringLiteral("sha512");
|
||||
list += QStringLiteral("ripemd160");
|
||||
|
||||
for (const QString &hash : qAsConst(list)) {
|
||||
std::unique_ptr<BotanHashContext> hashContext(new BotanHashContext(nullptr, hash));
|
||||
@ -623,30 +623,30 @@ public:
|
||||
static QStringList supported;
|
||||
if (supported.isEmpty()) {
|
||||
QStringList list;
|
||||
list += "aes128-ecb";
|
||||
list += "aes128-cbc";
|
||||
list += "aes128-cfb";
|
||||
list += "aes128-ofb";
|
||||
list += "aes192-ecb";
|
||||
list += "aes192-cbc";
|
||||
list += "aes192-cfb";
|
||||
list += "aes192-ofb";
|
||||
list += "aes256-ecb";
|
||||
list += "aes256-cbc";
|
||||
list += "aes256-cfb";
|
||||
list += "aes256-ofb";
|
||||
list += "des-ecb";
|
||||
list += "des-ecb-pkcs7";
|
||||
list += "des-cbc";
|
||||
list += "des-cbc-pkcs7";
|
||||
list += "des-cfb";
|
||||
list += "des-ofb";
|
||||
list += "tripledes-ecb";
|
||||
list += "blowfish-ecb";
|
||||
list += "blowfish-cbc";
|
||||
list += "blowfish-cbc-pkcs7";
|
||||
list += "blowfish-cfb";
|
||||
list += "blowfish-ofb";
|
||||
list += QStringLiteral("aes128-ecb");
|
||||
list += QStringLiteral("aes128-cbc");
|
||||
list += QStringLiteral("aes128-cfb");
|
||||
list += QStringLiteral("aes128-ofb");
|
||||
list += QStringLiteral("aes192-ecb");
|
||||
list += QStringLiteral("aes192-cbc");
|
||||
list += QStringLiteral("aes192-cfb");
|
||||
list += QStringLiteral("aes192-ofb");
|
||||
list += QStringLiteral("aes256-ecb");
|
||||
list += QStringLiteral("aes256-cbc");
|
||||
list += QStringLiteral("aes256-cfb");
|
||||
list += QStringLiteral("aes256-ofb");
|
||||
list += QStringLiteral("des-ecb");
|
||||
list += QStringLiteral("des-ecb-pkcs7");
|
||||
list += QStringLiteral("des-cbc");
|
||||
list += QStringLiteral("des-cbc-pkcs7");
|
||||
list += QStringLiteral("des-cfb");
|
||||
list += QStringLiteral("des-ofb");
|
||||
list += QStringLiteral("tripledes-ecb");
|
||||
list += QStringLiteral("blowfish-ecb");
|
||||
list += QStringLiteral("blowfish-cbc");
|
||||
list += QStringLiteral("blowfish-cbc-pkcs7");
|
||||
list += QStringLiteral("blowfish-cfb");
|
||||
list += QStringLiteral("blowfish-ofb");
|
||||
|
||||
for (const QString &cipher : qAsConst(list)) {
|
||||
std::string algoName, algoMode, algoPadding;
|
||||
@ -666,13 +666,13 @@ public:
|
||||
{
|
||||
static QStringList list;
|
||||
if (list.isEmpty()) {
|
||||
list += "hmac(md5)";
|
||||
list += "hmac(sha1)";
|
||||
list += QStringLiteral("hmac(md5)");
|
||||
list += QStringLiteral("hmac(sha1)");
|
||||
// HMAC with SHA2 doesn't appear to work correctly in Botan.
|
||||
// list += "hmac(sha256)";
|
||||
// list += "hmac(sha384)";
|
||||
// list += "hmac(sha512)";
|
||||
list += "hmac(ripemd160)";
|
||||
// list += QStringLiteral("hmac(sha256)");
|
||||
// list += QStringLiteral("hmac(sha384)");
|
||||
// list += QStringLiteral("hmac(sha512)");
|
||||
list += QStringLiteral("hmac(ripemd160)");
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@ -681,7 +681,7 @@ public:
|
||||
{
|
||||
static QStringList list;
|
||||
if (list.isEmpty()) {
|
||||
list += "hkdf(sha256)";
|
||||
list += QStringLiteral("hkdf(sha256)");
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@ -690,7 +690,7 @@ public:
|
||||
{
|
||||
static QStringList list;
|
||||
if (list.isEmpty()) {
|
||||
list += "random";
|
||||
list += QStringLiteral("random");
|
||||
list += hmacTypes();
|
||||
list += pbkdfTypes();
|
||||
list += hkdfTypes();
|
||||
@ -702,7 +702,7 @@ public:
|
||||
|
||||
Context *createContext(const QString &type) override
|
||||
{
|
||||
if ( type == "random" )
|
||||
if ( type == QLatin1String("random") )
|
||||
return new botanRandomContext( this );
|
||||
else if ( hashTypes().contains(type) )
|
||||
return new BotanHashContext( this, type );
|
||||
|
@ -271,11 +271,11 @@ private:
|
||||
callbacks = nullptr;
|
||||
}
|
||||
|
||||
localAddr = "";
|
||||
remoteAddr = "";
|
||||
localAddr = QLatin1String("");
|
||||
remoteAddr = QLatin1String("");
|
||||
maxoutbuf = 128;
|
||||
sc_username = "";
|
||||
sc_authzid = "";
|
||||
sc_username = QLatin1String("");
|
||||
sc_authzid = QLatin1String("");
|
||||
|
||||
result_authCondition = SASL::AuthFail;
|
||||
result_haveClientInit = false;
|
||||
@ -292,7 +292,7 @@ private:
|
||||
secflags = 0;
|
||||
ssf_min = 0;
|
||||
ssf_max = 0;
|
||||
ext_authid = "";
|
||||
ext_authid = QLatin1String("");
|
||||
ext_ssf = 0;
|
||||
}
|
||||
|
||||
@ -379,8 +379,9 @@ private:
|
||||
const char *clientout, *m;
|
||||
unsigned int clientoutlen;
|
||||
|
||||
|
||||
need = nullptr;
|
||||
QString list = result_mechlist.join(" ");
|
||||
const QString list = result_mechlist.join(QStringLiteral(" "));
|
||||
int r;
|
||||
while(true) {
|
||||
if(need)
|
||||
@ -603,8 +604,8 @@ public:
|
||||
{
|
||||
service = _service;
|
||||
host = _host;
|
||||
localAddr = local ? addrString(*local) : "";
|
||||
remoteAddr = remote ? addrString(*remote) : "";
|
||||
localAddr = local ? addrString(*local) : QLatin1String("");
|
||||
remoteAddr = remote ? addrString(*remote) : QLatin1String("");
|
||||
ext_authid = ext_id;
|
||||
ext_ssf = _ext_ssf;
|
||||
}
|
||||
@ -677,7 +678,7 @@ public:
|
||||
Q_UNUSED(disableServerSendLast);
|
||||
resetState();
|
||||
|
||||
g->appname = SASL_APP;
|
||||
g->appname = QStringLiteral(SASL_APP);
|
||||
if(!g->server_init) {
|
||||
sasl_server_init(nullptr, QFile::encodeName(g->appname).constData());
|
||||
g->server_init = true;
|
||||
@ -904,7 +905,7 @@ int saslProvider::qcaVersion() const
|
||||
|
||||
QString saslProvider::name() const
|
||||
{
|
||||
return "qca-cyrus-sasl";
|
||||
return QStringLiteral("qca-cyrus-sasl");
|
||||
}
|
||||
|
||||
QString saslProvider::credit() const
|
||||
@ -915,14 +916,14 @@ QString saslProvider::credit() const
|
||||
QStringList saslProvider::features() const
|
||||
{
|
||||
QStringList list;
|
||||
list += "sasl";
|
||||
list += QStringLiteral("sasl");
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
Provider::Context *saslProvider::createContext(const QString &type)
|
||||
{
|
||||
if ( type == "sasl" )
|
||||
if ( type == QLatin1String("sasl") )
|
||||
return new saslContext( this );
|
||||
|
||||
return nullptr;
|
||||
|
@ -31,12 +31,12 @@ namespace gcryptQCAPlugin {
|
||||
|
||||
#include "pkcs5.c"
|
||||
|
||||
void check_error( const QString &label, gcry_error_t err )
|
||||
void check_error( const char *label, gcry_error_t err )
|
||||
{
|
||||
// we ignore the case where it is not an error, and
|
||||
// we also don't flag weak keys.
|
||||
if ( ( GPG_ERR_NO_ERROR != err ) && ( GPG_ERR_WEAK_KEY != gpg_err_code(err) ) ) {
|
||||
std::cout << "Failure (" << qPrintable(label) << "): ";
|
||||
std::cout << "Failure (" << label << "): ";
|
||||
std::cout << gcry_strsource(err) << "/";
|
||||
std::cout << gcry_strerror(err) << std::endl;
|
||||
}
|
||||
@ -538,148 +538,148 @@ public:
|
||||
|
||||
QString name() const override
|
||||
{
|
||||
return "qca-gcrypt";
|
||||
return QStringLiteral("qca-gcrypt");
|
||||
}
|
||||
|
||||
QStringList features() const override
|
||||
{
|
||||
QStringList list;
|
||||
list += "sha1";
|
||||
list += "md4";
|
||||
list += "md5";
|
||||
list += "ripemd160";
|
||||
list += QStringLiteral("sha1");
|
||||
list += QStringLiteral("md4");
|
||||
list += QStringLiteral("md5");
|
||||
list += QStringLiteral("ripemd160");
|
||||
#ifdef GCRY_MD_SHA224
|
||||
list += "sha224";
|
||||
list += QStringLiteral("sha224");
|
||||
#endif
|
||||
list += "sha256";
|
||||
list += "sha384";
|
||||
list += "sha512";
|
||||
list += "hmac(md5)";
|
||||
list += "hmac(sha1)";
|
||||
list += QStringLiteral("sha256");
|
||||
list += QStringLiteral("sha384");
|
||||
list += QStringLiteral("sha512");
|
||||
list += QStringLiteral("hmac(md5)");
|
||||
list += QStringLiteral("hmac(sha1)");
|
||||
#ifdef GCRY_MD_SHA224
|
||||
list += "hmac(sha224)";
|
||||
list += QStringLiteral("hmac(sha224)");
|
||||
#endif
|
||||
list += "hmac(sha256)";
|
||||
list += QStringLiteral("hmac(sha256)");
|
||||
if ( ! ( nullptr == gcry_check_version("1.3.0") ) ) {
|
||||
// 1.2 and earlier have broken implementation
|
||||
list += "hmac(sha384)";
|
||||
list += "hmac(sha512)";
|
||||
list += QStringLiteral("hmac(sha384)");
|
||||
list += QStringLiteral("hmac(sha512)");
|
||||
}
|
||||
list += "hmac(ripemd160)";
|
||||
list += "aes128-ecb";
|
||||
list += "aes128-cfb";
|
||||
list += "aes128-cbc";
|
||||
list += "aes192-ecb";
|
||||
list += "aes192-cfb";
|
||||
list += "aes192-cbc";
|
||||
list += "aes256-ecb";
|
||||
list += "aes256-cfb";
|
||||
list += "aes256-cbc";
|
||||
list += "blowfish-ecb";
|
||||
list += "blowfish-cbc";
|
||||
list += "blowfish-cfb";
|
||||
list += "tripledes-ecb";
|
||||
// list += "des-ecb";
|
||||
list += "des-cbc";
|
||||
list += "des-cfb";
|
||||
list += QStringLiteral("hmac(ripemd160)");
|
||||
list += QStringLiteral("aes128-ecb");
|
||||
list += QStringLiteral("aes128-cfb");
|
||||
list += QStringLiteral("aes128-cbc");
|
||||
list += QStringLiteral("aes192-ecb");
|
||||
list += QStringLiteral("aes192-cfb");
|
||||
list += QStringLiteral("aes192-cbc");
|
||||
list += QStringLiteral("aes256-ecb");
|
||||
list += QStringLiteral("aes256-cfb");
|
||||
list += QStringLiteral("aes256-cbc");
|
||||
list += QStringLiteral("blowfish-ecb");
|
||||
list += QStringLiteral("blowfish-cbc");
|
||||
list += QStringLiteral("blowfish-cfb");
|
||||
list += QStringLiteral("tripledes-ecb");
|
||||
// list += QStringLiteral("des-ecb");
|
||||
list += QStringLiteral("des-cbc");
|
||||
list += QStringLiteral("des-cfb");
|
||||
if ( ! ( nullptr == gcry_check_version("1.3.0") ) ) {
|
||||
// 1.2 branch and earlier doesn't support OFB mode
|
||||
list += "aes128-ofb";
|
||||
list += "aes192-ofb";
|
||||
list += "aes256-ofb";
|
||||
list += "des-ofb";
|
||||
list += "tripledes-ofb";
|
||||
list += "blowfish-ofb";
|
||||
list += QStringLiteral("aes128-ofb");
|
||||
list += QStringLiteral("aes192-ofb");
|
||||
list += QStringLiteral("aes256-ofb");
|
||||
list += QStringLiteral("des-ofb");
|
||||
list += QStringLiteral("tripledes-ofb");
|
||||
list += QStringLiteral("blowfish-ofb");
|
||||
}
|
||||
list += "pbkdf1(sha1)";
|
||||
list += "pbkdf2(sha1)";
|
||||
list += QStringLiteral("pbkdf1(sha1)");
|
||||
list += QStringLiteral("pbkdf2(sha1)");
|
||||
return list;
|
||||
}
|
||||
|
||||
Context *createContext(const QString &type) override
|
||||
{
|
||||
// std::cout << "type: " << qPrintable(type) << std::endl;
|
||||
if ( type == "sha1" )
|
||||
if ( type == QLatin1String("sha1") )
|
||||
return new gcryptQCAPlugin::gcryHashContext( GCRY_MD_SHA1, this, type );
|
||||
else if ( type == "md4" )
|
||||
else if ( type == QLatin1String("md4") )
|
||||
return new gcryptQCAPlugin::gcryHashContext( GCRY_MD_MD4, this, type );
|
||||
else if ( type == "md5" )
|
||||
else if ( type == QLatin1String("md5") )
|
||||
return new gcryptQCAPlugin::gcryHashContext( GCRY_MD_MD5, this, type );
|
||||
else if ( type == "ripemd160" )
|
||||
else if ( type == QLatin1String("ripemd160") )
|
||||
return new gcryptQCAPlugin::gcryHashContext( GCRY_MD_RMD160, this, type );
|
||||
#ifdef GCRY_MD_SHA224
|
||||
else if ( type == "sha224" )
|
||||
else if ( type == QLatin1String("sha224") )
|
||||
return new gcryptQCAPlugin::gcryHashContext( GCRY_MD_SHA224, this, type );
|
||||
#endif
|
||||
else if ( type == "sha256" )
|
||||
else if ( type == QLatin1String("sha256") )
|
||||
return new gcryptQCAPlugin::gcryHashContext( GCRY_MD_SHA256, this, type );
|
||||
else if ( type == "sha384" )
|
||||
else if ( type == QLatin1String("sha384") )
|
||||
return new gcryptQCAPlugin::gcryHashContext( GCRY_MD_SHA384, this, type );
|
||||
else if ( type == "sha512" )
|
||||
else if ( type == QLatin1String("sha512") )
|
||||
return new gcryptQCAPlugin::gcryHashContext( GCRY_MD_SHA512, this, type );
|
||||
else if ( type == "hmac(md5)" )
|
||||
else if ( type == QLatin1String("hmac(md5)") )
|
||||
return new gcryptQCAPlugin::gcryHMACContext( GCRY_MD_MD5, this, type );
|
||||
else if ( type == "hmac(sha1)" )
|
||||
else if ( type == QLatin1String("hmac(sha1)") )
|
||||
return new gcryptQCAPlugin::gcryHMACContext( GCRY_MD_SHA1, this, type );
|
||||
#ifdef GCRY_MD_SHA224
|
||||
else if ( type == "hmac(sha224)" )
|
||||
else if ( type == QLatin1String("hmac(sha224)") )
|
||||
return new gcryptQCAPlugin::gcryHMACContext( GCRY_MD_SHA224, this, type );
|
||||
#endif
|
||||
else if ( type == "hmac(sha256)" )
|
||||
else if ( type == QLatin1String("hmac(sha256)") )
|
||||
return new gcryptQCAPlugin::gcryHMACContext( GCRY_MD_SHA256, this, type );
|
||||
else if ( type == "hmac(sha384)" )
|
||||
else if ( type == QLatin1String("hmac(sha384)") )
|
||||
return new gcryptQCAPlugin::gcryHMACContext( GCRY_MD_SHA384, this, type );
|
||||
else if ( type == "hmac(sha512)" )
|
||||
else if ( type == QLatin1String("hmac(sha512)") )
|
||||
return new gcryptQCAPlugin::gcryHMACContext( GCRY_MD_SHA512, this, type );
|
||||
else if ( type == "hmac(ripemd160)" )
|
||||
else if ( type == QLatin1String("hmac(ripemd160)") )
|
||||
return new gcryptQCAPlugin::gcryHMACContext( GCRY_MD_RMD160, this, type );
|
||||
else if ( type == "aes128-ecb" )
|
||||
else if ( type == QLatin1String("aes128-ecb") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_ECB, false, this, type );
|
||||
else if ( type == "aes128-cfb" )
|
||||
else if ( type == QLatin1String("aes128-cfb") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_CFB, false, this, type );
|
||||
else if ( type == "aes128-ofb" )
|
||||
else if ( type == QLatin1String("aes128-ofb") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_OFB, false, this, type );
|
||||
else if ( type == "aes128-cbc" )
|
||||
else if ( type == QLatin1String("aes128-cbc") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_AES128, GCRY_CIPHER_MODE_CBC, false, this, type );
|
||||
else if ( type == "aes192-ecb" )
|
||||
else if ( type == QLatin1String("aes192-ecb") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_AES192, GCRY_CIPHER_MODE_ECB, false, this, type );
|
||||
else if ( type == "aes192-cfb" )
|
||||
else if ( type == QLatin1String("aes192-cfb") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_AES192, GCRY_CIPHER_MODE_CFB, false, this, type );
|
||||
else if ( type == "aes192-ofb" )
|
||||
else if ( type == QLatin1String("aes192-ofb") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_AES192, GCRY_CIPHER_MODE_OFB, false, this, type );
|
||||
else if ( type == "aes192-cbc" )
|
||||
else if ( type == QLatin1String("aes192-cbc") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_AES192, GCRY_CIPHER_MODE_CBC, false, this, type );
|
||||
else if ( type == "aes256-ecb" )
|
||||
else if ( type == QLatin1String("aes256-ecb") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_ECB, false, this, type );
|
||||
else if ( type == "aes256-cfb" )
|
||||
else if ( type == QLatin1String("aes256-cfb") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_CFB, false, this, type );
|
||||
else if ( type == "aes256-ofb" )
|
||||
else if ( type == QLatin1String("aes256-ofb") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_OFB, false, this, type );
|
||||
else if ( type == "aes256-cbc" )
|
||||
else if ( type == QLatin1String("aes256-cbc") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_CBC, false, this, type );
|
||||
else if ( type == "blowfish-ecb" )
|
||||
else if ( type == QLatin1String("blowfish-ecb") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_BLOWFISH, GCRY_CIPHER_MODE_ECB, false, this, type );
|
||||
else if ( type == "blowfish-cbc" )
|
||||
else if ( type == QLatin1String("blowfish-cbc") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_BLOWFISH, GCRY_CIPHER_MODE_CBC, false, this, type );
|
||||
else if ( type == "blowfish-cfb" )
|
||||
else if ( type == QLatin1String("blowfish-cfb") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_BLOWFISH, GCRY_CIPHER_MODE_CFB, false, this, type );
|
||||
else if ( type == "blowfish-ofb" )
|
||||
else if ( type == QLatin1String("blowfish-ofb") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_BLOWFISH, GCRY_CIPHER_MODE_OFB, false, this, type );
|
||||
else if ( type == "tripledes-ecb" )
|
||||
else if ( type == QLatin1String("tripledes-ecb") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_3DES, GCRY_CIPHER_MODE_ECB, false, this, type );
|
||||
else if ( type == "tripledes-ofb" )
|
||||
else if ( type == QLatin1String("tripledes-ofb") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_3DES, GCRY_CIPHER_MODE_OFB, false, this, type );
|
||||
else if ( type == "des-ecb" )
|
||||
else if ( type == QLatin1String("des-ecb") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_DES, GCRY_CIPHER_MODE_ECB, false, this, type );
|
||||
else if ( type == "des-cbc" )
|
||||
else if ( type == QLatin1String("des-cbc") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_DES, GCRY_CIPHER_MODE_CBC, false, this, type );
|
||||
else if ( type == "des-cfb" )
|
||||
else if ( type == QLatin1String("des-cfb") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_DES, GCRY_CIPHER_MODE_CFB, false, this, type );
|
||||
else if ( type == "des-ofb" )
|
||||
else if ( type == QLatin1String("des-ofb") )
|
||||
return new gcryptQCAPlugin::gcryCipherContext( GCRY_CIPHER_DES, GCRY_CIPHER_MODE_OFB, false, this, type );
|
||||
else if ( type == "pbkdf1(sha1)" )
|
||||
else if ( type == QLatin1String("pbkdf1(sha1)") )
|
||||
return new gcryptQCAPlugin::pbkdf1Context( GCRY_MD_SHA1, this, type );
|
||||
else if ( type == "pbkdf2(sha1)" )
|
||||
else if ( type == QLatin1String("pbkdf2(sha1)") )
|
||||
return new gcryptQCAPlugin::pbkdf2Context( GCRY_MD_SHA1, this, type );
|
||||
else
|
||||
return nullptr;
|
||||
|
@ -127,22 +127,22 @@ static bool stringToKeyList(const QString &outstr, GpgOp::KeyList *_keylist, QSt
|
||||
bool primary = false; // primary key or sub key
|
||||
// bool sec = false; // private key or not
|
||||
|
||||
if(type == "pub")
|
||||
if(type == QLatin1String("pub"))
|
||||
{
|
||||
key = true;
|
||||
primary = true;
|
||||
}
|
||||
else if(type == "sec")
|
||||
else if(type == QLatin1String("sec"))
|
||||
{
|
||||
key = true;
|
||||
primary = true;
|
||||
// sec = true;
|
||||
}
|
||||
else if(type == "sub")
|
||||
else if(type == QLatin1String("sub"))
|
||||
{
|
||||
key = true;
|
||||
}
|
||||
else if(type == "ssb")
|
||||
else if(type == QLatin1String("ssb"))
|
||||
{
|
||||
key = true;
|
||||
// sec = true;
|
||||
@ -155,7 +155,7 @@ static bool stringToKeyList(const QString &outstr, GpgOp::KeyList *_keylist, QSt
|
||||
keyList += GpgOp::Key();
|
||||
|
||||
QString trust = f[1];
|
||||
if(trust == "f" || trust == "u")
|
||||
if(trust == QLatin1String("f") || trust == QLatin1String("u"))
|
||||
keyList.last().isTrusted = true;
|
||||
}
|
||||
|
||||
@ -186,12 +186,12 @@ static bool stringToKeyList(const QString &outstr, GpgOp::KeyList *_keylist, QSt
|
||||
|
||||
keyList.last().keyItems += item;
|
||||
}
|
||||
else if(type == "uid")
|
||||
else if(type == QLatin1String("uid"))
|
||||
{
|
||||
QByteArray uid = getCString(f[9].toUtf8());
|
||||
keyList.last().userIds.append(QString::fromUtf8(uid));
|
||||
}
|
||||
else if(type == "fpr")
|
||||
else if(type == QLatin1String("fpr"))
|
||||
{
|
||||
QString s = f[9];
|
||||
keyList.last().keyItems.last().fingerprint = s;
|
||||
@ -276,20 +276,20 @@ void GpgAction::start()
|
||||
bool extra = false;
|
||||
|
||||
if(input.opt_ascii)
|
||||
args += "--armor";
|
||||
args += QStringLiteral("--armor");
|
||||
|
||||
if(input.opt_noagent)
|
||||
args += "--no-use-agent";
|
||||
args += QStringLiteral("--no-use-agent");
|
||||
|
||||
if(input.opt_alwaystrust)
|
||||
args += "--always-trust";
|
||||
args += QStringLiteral("--always-trust");
|
||||
|
||||
if(!input.opt_pubfile.isEmpty() && !input.opt_secfile.isEmpty())
|
||||
{
|
||||
args += "--no-default-keyring";
|
||||
args += "--keyring";
|
||||
args += QStringLiteral("--no-default-keyring");
|
||||
args += QStringLiteral("--keyring");
|
||||
args += input.opt_pubfile;
|
||||
args += "--secret-keyring";
|
||||
args += QStringLiteral("--secret-keyring");
|
||||
args += input.opt_secfile;
|
||||
}
|
||||
|
||||
@ -297,59 +297,59 @@ void GpgAction::start()
|
||||
{
|
||||
case GpgOp::Check:
|
||||
{
|
||||
args += "--version";
|
||||
args += QStringLiteral("--version");
|
||||
readText = true;
|
||||
break;
|
||||
}
|
||||
case GpgOp::SecretKeyringFile:
|
||||
{
|
||||
#ifndef Q_OS_WIN
|
||||
args += "--display-charset=utf-8";
|
||||
args += QStringLiteral("--display-charset=utf-8");
|
||||
#endif
|
||||
args += "--list-secret-keys";
|
||||
args += QStringLiteral("--list-secret-keys");
|
||||
readText = true;
|
||||
break;
|
||||
}
|
||||
case GpgOp::PublicKeyringFile:
|
||||
{
|
||||
#ifndef Q_OS_WIN
|
||||
args += "--display-charset=utf-8";
|
||||
args += QStringLiteral("--display-charset=utf-8");
|
||||
#endif
|
||||
args += "--list-public-keys";
|
||||
args += QStringLiteral("--list-public-keys");
|
||||
readText = true;
|
||||
break;
|
||||
}
|
||||
case GpgOp::SecretKeys:
|
||||
{
|
||||
args += "--fixed-list-mode";
|
||||
args += "--with-colons";
|
||||
args += "--with-fingerprint";
|
||||
args += "--with-fingerprint";
|
||||
args += "--list-secret-keys";
|
||||
args += QStringLiteral("--fixed-list-mode");
|
||||
args += QStringLiteral("--with-colons");
|
||||
args += QStringLiteral("--with-fingerprint");
|
||||
args += QStringLiteral("--with-fingerprint");
|
||||
args += QStringLiteral("--list-secret-keys");
|
||||
utf8Output = true;
|
||||
readText = true;
|
||||
break;
|
||||
}
|
||||
case GpgOp::PublicKeys:
|
||||
{
|
||||
args += "--fixed-list-mode";
|
||||
args += "--with-colons";
|
||||
args += "--with-fingerprint";
|
||||
args += "--with-fingerprint";
|
||||
args += "--list-public-keys";
|
||||
args += QStringLiteral("--fixed-list-mode");
|
||||
args += QStringLiteral("--with-colons");
|
||||
args += QStringLiteral("--with-fingerprint");
|
||||
args += QStringLiteral("--with-fingerprint");
|
||||
args += QStringLiteral("--list-public-keys");
|
||||
utf8Output = true;
|
||||
readText = true;
|
||||
break;
|
||||
}
|
||||
case GpgOp::Encrypt:
|
||||
{
|
||||
args += "--encrypt";
|
||||
args += QStringLiteral("--encrypt");
|
||||
|
||||
// recipients
|
||||
for(QStringList::ConstIterator it = input.recip_ids.constBegin(); it != input.recip_ids.constEnd(); ++it)
|
||||
{
|
||||
args += "--recipient";
|
||||
args += QString("0x") + *it;
|
||||
args += QStringLiteral("--recipient");
|
||||
args += QStringLiteral("0x") + *it;
|
||||
}
|
||||
extra = true;
|
||||
collectOutput = false;
|
||||
@ -360,7 +360,7 @@ void GpgAction::start()
|
||||
}
|
||||
case GpgOp::Decrypt:
|
||||
{
|
||||
args += "--decrypt";
|
||||
args += QStringLiteral("--decrypt");
|
||||
extra = true;
|
||||
collectOutput = false;
|
||||
allowInput = true;
|
||||
@ -370,9 +370,9 @@ void GpgAction::start()
|
||||
}
|
||||
case GpgOp::Sign:
|
||||
{
|
||||
args += "--default-key";
|
||||
args += QString("0x") + input.signer_id;
|
||||
args += "--sign";
|
||||
args += QStringLiteral("--default-key");
|
||||
args += QStringLiteral("0x") + input.signer_id;
|
||||
args += QStringLiteral("--sign");
|
||||
extra = true;
|
||||
collectOutput = false;
|
||||
allowInput = true;
|
||||
@ -383,16 +383,16 @@ void GpgAction::start()
|
||||
}
|
||||
case GpgOp::SignAndEncrypt:
|
||||
{
|
||||
args += "--default-key";
|
||||
args += QString("0x") + input.signer_id;
|
||||
args += "--sign";
|
||||
args += "--encrypt";
|
||||
args += QStringLiteral("--default-key");
|
||||
args += QStringLiteral("0x") + input.signer_id;
|
||||
args += QStringLiteral("--sign");
|
||||
args += QStringLiteral("--encrypt");
|
||||
|
||||
// recipients
|
||||
for(QStringList::ConstIterator it = input.recip_ids.constBegin(); it != input.recip_ids.constEnd(); ++it)
|
||||
{
|
||||
args += "--recipient";
|
||||
args += QString("0x") + *it;
|
||||
args += QStringLiteral("--recipient");
|
||||
args += QStringLiteral("0x") + *it;
|
||||
}
|
||||
extra = true;
|
||||
collectOutput = false;
|
||||
@ -404,9 +404,9 @@ void GpgAction::start()
|
||||
}
|
||||
case GpgOp::SignClearsign:
|
||||
{
|
||||
args += "--default-key";
|
||||
args += QString("0x") + input.signer_id;
|
||||
args += "--clearsign";
|
||||
args += QStringLiteral("--default-key");
|
||||
args += QStringLiteral("0x") + input.signer_id;
|
||||
args += QStringLiteral("--clearsign");
|
||||
extra = true;
|
||||
collectOutput = false;
|
||||
allowInput = true;
|
||||
@ -417,9 +417,9 @@ void GpgAction::start()
|
||||
}
|
||||
case GpgOp::SignDetached:
|
||||
{
|
||||
args += "--default-key";
|
||||
args += QString("0x") + input.signer_id;
|
||||
args += "--detach-sign";
|
||||
args += QStringLiteral("--default-key");
|
||||
args += QStringLiteral("0x") + input.signer_id;
|
||||
args += QStringLiteral("--detach-sign");
|
||||
extra = true;
|
||||
collectOutput = false;
|
||||
allowInput = true;
|
||||
@ -430,8 +430,8 @@ void GpgAction::start()
|
||||
}
|
||||
case GpgOp::Verify:
|
||||
{
|
||||
args += "--verify";
|
||||
args += "-"; //krazy:exclude=doublequote_chars
|
||||
args += QStringLiteral("--verify");
|
||||
args += QStringLiteral("-"); //krazy:exclude=doublequote_chars
|
||||
extra = true;
|
||||
allowInput = true;
|
||||
if(input.opt_ascii)
|
||||
@ -440,9 +440,9 @@ void GpgAction::start()
|
||||
}
|
||||
case GpgOp::VerifyDetached:
|
||||
{
|
||||
args += "--verify";
|
||||
args += "-"; //krazy:exclude=doublequote_chars
|
||||
args += "-&?";
|
||||
args += QStringLiteral("--verify");
|
||||
args += QStringLiteral("-"); //krazy:exclude=doublequote_chars
|
||||
args += QStringLiteral("-&?");
|
||||
extra = true;
|
||||
allowInput = true;
|
||||
useAux = true;
|
||||
@ -450,7 +450,7 @@ void GpgAction::start()
|
||||
}
|
||||
case GpgOp::Import:
|
||||
{
|
||||
args += "--import";
|
||||
args += QStringLiteral("--import");
|
||||
readText = true;
|
||||
if(input.opt_ascii)
|
||||
writeText = true;
|
||||
@ -458,8 +458,8 @@ void GpgAction::start()
|
||||
}
|
||||
case GpgOp::Export:
|
||||
{
|
||||
args += "--export";
|
||||
args += QString("0x") + input.export_key_id;
|
||||
args += QStringLiteral("--export");
|
||||
args += QStringLiteral("0x") + input.export_key_id;
|
||||
collectOutput = false;
|
||||
if(input.opt_ascii)
|
||||
readText = true;
|
||||
@ -467,9 +467,9 @@ void GpgAction::start()
|
||||
}
|
||||
case GpgOp::DeleteKey:
|
||||
{
|
||||
args += "--batch";
|
||||
args += "--delete-key";
|
||||
args += QString("0x") + input.delete_key_fingerprint;
|
||||
args += QStringLiteral("--batch");
|
||||
args += QStringLiteral("--delete-key");
|
||||
args += QStringLiteral("0x") + input.delete_key_fingerprint;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -631,30 +631,30 @@ void GpgAction::processStatusLine(const QString &line)
|
||||
QString s, rest;
|
||||
s = nextArg(line, &rest);
|
||||
|
||||
if(s == "NODATA")
|
||||
if(s == QLatin1String("NODATA"))
|
||||
{
|
||||
// only set this if it'll make it better
|
||||
if(curError == GpgOp::ErrorUnknown)
|
||||
curError = GpgOp::ErrorFormat;
|
||||
}
|
||||
else if(s == "UNEXPECTED")
|
||||
else if(s == QLatin1String("UNEXPECTED"))
|
||||
{
|
||||
if(curError == GpgOp::ErrorUnknown)
|
||||
curError = GpgOp::ErrorFormat;
|
||||
}
|
||||
else if(s == "EXPKEYSIG")
|
||||
else if(s == QLatin1String("EXPKEYSIG"))
|
||||
{
|
||||
curError = GpgOp::ErrorSignerExpired;
|
||||
}
|
||||
else if(s == "REVKEYSIG")
|
||||
else if(s == QLatin1String("REVKEYSIG"))
|
||||
{
|
||||
curError = GpgOp::ErrorSignerRevoked;
|
||||
}
|
||||
else if(s == "EXPSIG")
|
||||
else if(s == QLatin1String("EXPSIG"))
|
||||
{
|
||||
curError = GpgOp::ErrorSignatureExpired;
|
||||
}
|
||||
else if(s == "INV_RECP")
|
||||
else if(s == QLatin1String("INV_RECP"))
|
||||
{
|
||||
int r = nextArg(rest).toInt();
|
||||
|
||||
@ -675,14 +675,14 @@ void GpgAction::processStatusLine(const QString &line)
|
||||
curError = GpgOp::ErrorEncryptInvalid;
|
||||
}
|
||||
}
|
||||
else if(s == "NO_SECKEY")
|
||||
else if(s == QLatin1String("NO_SECKEY"))
|
||||
{
|
||||
output.encryptedToId = nextArg(rest);
|
||||
|
||||
if(curError == GpgOp::ErrorUnknown)
|
||||
curError = GpgOp::ErrorDecryptNoKey;
|
||||
}
|
||||
else if(s == "DECRYPTION_OKAY")
|
||||
else if(s == QLatin1String("DECRYPTION_OKAY"))
|
||||
{
|
||||
decryptGood = true;
|
||||
|
||||
@ -690,18 +690,18 @@ void GpgAction::processStatusLine(const QString &line)
|
||||
if(curError == GpgOp::ErrorDecryptNoKey)
|
||||
curError = GpgOp::ErrorUnknown;
|
||||
}
|
||||
else if(s == "SIG_CREATED")
|
||||
else if(s == QLatin1String("SIG_CREATED"))
|
||||
{
|
||||
signGood = true;
|
||||
}
|
||||
else if(s == "USERID_HINT")
|
||||
else if(s == QLatin1String("USERID_HINT"))
|
||||
{
|
||||
passphraseKeyId = nextArg(rest);
|
||||
}
|
||||
else if(s == "GET_HIDDEN")
|
||||
else if(s == QLatin1String("GET_HIDDEN"))
|
||||
{
|
||||
QString arg = nextArg(rest);
|
||||
if(arg == "passphrase.enter" || arg == "passphrase.pin.ask")
|
||||
if(arg == QLatin1String("passphrase.enter") || arg == QLatin1String("passphrase.pin.ask"))
|
||||
{
|
||||
need_submitPassphrase = true;
|
||||
|
||||
@ -709,43 +709,43 @@ void GpgAction::processStatusLine(const QString &line)
|
||||
QMetaObject::invokeMethod(this, "needPassphrase", Qt::QueuedConnection, Q_ARG(QString, passphraseKeyId));
|
||||
}
|
||||
}
|
||||
else if(s == "GET_LINE")
|
||||
else if(s == QLatin1String("GET_LINE"))
|
||||
{
|
||||
QString arg = nextArg(rest);
|
||||
if(arg == "cardctrl.insert_card.okay")
|
||||
if(arg == QLatin1String("cardctrl.insert_card.okay"))
|
||||
{
|
||||
need_cardOkay = true;
|
||||
|
||||
QMetaObject::invokeMethod(this, "needCard", Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
else if(s == "GET_BOOL")
|
||||
else if(s == QLatin1String("GET_BOOL"))
|
||||
{
|
||||
QString arg = nextArg(rest);
|
||||
if(arg == "untrusted_key.override")
|
||||
if(arg == QLatin1String("untrusted_key.override"))
|
||||
submitCommand("no\n");
|
||||
}
|
||||
else if(s == "GOOD_PASSPHRASE")
|
||||
else if(s == QLatin1String("GOOD_PASSPHRASE"))
|
||||
{
|
||||
badPassphrase = false;
|
||||
}
|
||||
else if(s == "BAD_PASSPHRASE")
|
||||
else if(s == QLatin1String("BAD_PASSPHRASE"))
|
||||
{
|
||||
badPassphrase = true;
|
||||
}
|
||||
else if(s == "GOODSIG")
|
||||
else if(s == QLatin1String("GOODSIG"))
|
||||
{
|
||||
output.wasSigned = true;
|
||||
output.signerId = nextArg(rest);
|
||||
output.verifyResult = GpgOp::VerifyGood;
|
||||
}
|
||||
else if(s == "BADSIG")
|
||||
else if(s == QLatin1String("BADSIG"))
|
||||
{
|
||||
output.wasSigned = true;
|
||||
output.signerId = nextArg(rest);
|
||||
output.verifyResult = GpgOp::VerifyBad;
|
||||
}
|
||||
else if(s == "ERRSIG")
|
||||
else if(s == QLatin1String("ERRSIG"))
|
||||
{
|
||||
output.wasSigned = true;
|
||||
QStringList list = rest.split(' ', QString::SkipEmptyParts);
|
||||
@ -753,7 +753,7 @@ void GpgAction::processStatusLine(const QString &line)
|
||||
output.timestamp = getTimestamp(list[4]);
|
||||
output.verifyResult = GpgOp::VerifyNoKey;
|
||||
}
|
||||
else if(s == "VALIDSIG")
|
||||
else if(s == QLatin1String("VALIDSIG"))
|
||||
{
|
||||
QStringList list = rest.split(' ', QString::SkipEmptyParts);
|
||||
output.timestamp = getTimestamp(list[2]);
|
||||
@ -787,8 +787,8 @@ void GpgAction::processResult(int code)
|
||||
#endif
|
||||
|
||||
if(collectOutput)
|
||||
appendDiagnosticText(QString("stdout: [%1]").arg(outstr));
|
||||
appendDiagnosticText(QString("stderr: [%1]").arg(errstr));
|
||||
appendDiagnosticText(QStringLiteral("stdout: [%1]").arg(outstr));
|
||||
appendDiagnosticText(QStringLiteral("stderr: [%1]").arg(errstr));
|
||||
ensureDTextEmit();
|
||||
|
||||
if(badPassphrase)
|
||||
@ -803,10 +803,10 @@ void GpgAction::processResult(int code)
|
||||
{
|
||||
if(input.op == GpgOp::Check)
|
||||
{
|
||||
QStringList strList = outstr.split("\n");
|
||||
QStringList strList = outstr.split(QStringLiteral("\n"));
|
||||
foreach (const QString &str, strList)
|
||||
{
|
||||
if (!str.startsWith("Home: "))
|
||||
if (!str.startsWith(QLatin1String("Home: ")))
|
||||
continue;
|
||||
|
||||
output.homeDir = str.section(' ', 1);
|
||||
@ -868,13 +868,13 @@ void GpgAction::proc_error(gpgQCAPlugin::GPGProc::Error e)
|
||||
{
|
||||
QString str;
|
||||
if(e == GPGProc::FailedToStart)
|
||||
str = "FailedToStart";
|
||||
str = QStringLiteral("FailedToStart");
|
||||
else if(e == GPGProc::UnexpectedExit)
|
||||
str = "UnexpectedExit";
|
||||
str = QStringLiteral("UnexpectedExit");
|
||||
else if(e == GPGProc::ErrorWrite)
|
||||
str = "ErrorWrite";
|
||||
str = QStringLiteral("ErrorWrite");
|
||||
|
||||
appendDiagnosticText(QString("GPG Process Error: %1").arg(str));
|
||||
appendDiagnosticText(QStringLiteral("GPG Process Error: %1").arg(str));
|
||||
ensureDTextEmit();
|
||||
|
||||
output.errorCode = GpgOp::ErrorProcess;
|
||||
@ -883,7 +883,7 @@ void GpgAction::proc_error(gpgQCAPlugin::GPGProc::Error e)
|
||||
|
||||
void GpgAction::proc_finished(int exitCode)
|
||||
{
|
||||
appendDiagnosticText(QString("GPG Process Finished: exitStatus=%1").arg(exitCode));
|
||||
appendDiagnosticText(QStringLiteral("GPG Process Finished: exitStatus=%1").arg(exitCode));
|
||||
ensureDTextEmit();
|
||||
|
||||
processResult(exitCode);
|
||||
|
@ -179,30 +179,30 @@ void GpgOp::Private::act_finished()
|
||||
output = act->output;
|
||||
|
||||
QMap<int, QString> errmap;
|
||||
errmap[GpgOp::ErrorProcess] = "ErrorProcess";
|
||||
errmap[GpgOp::ErrorPassphrase] = "ErrorPassphrase";
|
||||
errmap[GpgOp::ErrorFormat] = "ErrorFormat";
|
||||
errmap[GpgOp::ErrorSignerExpired] = "ErrorSignerExpired";
|
||||
errmap[GpgOp::ErrorEncryptExpired] = "ErrorEncryptExpired";
|
||||
errmap[GpgOp::ErrorEncryptUntrusted] = "ErrorEncryptUntrusted";
|
||||
errmap[GpgOp::ErrorEncryptInvalid] = "ErrorEncryptInvalid";
|
||||
errmap[GpgOp::ErrorDecryptNoKey] = "ErrorDecryptNoKey";
|
||||
errmap[GpgOp::ErrorUnknown] = "ErrorUnknown";
|
||||
errmap[GpgOp::ErrorProcess] = QStringLiteral("ErrorProcess");
|
||||
errmap[GpgOp::ErrorPassphrase] = QStringLiteral("ErrorPassphrase");
|
||||
errmap[GpgOp::ErrorFormat] = QStringLiteral("ErrorFormat");
|
||||
errmap[GpgOp::ErrorSignerExpired] = QStringLiteral("ErrorSignerExpired");
|
||||
errmap[GpgOp::ErrorEncryptExpired] = QStringLiteral("ErrorEncryptExpired");
|
||||
errmap[GpgOp::ErrorEncryptUntrusted] = QStringLiteral("ErrorEncryptUntrusted");
|
||||
errmap[GpgOp::ErrorEncryptInvalid] = QStringLiteral("ErrorEncryptInvalid");
|
||||
errmap[GpgOp::ErrorDecryptNoKey] = QStringLiteral("ErrorDecryptNoKey");
|
||||
errmap[GpgOp::ErrorUnknown] = QStringLiteral("ErrorUnknown");
|
||||
if(output.success)
|
||||
diagnosticText += "GpgAction success\n";
|
||||
diagnosticText += QStringLiteral("GpgAction success\n");
|
||||
else
|
||||
diagnosticText += QString("GpgAction error: %1\n").arg(errmap[output.errorCode]);
|
||||
diagnosticText += QStringLiteral("GpgAction error: %1\n").arg(errmap[output.errorCode]);
|
||||
|
||||
if(output.wasSigned)
|
||||
{
|
||||
QString s;
|
||||
const char *s;
|
||||
if(output.verifyResult == GpgOp::VerifyGood)
|
||||
s = "VerifyGood";
|
||||
else if(output.verifyResult == GpgOp::VerifyBad)
|
||||
s = "VerifyBad";
|
||||
else
|
||||
s = "VerifyNoKey";
|
||||
diagnosticText += QString("wasSigned: verifyResult: %1\n").arg(s);
|
||||
diagnosticText += QStringLiteral("wasSigned: verifyResult: %1\n").arg(s);
|
||||
}
|
||||
|
||||
//printf("diagnosticText:\n%s", qPrintable(diagnosticText));
|
||||
|
@ -143,7 +143,7 @@ bool GPGProc::Private::setupPipes(bool makeAux)
|
||||
if(makeAux && !pipeAux.create())
|
||||
{
|
||||
closePipes();
|
||||
emit q->debug("Error creating pipeAux");
|
||||
emit q->debug(QStringLiteral("Error creating pipeAux"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -154,14 +154,14 @@ bool GPGProc::Private::setupPipes(bool makeAux)
|
||||
#endif
|
||||
{
|
||||
closePipes();
|
||||
emit q->debug("Error creating pipeCommand");
|
||||
emit q->debug(QStringLiteral("Error creating pipeCommand"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!pipeStatus.create())
|
||||
{
|
||||
closePipes();
|
||||
emit q->debug("Error creating pipeStatus");
|
||||
emit q->debug(QStringLiteral("Error creating pipeStatus"));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -171,32 +171,32 @@ bool GPGProc::Private::setupPipes(bool makeAux)
|
||||
void GPGProc::Private::setupArguments()
|
||||
{
|
||||
QStringList fullargs;
|
||||
fullargs += "--no-tty";
|
||||
fullargs += "--pinentry-mode";
|
||||
fullargs += "loopback";
|
||||
fullargs += QStringLiteral("--no-tty");
|
||||
fullargs += QStringLiteral("--pinentry-mode");
|
||||
fullargs += QStringLiteral("loopback");
|
||||
|
||||
if(mode == ExtendedMode)
|
||||
{
|
||||
fullargs += "--enable-special-filenames";
|
||||
fullargs += QStringLiteral("--enable-special-filenames");
|
||||
|
||||
fullargs += "--status-fd";
|
||||
fullargs += QStringLiteral("--status-fd");
|
||||
fullargs += QString::number(pipeStatus.writeEnd().idAsInt());
|
||||
|
||||
fullargs += "--command-fd";
|
||||
fullargs += QStringLiteral("--command-fd");
|
||||
fullargs += QString::number(pipeCommand.readEnd().idAsInt());
|
||||
}
|
||||
|
||||
for(int n = 0; n < args.count(); ++n)
|
||||
{
|
||||
QString a = args[n];
|
||||
if(mode == ExtendedMode && a == "-&?")
|
||||
fullargs += QString("-&") + QString::number(pipeAux.readEnd().idAsInt());
|
||||
if(mode == ExtendedMode && a == QLatin1String("-&?"))
|
||||
fullargs += QStringLiteral("-&") + QString::number(pipeAux.readEnd().idAsInt());
|
||||
else
|
||||
fullargs += a;
|
||||
}
|
||||
|
||||
QString fullcmd = fullargs.join(" ");
|
||||
emit q->debug(QString("Running: [") + bin + ' ' + fullcmd + ']');
|
||||
QString fullcmd = fullargs.join(QStringLiteral(" "));
|
||||
emit q->debug(QStringLiteral("Running: [") + bin + ' ' + fullcmd + ']');
|
||||
|
||||
args = fullargs;
|
||||
}
|
||||
@ -230,7 +230,7 @@ void GPGProc::Private::aux_written(int x)
|
||||
|
||||
void GPGProc::Private::aux_error(QCA::QPipeEnd::Error)
|
||||
{
|
||||
emit q->debug("Aux: Pipe error");
|
||||
emit q->debug(QStringLiteral("Aux: Pipe error"));
|
||||
reset(ResetSession);
|
||||
emit q->error(GPGProc::ErrorWrite);
|
||||
}
|
||||
@ -242,7 +242,7 @@ void GPGProc::Private::command_written(int x)
|
||||
|
||||
void GPGProc::Private::command_error(QCA::QPipeEnd::Error)
|
||||
{
|
||||
emit q->debug("Command: Pipe error");
|
||||
emit q->debug(QStringLiteral("Command: Pipe error"));
|
||||
reset(ResetSession);
|
||||
emit q->error(GPGProc::ErrorWrite);
|
||||
}
|
||||
@ -256,9 +256,9 @@ void GPGProc::Private::status_read()
|
||||
void GPGProc::Private::status_error(QCA::QPipeEnd::Error e)
|
||||
{
|
||||
if(e == QPipeEnd::ErrorEOF)
|
||||
emit q->debug("Status: Closed (EOF)");
|
||||
emit q->debug(QStringLiteral("Status: Closed (EOF)"));
|
||||
else
|
||||
emit q->debug("Status: Closed (gone)");
|
||||
emit q->debug(QStringLiteral("Status: Closed (gone)"));
|
||||
|
||||
fin_status = true;
|
||||
doTryDone();
|
||||
@ -266,7 +266,7 @@ void GPGProc::Private::status_error(QCA::QPipeEnd::Error e)
|
||||
|
||||
void GPGProc::Private::proc_started()
|
||||
{
|
||||
emit q->debug("Process started");
|
||||
emit q->debug(QStringLiteral("Process started"));
|
||||
|
||||
// Note: we don't close these here anymore. instead we
|
||||
// do it just after calling proc->start().
|
||||
@ -326,7 +326,7 @@ void GPGProc::Private::proc_bytesWritten(qint64 lx)
|
||||
|
||||
void GPGProc::Private::proc_finished(int x)
|
||||
{
|
||||
emit q->debug(QString("Process finished: %1").arg(x));
|
||||
emit q->debug(QStringLiteral("Process finished: %1").arg(x));
|
||||
exitCode = x;
|
||||
|
||||
fin_process = true;
|
||||
@ -350,14 +350,14 @@ void GPGProc::Private::proc_finished(int x)
|
||||
void GPGProc::Private::proc_error(QProcess::ProcessError x)
|
||||
{
|
||||
QMap<int, QString> errmap;
|
||||
errmap[QProcess::FailedToStart] = "FailedToStart";
|
||||
errmap[QProcess::Crashed] = "Crashed";
|
||||
errmap[QProcess::Timedout] = "Timedout";
|
||||
errmap[QProcess::WriteError] = "WriteError";
|
||||
errmap[QProcess::ReadError] = "ReadError";
|
||||
errmap[QProcess::UnknownError] = "UnknownError";
|
||||
errmap[QProcess::FailedToStart] = QStringLiteral("FailedToStart");
|
||||
errmap[QProcess::Crashed] = QStringLiteral("Crashed");
|
||||
errmap[QProcess::Timedout] = QStringLiteral("Timedout");
|
||||
errmap[QProcess::WriteError] = QStringLiteral("WriteError");
|
||||
errmap[QProcess::ReadError] = QStringLiteral("ReadError");
|
||||
errmap[QProcess::UnknownError] = QStringLiteral("UnknownError");
|
||||
|
||||
emit q->debug(QString("Process error: %1").arg(errmap[x]));
|
||||
emit q->debug(QStringLiteral("Process error: %1").arg(errmap[x]));
|
||||
|
||||
if(x == QProcess::FailedToStart)
|
||||
error = GPGProc::FailedToStart;
|
||||
@ -405,7 +405,7 @@ void GPGProc::Private::doTryDone()
|
||||
if(need_status && !fin_status)
|
||||
return;
|
||||
|
||||
emit q->debug("Done");
|
||||
emit q->debug(QStringLiteral("Done"));
|
||||
|
||||
// get leftover data
|
||||
proc->setReadChannel(QProcess::StandardOutput);
|
||||
@ -456,7 +456,7 @@ bool GPGProc::Private::processStatusData(const QByteArray &buf)
|
||||
str.truncate(str.length() - 1);
|
||||
|
||||
// ensure it has a proper header
|
||||
if(str.left(9) != "[GNUPG:] ")
|
||||
if(str.left(9) != QLatin1String("[GNUPG:] "))
|
||||
continue;
|
||||
|
||||
// take it off
|
||||
@ -501,7 +501,7 @@ void GPGProc::start(const QString &bin, const QStringList &args, Mode mode)
|
||||
|
||||
if(mode == ExtendedMode)
|
||||
{
|
||||
if(!d->setupPipes(args.contains("-&?")))
|
||||
if(!d->setupPipes(args.contains(QStringLiteral("-&?"))))
|
||||
{
|
||||
d->error = FailedToStart;
|
||||
|
||||
@ -512,7 +512,7 @@ void GPGProc::start(const QString &bin, const QStringList &args, Mode mode)
|
||||
|
||||
d->need_status = true;
|
||||
|
||||
emit debug("Pipe setup complete");
|
||||
emit debug(QStringLiteral("Pipe setup complete"));
|
||||
}
|
||||
|
||||
d->proc = new SProcess(d);
|
||||
|
@ -87,9 +87,9 @@ QString MyKeyStoreEntry::serialize() const
|
||||
// we only serialize the key id. this means the keyring
|
||||
// must be available to restore the data
|
||||
QStringList out;
|
||||
out += escape_string("qca-gnupg-1");
|
||||
out += escape_string(QStringLiteral("qca-gnupg-1"));
|
||||
out += escape_string(pub.keyId());
|
||||
return out.join(":");
|
||||
return out.join(QStringLiteral(":"));
|
||||
}
|
||||
|
||||
} // end namespace gpgQCAPlugin
|
||||
|
@ -58,7 +58,7 @@ Provider::Context *MyKeyStoreList::clone() const
|
||||
|
||||
QString MyKeyStoreList::name(int) const
|
||||
{
|
||||
return "GnuPG Keyring";
|
||||
return QStringLiteral("GnuPG Keyring");
|
||||
}
|
||||
|
||||
KeyStore::Type MyKeyStoreList::type(int) const
|
||||
@ -68,7 +68,7 @@ KeyStore::Type MyKeyStoreList::type(int) const
|
||||
|
||||
QString MyKeyStoreList::storeId(int) const
|
||||
{
|
||||
return "qca-gnupg";
|
||||
return QStringLiteral("qca-gnupg");
|
||||
}
|
||||
|
||||
QList<int> MyKeyStoreList::keyStores()
|
||||
@ -157,7 +157,7 @@ KeyStoreEntryContext *MyKeyStoreList::entryPassive(const QString &serialized)
|
||||
QStringList parts = serialized.split(':');
|
||||
if(parts.count() < 2)
|
||||
return nullptr;
|
||||
if(unescape_string(parts[0]) != "qca-gnupg-1")
|
||||
if(unescape_string(parts[0]) != QLatin1String("qca-gnupg-1"))
|
||||
return nullptr;
|
||||
|
||||
QString entryId = unescape_string(parts[1]);
|
||||
@ -453,7 +453,7 @@ void MyKeyStoreList::gpg_finished()
|
||||
|
||||
void MyKeyStoreList::ring_changed(const QString &filePath)
|
||||
{
|
||||
ext_keyStoreLog(QString("ring_changed: [%1]\n").arg(filePath));
|
||||
ext_keyStoreLog(QStringLiteral("ring_changed: [%1]\n").arg(filePath));
|
||||
|
||||
if(filePath == secring)
|
||||
sec_changed();
|
||||
|
@ -27,7 +27,7 @@ namespace gpgQCAPlugin
|
||||
{
|
||||
|
||||
MyMessageContext::MyMessageContext(MyOpenPGPContext *_sms, Provider *p)
|
||||
: MessageContext(p, "pgpmsg")
|
||||
: MessageContext(p, QStringLiteral("pgpmsg"))
|
||||
, sms(_sms)
|
||||
, op(Sign)
|
||||
, signMode(SecureMessage::Detached)
|
||||
@ -94,7 +94,7 @@ void MyMessageContext::start(SecureMessage::Format f, Operation op)
|
||||
format = f;
|
||||
this->op = op;
|
||||
|
||||
if(getProperty("pgp-always-trust").toBool())
|
||||
if(getProperty(QStringLiteral("pgp-always-trust")).toBool())
|
||||
gpg.setAlwaysTrust(true);
|
||||
|
||||
if(format == SecureMessage::Ascii)
|
||||
@ -257,9 +257,9 @@ bool MyMessageContext::waitForFinished(int msecs)
|
||||
else
|
||||
keyId = e.keyId;
|
||||
QStringList out;
|
||||
out += escape_string("qca-gnupg-1");
|
||||
out += escape_string(QStringLiteral("qca-gnupg-1"));
|
||||
out += escape_string(keyId);
|
||||
QString serialized = out.join(":");
|
||||
QString serialized = out.join(QStringLiteral(":"));
|
||||
|
||||
KeyStoreEntry kse;
|
||||
KeyStoreEntryContext *c = keyStoreList->entryPassive(serialized);
|
||||
@ -340,7 +340,7 @@ QByteArray MyMessageContext::signature() const
|
||||
QString MyMessageContext::hashName() const
|
||||
{
|
||||
// TODO
|
||||
return "sha1";
|
||||
return QStringLiteral("sha1");
|
||||
}
|
||||
|
||||
SecureMessageSignatureList MyMessageContext::signers() const
|
||||
@ -384,9 +384,9 @@ void MyMessageContext::gpg_needPassphrase(const QString &in_keyId)
|
||||
keyId = in_keyId;
|
||||
//emit keyStoreList->storeNeedPassphrase(0, 0, keyId);
|
||||
QStringList out;
|
||||
out += escape_string("qca-gnupg-1");
|
||||
out += escape_string(QStringLiteral("qca-gnupg-1"));
|
||||
out += escape_string(keyId);
|
||||
QString serialized = out.join(":");
|
||||
QString serialized = out.join(QStringLiteral(":"));
|
||||
|
||||
KeyStoreEntry kse;
|
||||
MyKeyStoreList *keyStoreList = MyKeyStoreList::instance();
|
||||
|
@ -25,7 +25,7 @@ namespace gpgQCAPlugin
|
||||
{
|
||||
|
||||
MyOpenPGPContext::MyOpenPGPContext(QCA::Provider *p)
|
||||
: SMSContext(p, "openpgp")
|
||||
: SMSContext(p, QStringLiteral("openpgp"))
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
|
@ -38,25 +38,25 @@ public:
|
||||
|
||||
QString name() const override
|
||||
{
|
||||
return "qca-gnupg";
|
||||
return QStringLiteral("qca-gnupg");
|
||||
}
|
||||
|
||||
QStringList features() const override
|
||||
{
|
||||
QStringList list;
|
||||
list += "pgpkey";
|
||||
list += "openpgp";
|
||||
list += "keystorelist";
|
||||
list += QStringLiteral("pgpkey");
|
||||
list += QStringLiteral("openpgp");
|
||||
list += QStringLiteral("keystorelist");
|
||||
return list;
|
||||
}
|
||||
|
||||
Context *createContext(const QString &type) override
|
||||
{
|
||||
if(type == "pgpkey")
|
||||
if(type == QLatin1String("pgpkey"))
|
||||
return new MyPGPKeyContext(this);
|
||||
else if(type == "openpgp")
|
||||
else if(type == QLatin1String("openpgp"))
|
||||
return new MyOpenPGPContext(this);
|
||||
else if(type == "keystorelist")
|
||||
else if(type == QLatin1String("keystorelist"))
|
||||
return new MyKeyStoreList(this);
|
||||
else
|
||||
return nullptr;
|
||||
|
@ -117,7 +117,7 @@ QString find_bin()
|
||||
#ifdef Q_OS_WIN
|
||||
bins << "gpg.exe" << "gpg2.exe";
|
||||
#else
|
||||
bins << "gpg" << "gpg2";
|
||||
bins << QStringLiteral("gpg") << QStringLiteral("gpg2");
|
||||
#endif
|
||||
|
||||
// Prefer bundled gpg
|
||||
@ -140,7 +140,7 @@ QString find_bin()
|
||||
#ifdef Q_OS_WIN
|
||||
QString pathSep = ";";
|
||||
#else
|
||||
QString pathSep = ":";
|
||||
const QString pathSep = QStringLiteral(":");
|
||||
#endif
|
||||
|
||||
QStringList paths = QString::fromLocal8Bit(qgetenv("PATH")).split(pathSep, QString::SkipEmptyParts);
|
||||
@ -176,9 +176,9 @@ QString escape_string(const QString &in)
|
||||
for(const QChar &c : in)
|
||||
{
|
||||
if(c == '\\')
|
||||
out += "\\\\";
|
||||
out += QStringLiteral("\\\\");
|
||||
else if(c == ':')
|
||||
out += "\\c";
|
||||
out += QStringLiteral("\\c");
|
||||
else
|
||||
out += c;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ class StreamLogger : public QCA::AbstractLogDevice
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
StreamLogger(QTextStream &stream) : QCA::AbstractLogDevice( "Stream logger" ), _stream(stream)
|
||||
StreamLogger(QTextStream &stream) : QCA::AbstractLogDevice( QStringLiteral("Stream logger") ), _stream(stream)
|
||||
{
|
||||
QCA::logger()->registerLogDevice (this);
|
||||
}
|
||||
@ -66,7 +66,7 @@ private:
|
||||
}
|
||||
|
||||
inline QString now() {
|
||||
static const QString format = "yyyy-MM-dd hh:mm:ss";
|
||||
static const QString format = QStringLiteral("yyyy-MM-dd hh:mm:ss");
|
||||
return QDateTime::currentDateTime ().toString (format);
|
||||
}
|
||||
|
||||
@ -134,13 +134,13 @@ public:
|
||||
|
||||
QString
|
||||
name () const override {
|
||||
return "qca-logger";
|
||||
return QStringLiteral("qca-logger");
|
||||
}
|
||||
|
||||
QStringList
|
||||
features () const override {
|
||||
QStringList list;
|
||||
list += "log";
|
||||
list += QStringLiteral("log");
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -156,10 +156,10 @@ public:
|
||||
defaultConfig () const override {
|
||||
QVariantMap mytemplate;
|
||||
|
||||
mytemplate["formtype"] = "http://affinix.com/qca/forms/qca-logger#1.0";
|
||||
mytemplate["enabled"] = false;
|
||||
mytemplate["file"] = "";
|
||||
mytemplate["level"] = (int)Logger::Quiet;
|
||||
mytemplate[QStringLiteral("formtype")] = "http://affinix.com/qca/forms/qca-logger#1.0";
|
||||
mytemplate[QStringLiteral("enabled")] = false;
|
||||
mytemplate[QStringLiteral("file")] = "";
|
||||
mytemplate[QStringLiteral("level")] = (int)Logger::Quiet;
|
||||
|
||||
return mytemplate;
|
||||
}
|
||||
@ -170,10 +170,10 @@ public:
|
||||
delete _streamLogger;
|
||||
_streamLogger = nullptr;
|
||||
|
||||
if (config["enabled"].toBool ()) {
|
||||
if (config[QStringLiteral("enabled")].toBool ()) {
|
||||
createLogger (
|
||||
config["level"].toInt (),
|
||||
config["file"].toString ()
|
||||
config[QStringLiteral("level")].toInt (),
|
||||
config[QStringLiteral("file")].toString ()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -49,22 +49,22 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if ( QString("md2") == type ) {
|
||||
if ( QLatin1String("md2") == type ) {
|
||||
m_hashAlgo = SEC_OID_MD2;
|
||||
}
|
||||
else if ( QString("md5") == type ) {
|
||||
else if ( QLatin1String("md5") == type ) {
|
||||
m_hashAlgo = SEC_OID_MD5;
|
||||
}
|
||||
else if ( QString("sha1") == type ) {
|
||||
else if ( QLatin1String("sha1") == type ) {
|
||||
m_hashAlgo = SEC_OID_SHA1;
|
||||
}
|
||||
else if ( QString("sha256") == type ) {
|
||||
else if ( QLatin1String("sha256") == type ) {
|
||||
m_hashAlgo = SEC_OID_SHA256;
|
||||
}
|
||||
else if ( QString("sha384") == type ) {
|
||||
else if ( QLatin1String("sha384") == type ) {
|
||||
m_hashAlgo = SEC_OID_SHA384;
|
||||
}
|
||||
else if ( QString("sha512") == type ) {
|
||||
else if ( QLatin1String("sha512") == type ) {
|
||||
m_hashAlgo = SEC_OID_SHA512;
|
||||
} else {
|
||||
qDebug() << "Unknown provider type: " << type;
|
||||
@ -158,22 +158,22 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
if ( QString("hmac(md5)") == type ) {
|
||||
if ( QLatin1String("hmac(md5)") == type ) {
|
||||
m_macAlgo = CKM_MD5_HMAC;
|
||||
}
|
||||
else if ( QString("hmac(sha1)") == type ) {
|
||||
else if ( QLatin1String("hmac(sha1)") == type ) {
|
||||
m_macAlgo = CKM_SHA_1_HMAC;
|
||||
}
|
||||
else if ( QString("hmac(sha256)") == type ) {
|
||||
else if ( QLatin1String("hmac(sha256)") == type ) {
|
||||
m_macAlgo = CKM_SHA256_HMAC;
|
||||
}
|
||||
else if ( QString("hmac(sha384)") == type ) {
|
||||
else if ( QLatin1String("hmac(sha384)") == type ) {
|
||||
m_macAlgo = CKM_SHA384_HMAC;
|
||||
}
|
||||
else if ( QString("hmac(sha512)") == type ) {
|
||||
else if ( QLatin1String("hmac(sha512)") == type ) {
|
||||
m_macAlgo = CKM_SHA512_HMAC;
|
||||
}
|
||||
else if ( QString("hmac(ripemd160)") == type ) {
|
||||
else if ( QLatin1String("hmac(ripemd160)") == type ) {
|
||||
m_macAlgo = CKM_RIPEMD160_HMAC;
|
||||
}
|
||||
else {
|
||||
@ -281,22 +281,22 @@ public:
|
||||
{
|
||||
NSS_NoDB_Init(".");
|
||||
|
||||
if ( QString("aes128-ecb") == type ) {
|
||||
if ( QLatin1String("aes128-ecb") == type ) {
|
||||
m_cipherMechanism = CKM_AES_ECB;
|
||||
}
|
||||
else if ( QString("aes128-cbc") == type ) {
|
||||
else if ( QLatin1String("aes128-cbc") == type ) {
|
||||
m_cipherMechanism = CKM_AES_CBC;
|
||||
}
|
||||
else if ( QString("des-ecb") == type ) {
|
||||
else if ( QLatin1String("des-ecb") == type ) {
|
||||
m_cipherMechanism = CKM_DES_ECB;
|
||||
}
|
||||
else if ( QString("des-cbc") == type ) {
|
||||
else if ( QLatin1String("des-cbc") == type ) {
|
||||
m_cipherMechanism = CKM_DES_CBC;
|
||||
}
|
||||
else if ( QString("des-cbc-pkcs7") == type ) {
|
||||
else if ( QLatin1String("des-cbc-pkcs7") == type ) {
|
||||
m_cipherMechanism = CKM_DES_CBC_PAD;
|
||||
}
|
||||
else if ( QString("tripledes-ecb") == type ) {
|
||||
else if ( QLatin1String("tripledes-ecb") == type ) {
|
||||
m_cipherMechanism = CKM_DES3_ECB;
|
||||
}
|
||||
else {
|
||||
@ -461,77 +461,77 @@ public:
|
||||
|
||||
QString name() const override
|
||||
{
|
||||
return "qca-nss";
|
||||
return QStringLiteral("qca-nss");
|
||||
}
|
||||
|
||||
QStringList features() const override
|
||||
{
|
||||
QStringList list;
|
||||
|
||||
list += "md2";
|
||||
list += "md5";
|
||||
list += "sha1";
|
||||
list += "sha256";
|
||||
list += "sha384";
|
||||
list += "sha512";
|
||||
list += QStringLiteral("md2");
|
||||
list += QStringLiteral("md5");
|
||||
list += QStringLiteral("sha1");
|
||||
list += QStringLiteral("sha256");
|
||||
list += QStringLiteral("sha384");
|
||||
list += QStringLiteral("sha512");
|
||||
|
||||
list += "hmac(md5)";
|
||||
list += "hmac(sha1)";
|
||||
list += "hmac(sha256)";
|
||||
list += "hmac(sha384)";
|
||||
list += "hmac(sha512)";
|
||||
list += QStringLiteral("hmac(md5)");
|
||||
list += QStringLiteral("hmac(sha1)");
|
||||
list += QStringLiteral("hmac(sha256)");
|
||||
list += QStringLiteral("hmac(sha384)");
|
||||
list += QStringLiteral("hmac(sha512)");
|
||||
// appears to not be implemented in NSS yet
|
||||
// list += "hmac(ripemd160)";
|
||||
// list += QStringLiteral("hmac(ripemd160)");
|
||||
|
||||
list += "aes128-ecb";
|
||||
list += "aes128-cbc";
|
||||
list += "des-ecb";
|
||||
list += "des-cbc";
|
||||
list += "des-cbc-pkcs7";
|
||||
list += "tripledes-ecb";
|
||||
list += QStringLiteral("aes128-ecb");
|
||||
list += QStringLiteral("aes128-cbc");
|
||||
list += QStringLiteral("des-ecb");
|
||||
list += QStringLiteral("des-cbc");
|
||||
list += QStringLiteral("des-cbc-pkcs7");
|
||||
list += QStringLiteral("tripledes-ecb");
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
Context *createContext(const QString &type) override
|
||||
{
|
||||
if ( type == "md2" )
|
||||
if ( type == QLatin1String("md2") )
|
||||
return new nssHashContext( this, type );
|
||||
if ( type == "md5" )
|
||||
if ( type == QLatin1String("md5") )
|
||||
return new nssHashContext( this, type );
|
||||
if ( type == "sha1" )
|
||||
if ( type == QLatin1String("sha1") )
|
||||
return new nssHashContext( this, type );
|
||||
if ( type == "sha256" )
|
||||
if ( type == QLatin1String("sha256") )
|
||||
return new nssHashContext( this, type );
|
||||
if ( type == "sha384" )
|
||||
if ( type == QLatin1String("sha384") )
|
||||
return new nssHashContext( this, type );
|
||||
if ( type == "sha512" )
|
||||
if ( type == QLatin1String("sha512") )
|
||||
return new nssHashContext( this, type );
|
||||
|
||||
if ( type == "hmac(md5)" )
|
||||
if ( type == QLatin1String("hmac(md5)") )
|
||||
return new nssHmacContext( this, type );
|
||||
if ( type == "hmac(sha1)" )
|
||||
if ( type == QLatin1String("hmac(sha1)") )
|
||||
return new nssHmacContext( this, type );
|
||||
if ( type == "hmac(sha256)" )
|
||||
if ( type == QLatin1String("hmac(sha256)") )
|
||||
return new nssHmacContext( this, type );
|
||||
if ( type == "hmac(sha384)" )
|
||||
if ( type == QLatin1String("hmac(sha384)") )
|
||||
return new nssHmacContext( this, type );
|
||||
if ( type == "hmac(sha512)" )
|
||||
if ( type == QLatin1String("hmac(sha512)") )
|
||||
return new nssHmacContext( this, type );
|
||||
if ( type == "hmac(ripemd160)" )
|
||||
if ( type == QLatin1String("hmac(ripemd160)") )
|
||||
return new nssHmacContext( this, type );
|
||||
|
||||
if ( type == "aes128-ecb" )
|
||||
if ( type == QLatin1String("aes128-ecb") )
|
||||
return new nssCipherContext( this, type);
|
||||
if ( type == "aes128-cbc" )
|
||||
if ( type == QLatin1String("aes128-cbc") )
|
||||
return new nssCipherContext( this, type);
|
||||
if ( type == "des-ecb" )
|
||||
if ( type == QLatin1String("des-ecb") )
|
||||
return new nssCipherContext( this, type);
|
||||
if ( type == "des-cbc" )
|
||||
if ( type == QLatin1String("des-cbc") )
|
||||
return new nssCipherContext( this, type);
|
||||
if ( type == "des-cbc-pkcs7" )
|
||||
if ( type == QLatin1String("des-cbc-pkcs7") )
|
||||
return new nssCipherContext( this, type);
|
||||
if ( type == "tripledes-ecb" )
|
||||
if ( type == QLatin1String("tripledes-ecb") )
|
||||
return new nssCipherContext( this, type);
|
||||
else
|
||||
return nullptr;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -44,7 +44,7 @@ certificateHash (
|
||||
return QString();
|
||||
}
|
||||
else {
|
||||
return Hash ("sha1").hashToString (cert.toDER ());
|
||||
return Hash (QStringLiteral("sha1")).hashToString (cert.toDER ());
|
||||
}
|
||||
}
|
||||
|
||||
@ -381,7 +381,7 @@ public:
|
||||
|
||||
QString
|
||||
message () const {
|
||||
return _msg + QString (" ") + pkcs11h_getMessage (_rv);
|
||||
return _msg + QStringLiteral(" ") + pkcs11h_getMessage (_rv);
|
||||
}
|
||||
};
|
||||
|
||||
@ -419,7 +419,7 @@ public:
|
||||
CK_RV rv;
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11RSAContext::pkcs11RSAContext1 - entry",
|
||||
QStringLiteral("pkcs11RSAContext::pkcs11RSAContext1 - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -436,11 +436,11 @@ public:
|
||||
pkcs11h_certificate_id
|
||||
)) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (rv, "Memory error");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Memory error"));
|
||||
}
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11RSAContext::pkcs11RSAContext1 - return",
|
||||
QStringLiteral("pkcs11RSAContext::pkcs11RSAContext1 - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -449,7 +449,7 @@ public:
|
||||
CK_RV rv;
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11RSAContext::pkcs11RSAContextC - entry",
|
||||
QStringLiteral("pkcs11RSAContext::pkcs11RSAContextC - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -467,18 +467,18 @@ public:
|
||||
from._pkcs11h_certificate_id
|
||||
)) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (rv, "Memory error");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Memory error"));
|
||||
}
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11RSAContext::pkcs11RSAContextC - return",
|
||||
QStringLiteral("pkcs11RSAContext::pkcs11RSAContextC - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
|
||||
~pkcs11RSAContext () override {
|
||||
QCA_logTextMessage (
|
||||
"pkcs11RSAContext::~pkcs11RSAContext - entry",
|
||||
QStringLiteral("pkcs11RSAContext::~pkcs11RSAContext - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -495,7 +495,7 @@ public:
|
||||
}
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11RSAContext::~pkcs11RSAContext - return",
|
||||
QStringLiteral("pkcs11RSAContext::~pkcs11RSAContext - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -529,7 +529,7 @@ public:
|
||||
void
|
||||
convertToPublic () override {
|
||||
QCA_logTextMessage (
|
||||
"pkcs11RSAContext::convertToPublic - entry",
|
||||
QStringLiteral("pkcs11RSAContext::convertToPublic - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -542,7 +542,7 @@ public:
|
||||
}
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11RSAContext::convertToPublic - return",
|
||||
QStringLiteral("pkcs11RSAContext::convertToPublic - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -598,7 +598,7 @@ public:
|
||||
mech = CKM_RSA_PKCS_OAEP;
|
||||
break;
|
||||
default:
|
||||
throw pkcs11Exception (CKR_FUNCTION_NOT_SUPPORTED, "Invalid algorithm");
|
||||
throw pkcs11Exception (CKR_FUNCTION_NOT_SUPPORTED, QStringLiteral("Invalid algorithm"));
|
||||
break;
|
||||
}
|
||||
|
||||
@ -609,7 +609,7 @@ public:
|
||||
_pkcs11h_certificate
|
||||
)) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (rv, "Cannot lock session");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Cannot lock session"));
|
||||
}
|
||||
session_locked = true;
|
||||
|
||||
@ -623,7 +623,7 @@ public:
|
||||
&my_size
|
||||
)) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (rv, "Decryption error");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Decryption error"));
|
||||
}
|
||||
|
||||
out->resize (my_size);
|
||||
@ -638,7 +638,7 @@ public:
|
||||
&my_size
|
||||
)) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (rv, "Decryption error");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Decryption error"));
|
||||
}
|
||||
|
||||
rv = out->resize (my_size);
|
||||
@ -648,7 +648,7 @@ public:
|
||||
_pkcs11h_certificate
|
||||
)) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (rv, "Cannot release session");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Cannot release session"));
|
||||
}
|
||||
session_locked = false;
|
||||
|
||||
@ -695,13 +695,13 @@ public:
|
||||
|
||||
switch (_sign_data.alg) {
|
||||
case EMSA3_SHA1:
|
||||
_sign_data.hash = new Hash ("sha1");
|
||||
_sign_data.hash = new Hash(QStringLiteral("sha1"));
|
||||
break;
|
||||
case EMSA3_MD5:
|
||||
_sign_data.hash = new Hash ("md5");
|
||||
_sign_data.hash = new Hash(QStringLiteral("md5"));
|
||||
break;
|
||||
case EMSA3_MD2:
|
||||
_sign_data.hash = new Hash ("md2");
|
||||
_sign_data.hash = new Hash(QStringLiteral("md2"));
|
||||
break;
|
||||
case EMSA3_Raw:
|
||||
break;
|
||||
@ -751,7 +751,7 @@ public:
|
||||
bool session_locked = false;
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11RSAContext::endSign - entry",
|
||||
QStringLiteral("pkcs11RSAContext::endSign - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -774,7 +774,7 @@ public:
|
||||
}
|
||||
|
||||
if (final.size () == 0) {
|
||||
throw pkcs11Exception (CKR_FUNCTION_FAILED, "Cannot encode signature");
|
||||
throw pkcs11Exception (CKR_FUNCTION_FAILED, QStringLiteral("Cannot encode signature"));
|
||||
}
|
||||
|
||||
_ensureCertificate ();
|
||||
@ -786,7 +786,7 @@ public:
|
||||
_pkcs11h_certificate
|
||||
)) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (rv, "Cannot lock session");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Cannot lock session"));
|
||||
}
|
||||
session_locked = true;
|
||||
|
||||
@ -800,7 +800,7 @@ public:
|
||||
&my_size
|
||||
)) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (rv, "Signature failed");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Signature failed"));
|
||||
}
|
||||
|
||||
result.resize (my_size);
|
||||
@ -815,7 +815,7 @@ public:
|
||||
&my_size
|
||||
)) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (rv, "Signature failed");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Signature failed"));
|
||||
}
|
||||
|
||||
result.resize (my_size);
|
||||
@ -825,7 +825,7 @@ public:
|
||||
_pkcs11h_certificate
|
||||
)) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (rv, "Cannot release session");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Cannot release session"));
|
||||
}
|
||||
session_locked = false;
|
||||
|
||||
@ -943,7 +943,7 @@ public:
|
||||
bool ret;
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11RSAContext::_ensureTokenAvailable - entry",
|
||||
QStringLiteral("pkcs11RSAContext::_ensureTokenAvailable - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -969,7 +969,7 @@ public:
|
||||
bool ret;
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11RSAContext::_ensureTokenAccess - entry",
|
||||
QStringLiteral("pkcs11RSAContext::_ensureTokenAccess - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -1004,7 +1004,7 @@ private:
|
||||
CK_RV rv;
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11RSAContext::_ensureCertificate - entry",
|
||||
QStringLiteral("pkcs11RSAContext::_ensureCertificate - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -1018,12 +1018,12 @@ private:
|
||||
&_pkcs11h_certificate
|
||||
)) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (rv, "Cannot create low-level certificate");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Cannot create low-level certificate"));
|
||||
}
|
||||
}
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11RSAContext::_ensureCertificate - return",
|
||||
QStringLiteral("pkcs11RSAContext::_ensureCertificate - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -1436,14 +1436,14 @@ pkcs11KeyStoreListContext::pkcs11KeyStoreListContext (Provider *p) : KeyStoreLis
|
||||
_initialized = false;
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11KeyStoreListContext::pkcs11KeyStoreListContext - return",
|
||||
QStringLiteral("pkcs11KeyStoreListContext::pkcs11KeyStoreListContext - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
|
||||
pkcs11KeyStoreListContext::~pkcs11KeyStoreListContext () {
|
||||
QCA_logTextMessage (
|
||||
"pkcs11KeyStoreListContext::~pkcs11KeyStoreListContext - entry",
|
||||
QStringLiteral("pkcs11KeyStoreListContext::~pkcs11KeyStoreListContext - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -1451,7 +1451,7 @@ pkcs11KeyStoreListContext::~pkcs11KeyStoreListContext () {
|
||||
_clearStores ();
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11KeyStoreListContext::~pkcs11KeyStoreListContext - return",
|
||||
QStringLiteral("pkcs11KeyStoreListContext::~pkcs11KeyStoreListContext - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -1459,7 +1459,7 @@ pkcs11KeyStoreListContext::~pkcs11KeyStoreListContext () {
|
||||
Provider::Context *
|
||||
pkcs11KeyStoreListContext::clone () const {
|
||||
QCA_logTextMessage (
|
||||
"pkcs11KeyStoreListContext::clone - entry/return",
|
||||
QStringLiteral("pkcs11KeyStoreListContext::clone - entry/return"),
|
||||
Logger::Debug
|
||||
);
|
||||
return nullptr;
|
||||
@ -1468,14 +1468,14 @@ pkcs11KeyStoreListContext::clone () const {
|
||||
void
|
||||
pkcs11KeyStoreListContext::start () {
|
||||
QCA_logTextMessage (
|
||||
"pkcs11KeyStoreListContext::start - entry",
|
||||
QStringLiteral("pkcs11KeyStoreListContext::start - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
QMetaObject::invokeMethod(this, "doReady", Qt::QueuedConnection);
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11KeyStoreListContext::start - return",
|
||||
QStringLiteral("pkcs11KeyStoreListContext::start - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -1510,7 +1510,7 @@ pkcs11KeyStoreListContext::setUpdatesEnabled (bool enabled) {
|
||||
}
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11KeyStoreListContext::setUpdatesEnabled - return",
|
||||
QStringLiteral("pkcs11KeyStoreListContext::setUpdatesEnabled - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -1550,7 +1550,7 @@ pkcs11KeyStoreListContext::entryPassive (
|
||||
);
|
||||
|
||||
try {
|
||||
if (serialized.startsWith ("qca-pkcs11/")) {
|
||||
if (serialized.startsWith (QLatin1String("qca-pkcs11/"))) {
|
||||
CertificateChain chain;
|
||||
bool has_private;
|
||||
|
||||
@ -1688,7 +1688,7 @@ pkcs11KeyStoreListContext::keyStores () {
|
||||
QList<int> out;
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11KeyStoreListContext::keyStores - entry",
|
||||
QStringLiteral("pkcs11KeyStoreListContext::keyStores - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -1704,7 +1704,7 @@ pkcs11KeyStoreListContext::keyStores () {
|
||||
&tokens
|
||||
)) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (rv, "Enumerating tokens");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Enumerating tokens"));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1800,7 +1800,7 @@ pkcs11KeyStoreListContext::entryList (int id) {
|
||||
&certs
|
||||
)) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (rv, "Enumerate certificates");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Enumerate certificates"));
|
||||
}
|
||||
|
||||
for (
|
||||
@ -1855,7 +1855,7 @@ pkcs11KeyStoreListContext::entryList (int id) {
|
||||
) {
|
||||
try {
|
||||
if (listIssuers[i].isNull ()) {
|
||||
throw pkcs11Exception (CKR_ARGUMENTS_BAD, "Invalid certificate");
|
||||
throw pkcs11Exception (CKR_ARGUMENTS_BAD, QStringLiteral("Invalid certificate"));
|
||||
}
|
||||
|
||||
if (
|
||||
@ -1889,7 +1889,7 @@ pkcs11KeyStoreListContext::entryList (int id) {
|
||||
) {
|
||||
try {
|
||||
if (listCerts[i].isNull ()) {
|
||||
throw pkcs11Exception (CKR_ARGUMENTS_BAD, "Invalid certificate");
|
||||
throw pkcs11Exception (CKR_ARGUMENTS_BAD, QStringLiteral("Invalid certificate"));
|
||||
}
|
||||
|
||||
CertificateChain chain = CertificateChain (listCerts[i]).complete (listIssuersForComplete);
|
||||
@ -2067,7 +2067,7 @@ pkcs11KeyStoreListContext::_emit_diagnosticText (
|
||||
emit diagnosticText (t);
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11KeyStoreListContext::_emit_diagnosticText - return",
|
||||
QStringLiteral("pkcs11KeyStoreListContext::_emit_diagnosticText - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -2075,14 +2075,14 @@ pkcs11KeyStoreListContext::_emit_diagnosticText (
|
||||
void
|
||||
pkcs11KeyStoreListContext::doReady () {
|
||||
QCA_logTextMessage (
|
||||
"pkcs11KeyStoreListContext::doReady - entry",
|
||||
QStringLiteral("pkcs11KeyStoreListContext::doReady - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
emit busyEnd ();
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11KeyStoreListContext::doReady - return",
|
||||
QStringLiteral("pkcs11KeyStoreListContext::doReady - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -2090,14 +2090,14 @@ pkcs11KeyStoreListContext::doReady () {
|
||||
void
|
||||
pkcs11KeyStoreListContext::doUpdated () {
|
||||
QCA_logTextMessage (
|
||||
"pkcs11KeyStoreListContext::doUpdated - entry",
|
||||
QStringLiteral("pkcs11KeyStoreListContext::doUpdated - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
emit updated ();
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11KeyStoreListContext::doUpdated - return",
|
||||
QStringLiteral("pkcs11KeyStoreListContext::doUpdated - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -2159,7 +2159,7 @@ pkcs11KeyStoreListContext::_registerTokenId (
|
||||
void
|
||||
pkcs11KeyStoreListContext::_clearStores () {
|
||||
QCA_logTextMessage (
|
||||
"pkcs11KeyStoreListContext::_clearStores - entry",
|
||||
QStringLiteral("pkcs11KeyStoreListContext::_clearStores - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -2173,7 +2173,7 @@ pkcs11KeyStoreListContext::_clearStores () {
|
||||
_stores.clear ();
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11KeyStoreListContext::_clearStores - return",
|
||||
QStringLiteral("pkcs11KeyStoreListContext::_clearStores - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -2198,7 +2198,7 @@ pkcs11KeyStoreListContext::_keyStoreEntryByCertificateId (
|
||||
);
|
||||
|
||||
if (certificate_id == nullptr) {
|
||||
throw pkcs11Exception (CKR_ARGUMENTS_BAD, "Missing certificate object");
|
||||
throw pkcs11Exception (CKR_ARGUMENTS_BAD, QStringLiteral("Missing certificate object"));
|
||||
}
|
||||
|
||||
QString serialized = _serializeCertificate (
|
||||
@ -2210,7 +2210,7 @@ pkcs11KeyStoreListContext::_keyStoreEntryByCertificateId (
|
||||
QString description = _description;
|
||||
const Certificate &cert = chain.primary ();
|
||||
if (description.isEmpty ()) {
|
||||
description = cert.subjectInfoOrdered ().toString () + " by " + cert.issuerInfo ().value (CommonName, "Unknown");
|
||||
description = cert.subjectInfoOrdered ().toString () + " by " + cert.issuerInfo ().value (CommonName, QStringLiteral("Unknown"));
|
||||
}
|
||||
|
||||
if (has_private) {
|
||||
@ -2284,7 +2284,7 @@ pkcs11KeyStoreListContext::_tokenId2storeId (
|
||||
token_id
|
||||
) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (CKR_FUNCTION_FAILED, "Cannot serialize token id");
|
||||
throw pkcs11Exception (CKR_FUNCTION_FAILED, QStringLiteral("Cannot serialize token id"));
|
||||
}
|
||||
|
||||
QByteArray buf;
|
||||
@ -2297,7 +2297,7 @@ pkcs11KeyStoreListContext::_tokenId2storeId (
|
||||
token_id
|
||||
) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (CKR_FUNCTION_FAILED, "Cannot serialize token id");
|
||||
throw pkcs11Exception (CKR_FUNCTION_FAILED, QStringLiteral("Cannot serialize token id"));
|
||||
}
|
||||
|
||||
buf.resize ((int)len);
|
||||
@ -2340,7 +2340,7 @@ pkcs11KeyStoreListContext::_serializeCertificate (
|
||||
certificate_id
|
||||
) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (CKR_FUNCTION_FAILED, "Cannot serialize certificate id");
|
||||
throw pkcs11Exception (CKR_FUNCTION_FAILED, QStringLiteral("Cannot serialize certificate id"));
|
||||
}
|
||||
|
||||
QByteArray buf;
|
||||
@ -2353,7 +2353,7 @@ pkcs11KeyStoreListContext::_serializeCertificate (
|
||||
certificate_id
|
||||
) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (CKR_FUNCTION_FAILED, "Cannot serialize certificate id");
|
||||
throw pkcs11Exception (CKR_FUNCTION_FAILED, QStringLiteral("Cannot serialize certificate id"));
|
||||
}
|
||||
|
||||
buf.resize ((int)len);
|
||||
@ -2369,7 +2369,7 @@ pkcs11KeyStoreListContext::_serializeCertificate (
|
||||
list += _escapeString (Base64 ().arrayToString (i.toDER ()));
|
||||
}
|
||||
|
||||
serialized.append (list.join ("/"));
|
||||
serialized.append (list.join (QStringLiteral("/")));
|
||||
|
||||
QCA_logTextMessage (
|
||||
QString::asprintf (
|
||||
@ -2409,18 +2409,18 @@ pkcs11KeyStoreListContext::_deserializeCertificate (
|
||||
*p_certificate_id = nullptr;
|
||||
*p_has_private = false;
|
||||
|
||||
QStringList list = from.split ("/");
|
||||
QStringList list = from.split (QStringLiteral("/"));
|
||||
|
||||
if (list.size () < 5) {
|
||||
throw pkcs11Exception (CKR_FUNCTION_FAILED, "Invalid serialization");
|
||||
throw pkcs11Exception (CKR_FUNCTION_FAILED, QStringLiteral("Invalid serialization"));
|
||||
}
|
||||
|
||||
if (list[n++] != "qca-pkcs11") {
|
||||
throw pkcs11Exception (CKR_FUNCTION_FAILED, "Invalid serialization");
|
||||
if (list[n++] != QLatin1String("qca-pkcs11")) {
|
||||
throw pkcs11Exception (CKR_FUNCTION_FAILED, QStringLiteral("Invalid serialization"));
|
||||
}
|
||||
|
||||
if (list[n++].toInt () != 0) {
|
||||
throw pkcs11Exception (CKR_FUNCTION_FAILED, "Invalid serialization version");
|
||||
throw pkcs11Exception (CKR_FUNCTION_FAILED, QStringLiteral("Invalid serialization version"));
|
||||
}
|
||||
|
||||
if (
|
||||
@ -2429,7 +2429,7 @@ pkcs11KeyStoreListContext::_deserializeCertificate (
|
||||
myPrintable (_unescapeString (list[n++]))
|
||||
)) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (rv, "Invalid serialization");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Invalid serialization"));
|
||||
}
|
||||
|
||||
*p_has_private = list[n++].toInt () != 0;
|
||||
@ -2438,7 +2438,7 @@ pkcs11KeyStoreListContext::_deserializeCertificate (
|
||||
Certificate endCertificate = Certificate::fromDER (endCertificateBytes);
|
||||
|
||||
if (endCertificate.isNull ()) {
|
||||
throw pkcs11Exception (rv, "Invalid certificate");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Invalid certificate"));
|
||||
}
|
||||
|
||||
if (
|
||||
@ -2448,7 +2448,7 @@ pkcs11KeyStoreListContext::_deserializeCertificate (
|
||||
(size_t)endCertificateBytes.size ()
|
||||
)) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (rv, "Invalid serialization");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Invalid serialization"));
|
||||
}
|
||||
|
||||
chain = endCertificate;
|
||||
@ -2457,7 +2457,7 @@ pkcs11KeyStoreListContext::_deserializeCertificate (
|
||||
Base64 ().stringToArray (_unescapeString (list[n++])).toByteArray ()
|
||||
);
|
||||
if (cert.isNull ()) {
|
||||
throw pkcs11Exception (rv, "Invalid certificate");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Invalid certificate"));
|
||||
}
|
||||
chain += cert;
|
||||
}
|
||||
@ -2534,7 +2534,7 @@ const int pkcs11Provider::_CONFIG_MAX_PROVIDERS = 10;
|
||||
pkcs11Provider::pkcs11Provider () {
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11Provider::pkcs11Provider - entry",
|
||||
QStringLiteral("pkcs11Provider::pkcs11Provider - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -2544,14 +2544,14 @@ pkcs11Provider::pkcs11Provider () {
|
||||
_allowLoadRootCA = false;
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11Provider::pkcs11Provider - return",
|
||||
QStringLiteral("pkcs11Provider::pkcs11Provider - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
|
||||
pkcs11Provider::~pkcs11Provider () {
|
||||
QCA_logTextMessage (
|
||||
"pkcs11Provider::~pkcs11Provider - entry/return",
|
||||
QStringLiteral("pkcs11Provider::~pkcs11Provider - entry/return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -2559,7 +2559,7 @@ pkcs11Provider::~pkcs11Provider () {
|
||||
int pkcs11Provider::qcaVersion() const
|
||||
{
|
||||
QCA_logTextMessage (
|
||||
"pkcs11Provider::qcaVersion - entry/return",
|
||||
QStringLiteral("pkcs11Provider::qcaVersion - entry/return"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -2568,7 +2568,7 @@ int pkcs11Provider::qcaVersion() const
|
||||
|
||||
void pkcs11Provider::init () {
|
||||
QCA_logTextMessage (
|
||||
"pkcs11Provider::init - entry",
|
||||
QStringLiteral("pkcs11Provider::init - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -2576,11 +2576,11 @@ void pkcs11Provider::init () {
|
||||
CK_RV rv;
|
||||
|
||||
if ((rv = pkcs11h_engine_setCrypto (&pkcs11QCACrypto::crypto)) != CKR_OK) {
|
||||
throw pkcs11Exception (rv, "Cannot set crypto");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Cannot set crypto"));
|
||||
}
|
||||
|
||||
if ((rv = pkcs11h_initialize ()) != CKR_OK) {
|
||||
throw pkcs11Exception (rv, "Cannot initialize");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Cannot initialize"));
|
||||
}
|
||||
|
||||
if (
|
||||
@ -2589,7 +2589,7 @@ void pkcs11Provider::init () {
|
||||
this
|
||||
)) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (rv, "Cannot set hook");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Cannot set hook"));
|
||||
}
|
||||
|
||||
pkcs11h_setLogLevel (0);
|
||||
@ -2600,7 +2600,7 @@ void pkcs11Provider::init () {
|
||||
this
|
||||
)) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (rv, "Cannot set hook");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Cannot set hook"));
|
||||
}
|
||||
|
||||
if (
|
||||
@ -2609,7 +2609,7 @@ void pkcs11Provider::init () {
|
||||
this
|
||||
)) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (rv, "Cannot set hook");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Cannot set hook"));
|
||||
}
|
||||
|
||||
_lowLevelInitialized = true;
|
||||
@ -2624,19 +2624,19 @@ void pkcs11Provider::init () {
|
||||
);
|
||||
}
|
||||
catch (...) {
|
||||
QCA_logTextMessage ("PKCS#11: Unknown error during provider initialization", Logger::Error);
|
||||
appendPluginDiagnosticText ("Unknown error during initialization of qca-pkcs11 plugin\n");
|
||||
QCA_logTextMessage (QStringLiteral("PKCS#11: Unknown error during provider initialization"), Logger::Error);
|
||||
appendPluginDiagnosticText (QStringLiteral("Unknown error during initialization of qca-pkcs11 plugin\n"));
|
||||
}
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11Provider::init - return",
|
||||
QStringLiteral("pkcs11Provider::init - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
|
||||
void pkcs11Provider::deinit () {
|
||||
QCA_logTextMessage (
|
||||
"pkcs11Provider::deinit - entry",
|
||||
QStringLiteral("pkcs11Provider::deinit - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -2646,7 +2646,7 @@ void pkcs11Provider::deinit () {
|
||||
pkcs11h_terminate ();
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11Provider::deinit - return",
|
||||
QStringLiteral("pkcs11Provider::deinit - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -2654,24 +2654,24 @@ void pkcs11Provider::deinit () {
|
||||
QString
|
||||
pkcs11Provider::name () const {
|
||||
QCA_logTextMessage (
|
||||
"pkcs11Provider::name - entry/return",
|
||||
QStringLiteral("pkcs11Provider::name - entry/return"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
return "qca-pkcs11";
|
||||
return QStringLiteral("qca-pkcs11");
|
||||
}
|
||||
|
||||
QStringList
|
||||
pkcs11Provider::features() const {
|
||||
QCA_logTextMessage (
|
||||
"pkcs11Provider::features - entry/return",
|
||||
QStringLiteral("pkcs11Provider::features - entry/return"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
QStringList list;
|
||||
list += "smartcard"; // indicator, not algorithm
|
||||
list += "pkey";
|
||||
list += "keystorelist";
|
||||
list += QStringLiteral("smartcard"); // indicator, not algorithm
|
||||
list += QStringLiteral("pkey");
|
||||
list += QStringLiteral("keystorelist");
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -2689,7 +2689,7 @@ pkcs11Provider::createContext (const QString &type) {
|
||||
);
|
||||
|
||||
if (_lowLevelInitialized) {
|
||||
if (type == "keystorelist") {
|
||||
if (type == QLatin1String("keystorelist")) {
|
||||
if (s_keyStoreList == nullptr) {
|
||||
s_keyStoreList = new pkcs11KeyStoreListContext (this);
|
||||
}
|
||||
@ -2713,7 +2713,7 @@ pkcs11Provider::startSlotEvents () {
|
||||
CK_RV rv;
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11Provider::startSlotEvents - entry",
|
||||
QStringLiteral("pkcs11Provider::startSlotEvents - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -2725,7 +2725,7 @@ pkcs11Provider::startSlotEvents () {
|
||||
this
|
||||
)) != CKR_OK
|
||||
) {
|
||||
throw pkcs11Exception (rv, "Cannot start slot events");
|
||||
throw pkcs11Exception (rv, QStringLiteral("Cannot start slot events"));
|
||||
}
|
||||
|
||||
_slotEventsLowLevelActive = true;
|
||||
@ -2735,7 +2735,7 @@ pkcs11Provider::startSlotEvents () {
|
||||
}
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11Provider::startSlotEvents - return",
|
||||
QStringLiteral("pkcs11Provider::startSlotEvents - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -2743,7 +2743,7 @@ pkcs11Provider::startSlotEvents () {
|
||||
void
|
||||
pkcs11Provider::stopSlotEvents () {
|
||||
QCA_logTextMessage (
|
||||
"pkcs11Provider::stopSlotEvents - entry/return",
|
||||
QStringLiteral("pkcs11Provider::stopSlotEvents - entry/return"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -2755,15 +2755,15 @@ pkcs11Provider::defaultConfig () const {
|
||||
QVariantMap mytemplate;
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11Provider::defaultConfig - entry/return",
|
||||
QStringLiteral("pkcs11Provider::defaultConfig - entry/return"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
mytemplate["formtype"] = "http://affinix.com/qca/forms/qca-pkcs11#1.0";
|
||||
mytemplate["allow_load_rootca"] = false;
|
||||
mytemplate["allow_protected_authentication"] = true;
|
||||
mytemplate["pin_cache"] = PKCS11H_PIN_CACHE_INFINITE;
|
||||
mytemplate["log_level"] = 0;
|
||||
mytemplate[QStringLiteral("formtype")] = "http://affinix.com/qca/forms/qca-pkcs11#1.0";
|
||||
mytemplate[QStringLiteral("allow_load_rootca")] = false;
|
||||
mytemplate[QStringLiteral("allow_protected_authentication")] = true;
|
||||
mytemplate[QStringLiteral("pin_cache")] = PKCS11H_PIN_CACHE_INFINITE;
|
||||
mytemplate[QStringLiteral("log_level")] = 0;
|
||||
for (int i=0;i<_CONFIG_MAX_PROVIDERS;i++) {
|
||||
mytemplate[QString::asprintf ("provider_%02d_enabled", i)] = false;
|
||||
mytemplate[QString::asprintf ("provider_%02d_name", i)] = "";
|
||||
@ -2783,22 +2783,22 @@ pkcs11Provider::configChanged (const QVariantMap &config) {
|
||||
CK_RV rv = CKR_OK;
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11Provider::configChanged - entry",
|
||||
QStringLiteral("pkcs11Provider::configChanged - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
if (!_lowLevelInitialized) {
|
||||
QCA_logTextMessage ("PKCS#11: Not initialized", Logger::Error);
|
||||
QCA_logTextMessage (QStringLiteral("PKCS#11: Not initialized"), Logger::Error);
|
||||
return;
|
||||
}
|
||||
|
||||
_allowLoadRootCA = config["allow_load_rootca"].toBool ();
|
||||
_allowLoadRootCA = config[QStringLiteral("allow_load_rootca")].toBool ();
|
||||
|
||||
pkcs11h_setLogLevel (config["log_level"].toInt ());
|
||||
pkcs11h_setLogLevel (config[QStringLiteral("log_level")].toInt ());
|
||||
pkcs11h_setProtectedAuthentication (
|
||||
config["allow_protected_authentication"].toBool () != false ? TRUE : FALSE //krazy:exclude=captruefalse
|
||||
config[QStringLiteral("allow_protected_authentication")].toBool () != false ? TRUE : FALSE //krazy:exclude=captruefalse
|
||||
);
|
||||
pkcs11h_setPINCachePeriod (config["pin_cache"].toInt ());
|
||||
pkcs11h_setPINCachePeriod (config[QStringLiteral("pin_cache")].toInt ());
|
||||
|
||||
/*
|
||||
* Remove current providers
|
||||
@ -2817,10 +2817,10 @@ pkcs11Provider::configChanged (const QVariantMap &config) {
|
||||
QString name = config[QString::asprintf ("provider_%02d_name", i)].toString ();
|
||||
QString qslotevent = config[QString::asprintf ("provider_%02d_slotevent_method", i)].toString ();
|
||||
unsigned slotevent = PKCS11H_SLOTEVENT_METHOD_AUTO;
|
||||
if (qslotevent == "trigger") {
|
||||
if (qslotevent == QLatin1String("trigger")) {
|
||||
slotevent = PKCS11H_SLOTEVENT_METHOD_TRIGGER;
|
||||
}
|
||||
else if (qslotevent == "poll") {
|
||||
else if (qslotevent == QLatin1String("poll")) {
|
||||
slotevent = PKCS11H_SLOTEVENT_METHOD_POLL;
|
||||
}
|
||||
|
||||
@ -2882,7 +2882,7 @@ pkcs11Provider::configChanged (const QVariantMap &config) {
|
||||
}
|
||||
|
||||
QCA_logTextMessage (
|
||||
"pkcs11Provider::configChanged - return",
|
||||
QStringLiteral("pkcs11Provider::configChanged - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
|
@ -71,13 +71,13 @@ public:
|
||||
static inline QString typeToString (PKey::Type t) {
|
||||
switch (t) {
|
||||
case PKey::RSA:
|
||||
return "rsa";
|
||||
return QStringLiteral("rsa");
|
||||
case PKey::DSA:
|
||||
return "dsa";
|
||||
return QStringLiteral("dsa");
|
||||
case PKey::DH:
|
||||
return "dh";
|
||||
return QStringLiteral("dh");
|
||||
default:
|
||||
return "";
|
||||
return QLatin1String("");
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,9 +85,9 @@ public:
|
||||
const SoftStoreEntry &entry,
|
||||
const QString &serialized,
|
||||
Provider *p
|
||||
) : PKeyBase (p, "rsa"/*typeToString (entry.chain.primary ().subjectPublicKey ().type ())*/) {
|
||||
) : PKeyBase (p, QStringLiteral("rsa")/*typeToString (entry.chain.primary ().subjectPublicKey ().type ())*/) {
|
||||
QCA_logTextMessage (
|
||||
"softstorePKeyBase::softstorePKeyBase1 - entry",
|
||||
QStringLiteral("softstorePKeyBase::softstorePKeyBase1 - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -97,14 +97,14 @@ public:
|
||||
_pubkey = _entry.chain.primary ().subjectPublicKey ();
|
||||
|
||||
QCA_logTextMessage (
|
||||
"softstorePKeyBase::softstorePKeyBase1 - return",
|
||||
QStringLiteral("softstorePKeyBase::softstorePKeyBase1 - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
|
||||
softstorePKeyBase (const softstorePKeyBase &from) : PKeyBase (from.provider (), "rsa"/*typeToString (from._pubkey.type ())*/) {
|
||||
softstorePKeyBase (const softstorePKeyBase &from) : PKeyBase (from.provider (), QStringLiteral("rsa")/*typeToString (from._pubkey.type ())*/) {
|
||||
QCA_logTextMessage (
|
||||
"softstorePKeyBase::softstorePKeyBaseC - entry",
|
||||
QStringLiteral("softstorePKeyBase::softstorePKeyBaseC - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -115,19 +115,19 @@ public:
|
||||
_privkey = from._privkey;
|
||||
|
||||
QCA_logTextMessage (
|
||||
"softstorePKeyBase::softstorePKeyBaseC - return",
|
||||
QStringLiteral("softstorePKeyBase::softstorePKeyBaseC - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
|
||||
~softstorePKeyBase () override {
|
||||
QCA_logTextMessage (
|
||||
"softstorePKeyBase::~softstorePKeyBase - entry",
|
||||
QStringLiteral("softstorePKeyBase::~softstorePKeyBase - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
QCA_logTextMessage (
|
||||
"softstorePKeyBase::~softstorePKeyBase - return",
|
||||
QStringLiteral("softstorePKeyBase::~softstorePKeyBase - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -161,7 +161,7 @@ public:
|
||||
void
|
||||
convertToPublic () override {
|
||||
QCA_logTextMessage (
|
||||
"softstorePKeyBase::convertToPublic - entry",
|
||||
QStringLiteral("softstorePKeyBase::convertToPublic - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -170,7 +170,7 @@ public:
|
||||
}
|
||||
|
||||
QCA_logTextMessage (
|
||||
"softstorePKeyBase::convertToPublic - return",
|
||||
QStringLiteral("softstorePKeyBase::convertToPublic - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -309,14 +309,14 @@ public:
|
||||
bool ret = false;
|
||||
|
||||
QCA_logTextMessage (
|
||||
"softstorePKeyBase::_ensureAccess - entry",
|
||||
QStringLiteral("softstorePKeyBase::_ensureAccess - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
if (_entry.unlockTimeout != -1) {
|
||||
if (dueTime >= QDateTime::currentDateTime ()) {
|
||||
QCA_logTextMessage (
|
||||
"softstorePKeyBase::_ensureAccess - dueTime reached, clearing",
|
||||
QStringLiteral("softstorePKeyBase::_ensureAccess - dueTime reached, clearing"),
|
||||
Logger::Debug
|
||||
);
|
||||
_privkey = PrivateKey ();
|
||||
@ -333,7 +333,7 @@ public:
|
||||
ConvertResult cresult;
|
||||
|
||||
QCA_logTextMessage (
|
||||
"softstorePKeyBase::_ensureAccess - no current key, creating",
|
||||
QStringLiteral("softstorePKeyBase::_ensureAccess - no current key, creating"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -728,21 +728,21 @@ public:
|
||||
_last_id = 0;
|
||||
|
||||
QCA_logTextMessage (
|
||||
"softstoreKeyStoreListContext::softstoreKeyStoreListContext - return",
|
||||
QStringLiteral("softstoreKeyStoreListContext::softstoreKeyStoreListContext - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
|
||||
~softstoreKeyStoreListContext () override {
|
||||
QCA_logTextMessage (
|
||||
"softstoreKeyStoreListContext::~softstoreKeyStoreListContext - entry",
|
||||
QStringLiteral("softstoreKeyStoreListContext::~softstoreKeyStoreListContext - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
s_keyStoreList = nullptr;
|
||||
|
||||
QCA_logTextMessage (
|
||||
"softstoreKeyStoreListContext::~softstoreKeyStoreListContext - return",
|
||||
QStringLiteral("softstoreKeyStoreListContext::~softstoreKeyStoreListContext - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -750,7 +750,7 @@ public:
|
||||
Provider::Context *
|
||||
clone () const override {
|
||||
QCA_logTextMessage (
|
||||
"softstoreKeyStoreListContext::clone - entry/return",
|
||||
QStringLiteral("softstoreKeyStoreListContext::clone - entry/return"),
|
||||
Logger::Debug
|
||||
);
|
||||
return nullptr;
|
||||
@ -760,14 +760,14 @@ public:
|
||||
void
|
||||
start () override {
|
||||
QCA_logTextMessage (
|
||||
"softstoreKeyStoreListContext::start - entry",
|
||||
QStringLiteral("softstoreKeyStoreListContext::start - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
QMetaObject::invokeMethod(this, "doReady", Qt::QueuedConnection);
|
||||
|
||||
QCA_logTextMessage (
|
||||
"softstoreKeyStoreListContext::start - return",
|
||||
QStringLiteral("softstoreKeyStoreListContext::start - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -816,7 +816,7 @@ public:
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
if (serialized.startsWith ("qca-softstore/")) {
|
||||
if (serialized.startsWith (QLatin1String("qca-softstore/"))) {
|
||||
SoftStoreEntry sentry;
|
||||
|
||||
if (_deserializeSoftStoreEntry (serialized, sentry)) {
|
||||
@ -862,7 +862,7 @@ public:
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
ret = "qca-softstore";
|
||||
ret = QStringLiteral("qca-softstore");
|
||||
|
||||
QCA_logTextMessage (
|
||||
QString::asprintf (
|
||||
@ -887,7 +887,7 @@ public:
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
ret = "User Software Store";
|
||||
ret = QStringLiteral("User Software Store");
|
||||
|
||||
QCA_logTextMessage (
|
||||
QString::asprintf (
|
||||
@ -923,7 +923,7 @@ public:
|
||||
QList<int> list;
|
||||
|
||||
QCA_logTextMessage (
|
||||
"softstoreKeyStoreListContext::keyStores - entry",
|
||||
QStringLiteral("softstoreKeyStoreListContext::keyStores - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -984,7 +984,7 @@ public:
|
||||
emit diagnosticText (t);
|
||||
|
||||
QCA_logTextMessage (
|
||||
"softstoreKeyStoreListContext::_emit_diagnosticText - return",
|
||||
QStringLiteral("softstoreKeyStoreListContext::_emit_diagnosticText - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -993,14 +993,14 @@ private Q_SLOTS:
|
||||
void
|
||||
doReady () {
|
||||
QCA_logTextMessage (
|
||||
"softstoreKeyStoreListContext::doReady - entry",
|
||||
QStringLiteral("softstoreKeyStoreListContext::doReady - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
emit busyEnd ();
|
||||
|
||||
QCA_logTextMessage (
|
||||
"softstoreKeyStoreListContext::doReady - return",
|
||||
QStringLiteral("softstoreKeyStoreListContext::doReady - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -1008,14 +1008,14 @@ private Q_SLOTS:
|
||||
void
|
||||
doUpdated () {
|
||||
QCA_logTextMessage (
|
||||
"softstoreKeyStoreListContext::doUpdated - entry",
|
||||
QStringLiteral("softstoreKeyStoreListContext::doUpdated - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
emit updated ();
|
||||
|
||||
QCA_logTextMessage (
|
||||
"softstoreKeyStoreListContext::doUpdated - return",
|
||||
QStringLiteral("softstoreKeyStoreListContext::doUpdated - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -1024,18 +1024,18 @@ public:
|
||||
void
|
||||
_updateConfig (const QVariantMap &config, const int maxEntries) {
|
||||
QCA_logTextMessage (
|
||||
"softstoreKeyStoreListContext::_updateConfig - entry",
|
||||
QStringLiteral("softstoreKeyStoreListContext::_updateConfig - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
QMap<QString, KeyType> keyTypeMap;
|
||||
keyTypeMap["pkcs12"] = keyTypePKCS12;
|
||||
keyTypeMap["pkcs8"] = keyTypePKCS8Inline;
|
||||
keyTypeMap["pkcs8-file-pem"] = keyTypePKCS8FilePEM;
|
||||
keyTypeMap["pkcs8-file-der"] = keyTypePKCS8FileDER;
|
||||
keyTypeMap[QStringLiteral("pkcs12")] = keyTypePKCS12;
|
||||
keyTypeMap[QStringLiteral("pkcs8")] = keyTypePKCS8Inline;
|
||||
keyTypeMap[QStringLiteral("pkcs8-file-pem")] = keyTypePKCS8FilePEM;
|
||||
keyTypeMap[QStringLiteral("pkcs8-file-der")] = keyTypePKCS8FileDER;
|
||||
|
||||
QMap<QString, PublicType> publicTypeMap;
|
||||
publicTypeMap["x509chain"] = publicTypeX509Chain;
|
||||
publicTypeMap[QStringLiteral("x509chain")] = publicTypeX509Chain;
|
||||
|
||||
_last_id++;
|
||||
_entries.clear ();
|
||||
@ -1085,7 +1085,7 @@ public:
|
||||
goto cleanup1;
|
||||
break;
|
||||
case publicTypeX509Chain:
|
||||
QStringList base64certs = config[QString::asprintf ("entry_%02d_public", i)].toString ().split ("!");
|
||||
QStringList base64certs = config[QString::asprintf ("entry_%02d_public", i)].toString ().split (QStringLiteral("!"));
|
||||
|
||||
foreach (const QString &s, base64certs) {
|
||||
entry.chain += Certificate::fromDER (
|
||||
@ -1116,7 +1116,7 @@ public:
|
||||
QMetaObject::invokeMethod(s_keyStoreList, "doUpdated", Qt::QueuedConnection);
|
||||
|
||||
QCA_logTextMessage (
|
||||
"softstoreKeyStoreListContext::_updateConfig - return",
|
||||
QStringLiteral("softstoreKeyStoreListContext::_updateConfig - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
@ -1150,7 +1150,7 @@ private:
|
||||
list += _escapeString (Base64 ().arrayToString (i.toDER ()));
|
||||
}
|
||||
|
||||
serialized.append (list.join ("/"));
|
||||
serialized.append (list.join (QStringLiteral("/")));
|
||||
|
||||
QCA_logTextMessage (
|
||||
QString::asprintf (
|
||||
@ -1180,14 +1180,14 @@ private:
|
||||
|
||||
entry = SoftStoreEntry ();
|
||||
|
||||
QStringList list = serialized.split ("/");
|
||||
QStringList list = serialized.split (QStringLiteral("/"));
|
||||
int n=0;
|
||||
|
||||
if (list.size () < 8) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (list[n++] != "qca-softstore") {
|
||||
if (list[n++] != QLatin1String("qca-softstore")) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1348,19 +1348,19 @@ public:
|
||||
|
||||
QString
|
||||
name () const override {
|
||||
return "qca-softstore";
|
||||
return QStringLiteral("qca-softstore");
|
||||
}
|
||||
|
||||
QStringList
|
||||
features () const override {
|
||||
QCA_logTextMessage (
|
||||
"softstoreProvider::features - entry/return",
|
||||
QStringLiteral("softstoreProvider::features - entry/return"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
QStringList list;
|
||||
list += "pkey";
|
||||
list += "keystorelist";
|
||||
list += QStringLiteral("pkey");
|
||||
list += QStringLiteral("keystorelist");
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -1378,7 +1378,7 @@ public:
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
if (type == "keystorelist") {
|
||||
if (type == QLatin1String("keystorelist")) {
|
||||
if (s_keyStoreList == nullptr) {
|
||||
s_keyStoreList = new softstoreKeyStoreListContext (this);
|
||||
s_keyStoreList->_updateConfig (_config, _CONFIG_MAX_ENTRIES);
|
||||
@ -1402,11 +1402,11 @@ public:
|
||||
QVariantMap mytemplate;
|
||||
|
||||
QCA_logTextMessage (
|
||||
"softstoreProvider::defaultConfig - entry/return",
|
||||
QStringLiteral("softstoreProvider::defaultConfig - entry/return"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
mytemplate["formtype"] = "http://affinix.com/qca/forms/qca-softstore#1.0";
|
||||
mytemplate[QStringLiteral("formtype")] = "http://affinix.com/qca/forms/qca-softstore#1.0";
|
||||
for (int i=0;i<_CONFIG_MAX_ENTRIES;i++) {
|
||||
mytemplate[QString::asprintf ("entry_%02d_enabled", i)] = false;
|
||||
mytemplate[QString::asprintf ("entry_%02d_name", i)] = "";
|
||||
@ -1425,7 +1425,7 @@ public:
|
||||
configChanged (const QVariantMap &config) override {
|
||||
|
||||
QCA_logTextMessage (
|
||||
"softstoreProvider::configChanged - entry",
|
||||
QStringLiteral("softstoreProvider::configChanged - entry"),
|
||||
Logger::Debug
|
||||
);
|
||||
|
||||
@ -1436,7 +1436,7 @@ public:
|
||||
}
|
||||
|
||||
QCA_logTextMessage (
|
||||
"softstoreProvider::configChanged - return",
|
||||
QStringLiteral("softstoreProvider::configChanged - return"),
|
||||
Logger::Debug
|
||||
);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ static void mergeList(QStringList *a, const QStringList &b)
|
||||
static QStringList get_hash_types(Provider *p)
|
||||
{
|
||||
QStringList out;
|
||||
InfoContext *c = static_cast<InfoContext *>(getContext("info", p));
|
||||
InfoContext *c = static_cast<InfoContext *>(getContext(QStringLiteral("info"), p));
|
||||
if(!c)
|
||||
return out;
|
||||
out = c->supportedHashTypes();
|
||||
@ -60,7 +60,7 @@ static QStringList get_hash_types(Provider *p)
|
||||
static QStringList get_cipher_types(Provider *p)
|
||||
{
|
||||
QStringList out;
|
||||
InfoContext *c = static_cast<InfoContext *>(getContext("info", p));
|
||||
InfoContext *c = static_cast<InfoContext *>(getContext(QStringLiteral("info"), p));
|
||||
if(!c)
|
||||
return out;
|
||||
out = c->supportedCipherTypes();
|
||||
@ -71,7 +71,7 @@ static QStringList get_cipher_types(Provider *p)
|
||||
static QStringList get_mac_types(Provider *p)
|
||||
{
|
||||
QStringList out;
|
||||
InfoContext *c = static_cast<InfoContext *>(getContext("info", p));
|
||||
InfoContext *c = static_cast<InfoContext *>(getContext(QStringLiteral("info"), p));
|
||||
if(!c)
|
||||
return out;
|
||||
out = c->supportedMACTypes();
|
||||
@ -116,7 +116,7 @@ static QStringList supportedMACTypes(const QString &provider)
|
||||
// Random
|
||||
//----------------------------------------------------------------------------
|
||||
Random::Random(const QString &provider)
|
||||
:Algorithm("random", provider)
|
||||
:Algorithm(QStringLiteral("random"), provider)
|
||||
{
|
||||
}
|
||||
|
||||
@ -407,25 +407,25 @@ QString Cipher::withAlgorithms(const QString &cipherType, Mode modeType, Padding
|
||||
QString mode;
|
||||
switch(modeType) {
|
||||
case CBC:
|
||||
mode = "cbc";
|
||||
mode = QStringLiteral("cbc");
|
||||
break;
|
||||
case CFB:
|
||||
mode = "cfb";
|
||||
mode = QStringLiteral("cfb");
|
||||
break;
|
||||
case OFB:
|
||||
mode = "ofb";
|
||||
mode = QStringLiteral("ofb");
|
||||
break;
|
||||
case ECB:
|
||||
mode = "ecb";
|
||||
mode = QStringLiteral("ecb");
|
||||
break;
|
||||
case CTR:
|
||||
mode = "ctr";
|
||||
mode = QStringLiteral("ctr");
|
||||
break;
|
||||
case GCM:
|
||||
mode = "gcm";
|
||||
mode = QStringLiteral("gcm");
|
||||
break;
|
||||
case CCM:
|
||||
mode = "ccm";
|
||||
mode = QStringLiteral("ccm");
|
||||
break;
|
||||
default:
|
||||
Q_ASSERT(0);
|
||||
@ -443,13 +443,13 @@ QString Cipher::withAlgorithms(const QString &cipherType, Mode modeType, Padding
|
||||
|
||||
QString pad;
|
||||
if(paddingType == NoPadding)
|
||||
pad = "";
|
||||
pad = QLatin1String("");
|
||||
else
|
||||
pad = "pkcs7";
|
||||
pad = QStringLiteral("pkcs7");
|
||||
|
||||
QString result = cipherType + '-' + mode;
|
||||
if(!pad.isEmpty())
|
||||
result += QString("-") + pad;
|
||||
result += QStringLiteral("-") + pad;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ static bool get_pkcs12_der(const QByteArray &der, const QString &fileName, void
|
||||
QList<CertContext*> list;
|
||||
PKeyContext *kc = nullptr;
|
||||
|
||||
PKCS12Context *pix = static_cast<PKCS12Context *>(getContext("pkcs12", provider));
|
||||
PKCS12Context *pix = static_cast<PKCS12Context *>(getContext(QStringLiteral("pkcs12"), provider));
|
||||
ConvertResult r = pix->fromPKCS12(der, passphrase, &_name, &list, &kc);
|
||||
|
||||
// error converting without passphrase? maybe a passphrase is needed
|
||||
@ -398,9 +398,9 @@ static QString dnLabel(const CertificateInfoType &type)
|
||||
QString id = type.id();
|
||||
// is it an oid?
|
||||
if(id[0].isDigit())
|
||||
return QString("OID.") + id;
|
||||
return QStringLiteral("OID.") + id;
|
||||
|
||||
return QString("qca.") + id;
|
||||
return QStringLiteral("qca.") + id;
|
||||
}
|
||||
|
||||
QString orderedToDNString(const CertificateInfoOrdered &in)
|
||||
@ -414,7 +414,7 @@ QString orderedToDNString(const CertificateInfoOrdered &in)
|
||||
QString name = dnLabel(i.type());
|
||||
parts += name + '=' + i.value();
|
||||
}
|
||||
return parts.join(", ");
|
||||
return parts.join(QStringLiteral(", "));
|
||||
}
|
||||
|
||||
CertificateInfoOrdered orderedDNOnly(const CertificateInfoOrdered &in)
|
||||
@ -435,7 +435,7 @@ static QString baseCertName(const CertificateInfo &info)
|
||||
{
|
||||
str = info.value(Organization);
|
||||
if(str.isEmpty())
|
||||
str = "Unnamed";
|
||||
str = QStringLiteral("Unnamed");
|
||||
}
|
||||
return str;
|
||||
}
|
||||
@ -565,7 +565,7 @@ static QString makeUniqueName(const QList<int> &items, const QStringList &list,
|
||||
str = uniqueSubjectValue(Organization, items, certs, i);
|
||||
if(!str.isEmpty())
|
||||
{
|
||||
name = list[items[i]] + QString(" of ") + str;
|
||||
name = list[items[i]] + QStringLiteral(" of ") + str;
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -573,7 +573,7 @@ static QString makeUniqueName(const QList<int> &items, const QStringList &list,
|
||||
str = uniqueSubjectValue(OrganizationalUnit, items, certs, i);
|
||||
if(!str.isEmpty())
|
||||
{
|
||||
name = list[items[i]] + QString(" of ") + str;
|
||||
name = list[items[i]] + QStringLiteral(" of ") + str;
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -581,7 +581,7 @@ static QString makeUniqueName(const QList<int> &items, const QStringList &list,
|
||||
str = uniqueSubjectValue(Email, items, certs, i);
|
||||
if(!str.isEmpty())
|
||||
{
|
||||
name = list[items[i]] + QString(" <") + str + '>';
|
||||
name = list[items[i]] + QStringLiteral(" <") + str + '>';
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -589,7 +589,7 @@ static QString makeUniqueName(const QList<int> &items, const QStringList &list,
|
||||
str = uniqueSubjectValue(XMPP, items, certs, i);
|
||||
if(!str.isEmpty())
|
||||
{
|
||||
name = list[items[i]] + QString(" <xmpp:") + str + '>';
|
||||
name = list[items[i]] + QStringLiteral(" <xmpp:") + str + '>';
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -597,7 +597,7 @@ static QString makeUniqueName(const QList<int> &items, const QStringList &list,
|
||||
str = uniqueIssuerName(items, certs, i);
|
||||
if(!str.isEmpty())
|
||||
{
|
||||
name = list[items[i]] + QString(" by ") + str;
|
||||
name = list[items[i]] + QStringLiteral(" by ") + str;
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -607,7 +607,7 @@ static QString makeUniqueName(const QList<int> &items, const QStringList &list,
|
||||
str = uniqueConstraintValue(DigitalSignature, items, certs, i);
|
||||
if(!str.isEmpty())
|
||||
{
|
||||
name = list[items[i]] + QString(" for ") + str;
|
||||
name = list[items[i]] + QStringLiteral(" for ") + str;
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -615,7 +615,7 @@ static QString makeUniqueName(const QList<int> &items, const QStringList &list,
|
||||
str = uniqueConstraintValue(ClientAuth, items, certs, i);
|
||||
if(!str.isEmpty())
|
||||
{
|
||||
name = list[items[i]] + QString(" for ") + str;
|
||||
name = list[items[i]] + QStringLiteral(" for ") + str;
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -623,7 +623,7 @@ static QString makeUniqueName(const QList<int> &items, const QStringList &list,
|
||||
str = uniqueConstraintValue(EmailProtection, items, certs, i);
|
||||
if(!str.isEmpty())
|
||||
{
|
||||
name = list[items[i]] + QString(" for ") + str;
|
||||
name = list[items[i]] + QStringLiteral(" for ") + str;
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -631,7 +631,7 @@ static QString makeUniqueName(const QList<int> &items, const QStringList &list,
|
||||
str = uniqueConstraintValue(DataEncipherment, items, certs, i);
|
||||
if(!str.isEmpty())
|
||||
{
|
||||
name = list[items[i]] + QString(" for ") + str;
|
||||
name = list[items[i]] + QStringLiteral(" for ") + str;
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -639,7 +639,7 @@ static QString makeUniqueName(const QList<int> &items, const QStringList &list,
|
||||
str = uniqueConstraintValue(EncipherOnly, items, certs, i);
|
||||
if(!str.isEmpty())
|
||||
{
|
||||
name = list[items[i]] + QString(" for ") + str;
|
||||
name = list[items[i]] + QStringLiteral(" for ") + str;
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -647,7 +647,7 @@ static QString makeUniqueName(const QList<int> &items, const QStringList &list,
|
||||
str = uniqueConstraintValue(DecipherOnly, items, certs, i);
|
||||
if(!str.isEmpty())
|
||||
{
|
||||
name = list[items[i]] + QString(" for ") + str;
|
||||
name = list[items[i]] + QStringLiteral(" for ") + str;
|
||||
goto end;
|
||||
}
|
||||
|
||||
@ -1436,7 +1436,7 @@ Certificate::Certificate(const QString &fileName)
|
||||
Certificate::Certificate(const CertificateOptions &opts, const PrivateKey &key, const QString &provider)
|
||||
:d(new Private)
|
||||
{
|
||||
CertContext *c = static_cast<CertContext *>(getContext("cert", provider));
|
||||
CertContext *c = static_cast<CertContext *>(getContext(QStringLiteral("cert"), provider));
|
||||
if(c->createSelfSigned(opts, *(static_cast<const PKeyContext *>(key.context()))))
|
||||
change(c);
|
||||
else
|
||||
@ -1603,7 +1603,7 @@ bool Certificate::toPEMFile(const QString &fileName) const
|
||||
Certificate Certificate::fromDER(const QByteArray &a, ConvertResult *result, const QString &provider)
|
||||
{
|
||||
Certificate c;
|
||||
CertContext *cc = static_cast<CertContext *>(getContext("cert", provider));
|
||||
CertContext *cc = static_cast<CertContext *>(getContext(QStringLiteral("cert"), provider));
|
||||
ConvertResult r = cc->fromDER(a);
|
||||
if(result)
|
||||
*result = r;
|
||||
@ -1617,7 +1617,7 @@ Certificate Certificate::fromDER(const QByteArray &a, ConvertResult *result, con
|
||||
Certificate Certificate::fromPEM(const QString &s, ConvertResult *result, const QString &provider)
|
||||
{
|
||||
Certificate c;
|
||||
CertContext *cc = static_cast<CertContext *>(getContext("cert", provider));
|
||||
CertContext *cc = static_cast<CertContext *>(getContext(QStringLiteral("cert"), provider));
|
||||
ConvertResult r = cc->fromPEM(s);
|
||||
if(result)
|
||||
*result = r;
|
||||
@ -1819,7 +1819,7 @@ CertificateRequest::CertificateRequest(const QString &fileName)
|
||||
CertificateRequest::CertificateRequest(const CertificateOptions &opts, const PrivateKey &key, const QString &provider)
|
||||
:d(new Private)
|
||||
{
|
||||
CSRContext *c = static_cast<CSRContext *>(getContext("csr", provider));
|
||||
CSRContext *c = static_cast<CSRContext *>(getContext(QStringLiteral("csr"), provider));
|
||||
if(c->createRequest(opts, *(static_cast<const PKeyContext *>(key.context()))))
|
||||
change(c);
|
||||
else
|
||||
@ -1849,7 +1849,7 @@ bool CertificateRequest::isNull() const
|
||||
|
||||
bool CertificateRequest::canUseFormat(CertificateRequestFormat f, const QString &provider)
|
||||
{
|
||||
CSRContext *c = static_cast<CSRContext *>(getContext("csr", provider));
|
||||
CSRContext *c = static_cast<CSRContext *>(getContext(QStringLiteral("csr"), provider));
|
||||
bool ok = c->canUseFormat(f);
|
||||
delete c;
|
||||
return ok;
|
||||
@ -1944,7 +1944,7 @@ bool CertificateRequest::toPEMFile(const QString &fileName) const
|
||||
CertificateRequest CertificateRequest::fromDER(const QByteArray &a, ConvertResult *result, const QString &provider)
|
||||
{
|
||||
CertificateRequest c;
|
||||
CSRContext *csr = static_cast<CSRContext *>(getContext("csr", provider));
|
||||
CSRContext *csr = static_cast<CSRContext *>(getContext(QStringLiteral("csr"), provider));
|
||||
ConvertResult r = csr->fromDER(a);
|
||||
if(result)
|
||||
*result = r;
|
||||
@ -1958,7 +1958,7 @@ CertificateRequest CertificateRequest::fromDER(const QByteArray &a, ConvertResul
|
||||
CertificateRequest CertificateRequest::fromPEM(const QString &s, ConvertResult *result, const QString &provider)
|
||||
{
|
||||
CertificateRequest c;
|
||||
CSRContext *csr = static_cast<CSRContext *>(getContext("csr", provider));
|
||||
CSRContext *csr = static_cast<CSRContext *>(getContext(QStringLiteral("csr"), provider));
|
||||
ConvertResult r = csr->fromPEM(s);
|
||||
if(result)
|
||||
*result = r;
|
||||
@ -1989,7 +1989,7 @@ QString CertificateRequest::toString() const
|
||||
CertificateRequest CertificateRequest::fromString(const QString &s, ConvertResult *result, const QString &provider)
|
||||
{
|
||||
CertificateRequest c;
|
||||
CSRContext *csr = static_cast<CSRContext *>(getContext("csr", provider));
|
||||
CSRContext *csr = static_cast<CSRContext *>(getContext(QStringLiteral("csr"), provider));
|
||||
ConvertResult r = csr->fromSPKAC(s);
|
||||
if(result)
|
||||
*result = r;
|
||||
@ -2209,7 +2209,7 @@ bool CRL::operator==(const CRL &otherCrl) const
|
||||
CRL CRL::fromDER(const QByteArray &a, ConvertResult *result, const QString &provider)
|
||||
{
|
||||
CRL c;
|
||||
CRLContext *cc = static_cast<CRLContext *>(getContext("crl", provider));
|
||||
CRLContext *cc = static_cast<CRLContext *>(getContext(QStringLiteral("crl"), provider));
|
||||
ConvertResult r = cc->fromDER(a);
|
||||
if(result)
|
||||
*result = r;
|
||||
@ -2223,7 +2223,7 @@ CRL CRL::fromDER(const QByteArray &a, ConvertResult *result, const QString &prov
|
||||
CRL CRL::fromPEM(const QString &s, ConvertResult *result, const QString &provider)
|
||||
{
|
||||
CRL c;
|
||||
CRLContext *cc = static_cast<CRLContext *>(getContext("crl", provider));
|
||||
CRLContext *cc = static_cast<CRLContext *>(getContext(QStringLiteral("crl"), provider));
|
||||
ConvertResult r = cc->fromPEM(s);
|
||||
if(result)
|
||||
*result = r;
|
||||
@ -2273,15 +2273,15 @@ static QString readNextPem(QTextStream *ts, bool *isCRL)
|
||||
QString line = ts->readLine();
|
||||
if(!found)
|
||||
{
|
||||
if(line.startsWith("-----BEGIN "))
|
||||
if(line.startsWith(QLatin1String("-----BEGIN ")))
|
||||
{
|
||||
if(line.contains("CERTIFICATE"))
|
||||
if(line.contains(QLatin1String("CERTIFICATE")))
|
||||
{
|
||||
found = true;
|
||||
pem += line + '\n';
|
||||
crl = false;
|
||||
}
|
||||
else if(line.contains("CRL"))
|
||||
else if(line.contains(QLatin1String("CRL")))
|
||||
{
|
||||
found = true;
|
||||
pem += line + '\n';
|
||||
@ -2292,7 +2292,7 @@ static QString readNextPem(QTextStream *ts, bool *isCRL)
|
||||
else
|
||||
{
|
||||
pem += line + '\n';
|
||||
if(line.startsWith("-----END "))
|
||||
if(line.startsWith(QLatin1String("-----END ")))
|
||||
{
|
||||
done = true;
|
||||
break;
|
||||
@ -2394,7 +2394,7 @@ bool CertificateCollection::toFlatTextFile(const QString &fileName)
|
||||
|
||||
bool CertificateCollection::toPKCS7File(const QString &fileName, const QString &provider)
|
||||
{
|
||||
CertCollectionContext *col = static_cast<CertCollectionContext *>(getContext("certcollection", provider));
|
||||
CertCollectionContext *col = static_cast<CertCollectionContext *>(getContext(QStringLiteral("certcollection"), provider));
|
||||
|
||||
QList<CertContext*> cert_list;
|
||||
QList<CRLContext*> crl_list;
|
||||
@ -2468,7 +2468,7 @@ CertificateCollection CertificateCollection::fromPKCS7File(const QString &fileNa
|
||||
|
||||
QList<CertContext*> cert_list;
|
||||
QList<CRLContext*> crl_list;
|
||||
CertCollectionContext *col = static_cast<CertCollectionContext *>(getContext("certcollection", provider));
|
||||
CertCollectionContext *col = static_cast<CertCollectionContext *>(getContext(QStringLiteral("certcollection"), provider));
|
||||
ConvertResult r = col->fromPKCS7(der, &cert_list, &crl_list);
|
||||
delete col;
|
||||
|
||||
@ -2497,7 +2497,7 @@ CertificateCollection CertificateCollection::fromPKCS7File(const QString &fileNa
|
||||
// CertificateAuthority
|
||||
//----------------------------------------------------------------------------
|
||||
CertificateAuthority::CertificateAuthority(const Certificate &cert, const PrivateKey &key, const QString &provider)
|
||||
:Algorithm("ca", provider)
|
||||
:Algorithm(QStringLiteral("ca"), provider)
|
||||
{
|
||||
static_cast<CAContext *>(context())->setup(*(static_cast<const CertContext *>(cert.context())), *(static_cast<const PKeyContext *>(key.context())));
|
||||
}
|
||||
@ -2621,7 +2621,7 @@ void KeyBundle::setCertificateChainAndKey(const CertificateChain &c, const Priva
|
||||
|
||||
QByteArray KeyBundle::toArray(const SecureArray &passphrase, const QString &provider) const
|
||||
{
|
||||
PKCS12Context *pix = static_cast<PKCS12Context *>(getContext("pkcs12", provider));
|
||||
PKCS12Context *pix = static_cast<PKCS12Context *>(getContext(QStringLiteral("pkcs12"), provider));
|
||||
|
||||
QList<const CertContext*> list;
|
||||
for(int n = 0; n < d->chain.count(); ++n)
|
||||
@ -2754,7 +2754,7 @@ bool PGPKey::toFile(const QString &fileName) const
|
||||
PGPKey PGPKey::fromArray(const QByteArray &a, ConvertResult *result, const QString &provider)
|
||||
{
|
||||
PGPKey k;
|
||||
PGPKeyContext *kc = static_cast<PGPKeyContext *>(getContext("pgpkey", provider));
|
||||
PGPKeyContext *kc = static_cast<PGPKeyContext *>(getContext(QStringLiteral("pgpkey"), provider));
|
||||
ConvertResult r = kc->fromBinary(a);
|
||||
if(result)
|
||||
*result = r;
|
||||
@ -2768,7 +2768,7 @@ PGPKey PGPKey::fromArray(const QByteArray &a, ConvertResult *result, const QStri
|
||||
PGPKey PGPKey::fromString(const QString &s, ConvertResult *result, const QString &provider)
|
||||
{
|
||||
PGPKey k;
|
||||
PGPKeyContext *kc = static_cast<PGPKeyContext *>(getContext("pgpkey", provider));
|
||||
PGPKeyContext *kc = static_cast<PGPKeyContext *>(getContext(QStringLiteral("pgpkey"), provider));
|
||||
ConvertResult r = kc->fromAscii(s);
|
||||
if(result)
|
||||
*result = r;
|
||||
|
@ -178,7 +178,7 @@ public:
|
||||
|
||||
// if the global_rng was owned by a plugin, then delete it
|
||||
rng_mutex.lock();
|
||||
if(rng && (rng->provider() != manager->find("default")))
|
||||
if(rng && (rng->provider() != manager->find(QStringLiteral("default"))))
|
||||
{
|
||||
delete rng;
|
||||
rng = nullptr;
|
||||
@ -321,7 +321,7 @@ bool haveSecureRandom()
|
||||
return false;
|
||||
|
||||
QMutexLocker locker(global_random_mutex());
|
||||
if(global_random()->provider()->name() != "default")
|
||||
if(global_random()->provider()->name() != QLatin1String("default"))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
@ -352,7 +352,7 @@ bool isSupported(const QStringList &features, const QString &provider)
|
||||
if(features_have(global->manager->allFeatures(), features))
|
||||
return true;
|
||||
|
||||
global->manager->appendDiagnosticText(QString("Scanning to find features: %1\n").arg(features.join(" ")));
|
||||
global->manager->appendDiagnosticText(QStringLiteral("Scanning to find features: %1\n").arg(features.join(QStringLiteral(" "))));
|
||||
|
||||
// ok, try scanning for new stuff
|
||||
global->scan();
|
||||
@ -383,7 +383,7 @@ QStringList defaultFeatures()
|
||||
if(!global_check_load())
|
||||
return QStringList();
|
||||
|
||||
return global->manager->find("default")->features();
|
||||
return global->manager->find(QStringLiteral("default"))->features();
|
||||
}
|
||||
|
||||
ProviderList providers()
|
||||
@ -451,7 +451,7 @@ Provider *defaultProvider()
|
||||
if(!global_check_load())
|
||||
return nullptr;
|
||||
|
||||
return global->manager->find("default");
|
||||
return global->manager->find(QStringLiteral("default"));
|
||||
}
|
||||
|
||||
QStringList pluginPaths()
|
||||
@ -478,7 +478,7 @@ QStringList pluginPaths()
|
||||
#endif
|
||||
// In developer mode load plugins only from buildtree.
|
||||
// In regular mode QCA_PLUGIN_PATH is path where plugins was installed
|
||||
paths << QDir(QCA_PLUGIN_PATH).canonicalPath();
|
||||
paths << QDir(QStringLiteral(QCA_PLUGIN_PATH)).canonicalPath();
|
||||
#ifndef DEVELOPER_MODE
|
||||
paths.removeDuplicates();
|
||||
#endif
|
||||
@ -550,7 +550,7 @@ QVariant getProperty(const QString &name)
|
||||
|
||||
static bool configIsValid(const QVariantMap &config)
|
||||
{
|
||||
if(!config.contains("formtype"))
|
||||
if(!config.contains(QStringLiteral("formtype")))
|
||||
return false;
|
||||
QMapIterator<QString,QVariant> it(config);
|
||||
while(it.hasNext())
|
||||
@ -565,9 +565,9 @@ static bool configIsValid(const QVariantMap &config)
|
||||
|
||||
static QVariantMap readConfig(const QString &name)
|
||||
{
|
||||
QSettings settings("Affinix", "QCA2");
|
||||
settings.beginGroup("ProviderConfig");
|
||||
QStringList providerNames = settings.value("providerNames").toStringList();
|
||||
QSettings settings(QStringLiteral("Affinix"), QStringLiteral("QCA2"));
|
||||
settings.beginGroup(QStringLiteral("ProviderConfig"));
|
||||
QStringList providerNames = settings.value(QStringLiteral("providerNames")).toStringList();
|
||||
if(!providerNames.contains(name))
|
||||
return QVariantMap();
|
||||
|
||||
@ -585,17 +585,17 @@ static QVariantMap readConfig(const QString &name)
|
||||
|
||||
static bool writeConfig(const QString &name, const QVariantMap &config, bool systemWide = false)
|
||||
{
|
||||
QSettings settings(QSettings::NativeFormat, systemWide ? QSettings::SystemScope : QSettings::UserScope, "Affinix", "QCA2");
|
||||
settings.beginGroup("ProviderConfig");
|
||||
QSettings settings(QSettings::NativeFormat, systemWide ? QSettings::SystemScope : QSettings::UserScope, QStringLiteral("Affinix"), QStringLiteral("QCA2"));
|
||||
settings.beginGroup(QStringLiteral("ProviderConfig"));
|
||||
|
||||
// version
|
||||
settings.setValue("version", 2);
|
||||
settings.setValue(QStringLiteral("version"), 2);
|
||||
|
||||
// add the entry if needed
|
||||
QStringList providerNames = settings.value("providerNames").toStringList();
|
||||
QStringList providerNames = settings.value(QStringLiteral("providerNames")).toStringList();
|
||||
if(!providerNames.contains(name))
|
||||
providerNames += name;
|
||||
settings.setValue("providerNames", providerNames);
|
||||
settings.setValue(QStringLiteral("providerNames"), providerNames);
|
||||
|
||||
settings.beginGroup(name);
|
||||
QMapIterator<QString,QVariant> it(config);
|
||||
@ -661,7 +661,7 @@ QVariantMap getProviderConfig(const QString &name)
|
||||
|
||||
// if the config formtype doesn't match the provider's formtype,
|
||||
// then use the provider's
|
||||
if(pconf["formtype"] != conf["formtype"])
|
||||
if(pconf[QStringLiteral("formtype")] != conf[QStringLiteral("formtype")])
|
||||
return pconf;
|
||||
|
||||
// otherwise, use the config loaded
|
||||
@ -710,7 +710,7 @@ QVariantMap getProviderConfig_internal(Provider *p)
|
||||
|
||||
// if the config formtype doesn't match the provider's formtype,
|
||||
// then use the provider's
|
||||
if(pconf["formtype"] != conf["formtype"])
|
||||
if(pconf[QStringLiteral("formtype")] != conf[QStringLiteral("formtype")])
|
||||
return pconf;
|
||||
|
||||
// otherwise, use the config loaded
|
||||
@ -738,7 +738,7 @@ Logger *logger()
|
||||
bool haveSystemStore()
|
||||
{
|
||||
// ensure the system store is loaded
|
||||
KeyStoreManager::start("default");
|
||||
KeyStoreManager::start(QStringLiteral("default"));
|
||||
KeyStoreManager ksm;
|
||||
ksm.waitForBusyFinished();
|
||||
|
||||
@ -755,7 +755,7 @@ bool haveSystemStore()
|
||||
CertificateCollection systemStore()
|
||||
{
|
||||
// ensure the system store is loaded
|
||||
KeyStoreManager::start("default");
|
||||
KeyStoreManager::start(QStringLiteral("default"));
|
||||
KeyStoreManager ksm;
|
||||
ksm.waitForBusyFinished();
|
||||
|
||||
|
@ -504,7 +504,7 @@ class DefaultMD5Context : public HashContext
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
DefaultMD5Context(Provider *p) : HashContext(p, "md5")
|
||||
DefaultMD5Context(Provider *p) : HashContext(p, QStringLiteral("md5"))
|
||||
{
|
||||
clear();
|
||||
}
|
||||
@ -599,7 +599,7 @@ public:
|
||||
#endif
|
||||
bool secure;
|
||||
|
||||
DefaultSHA1Context(Provider *p) : HashContext(p, "sha1")
|
||||
DefaultSHA1Context(Provider *p) : HashContext(p, QStringLiteral("sha1"))
|
||||
{
|
||||
clear();
|
||||
}
|
||||
@ -780,13 +780,13 @@ static QString escape_string(const QString &in)
|
||||
for(const QChar &c : in)
|
||||
{
|
||||
if(c == '\\')
|
||||
out += "\\\\";
|
||||
out += QLatin1String("\\\\");
|
||||
else if(c == ':')
|
||||
out += "\\c";
|
||||
out += QLatin1String("\\c");
|
||||
else if(c == ',')
|
||||
out += "\\o";
|
||||
out += QLatin1String("\\o");
|
||||
else if(c == '\n')
|
||||
out += "\\n";
|
||||
out += QLatin1String("\\n");
|
||||
else
|
||||
out += c;
|
||||
}
|
||||
@ -827,7 +827,7 @@ static QString escape_stringlist(const QStringList &in)
|
||||
QStringList list;
|
||||
for(int n = 0; n < in.count(); ++n)
|
||||
list += escape_string(in[n]);
|
||||
return list.join(":");
|
||||
return list.join(QStringLiteral(":"));
|
||||
}
|
||||
|
||||
static bool unescape_stringlist(const QString &in, QStringList *_out)
|
||||
@ -856,7 +856,7 @@ static bool unescape_stringlist(const QString &in, QStringList *_out)
|
||||
static QString entry_serialize(const QString &storeId, const QString &storeName, const QString &entryId, const QString &entryName, const QString &entryType, const QString &data)
|
||||
{
|
||||
QStringList out;
|
||||
out += "qca_def";
|
||||
out += QStringLiteral("qca_def");
|
||||
out += storeId;
|
||||
out += storeName;
|
||||
out += entryId;
|
||||
@ -873,7 +873,7 @@ static bool entry_deserialize(const QString &in, QString *storeId, QString *stor
|
||||
return false;
|
||||
if(list.count() != 7)
|
||||
return false;
|
||||
if(list[0] != "qca_def")
|
||||
if(list[0] != QLatin1String("qca_def"))
|
||||
return false;
|
||||
*storeId = list[1];
|
||||
*storeName = list[2];
|
||||
@ -959,12 +959,12 @@ public:
|
||||
|
||||
if(_type == KeyStoreEntry::TypeCertificate)
|
||||
{
|
||||
typestr = "cert";
|
||||
typestr = QStringLiteral("cert");
|
||||
datastr = Base64().arrayToString(_cert.toDER());
|
||||
}
|
||||
else
|
||||
{
|
||||
typestr = "crl";
|
||||
typestr = QStringLiteral("crl");
|
||||
datastr = Base64().arrayToString(_crl.toDER());
|
||||
}
|
||||
|
||||
@ -983,14 +983,14 @@ public:
|
||||
QByteArray data = Base64().stringToArray(datastr).toByteArray();
|
||||
DefaultKeyStoreEntry *c;
|
||||
|
||||
if(typestr == "cert")
|
||||
if(typestr == QLatin1String("cert"))
|
||||
{
|
||||
Certificate cert = Certificate::fromDER(data);
|
||||
if(cert.isNull())
|
||||
return nullptr;
|
||||
c = new DefaultKeyStoreEntry(cert, storeId, storeName, provider);
|
||||
}
|
||||
else if(typestr == "crl")
|
||||
else if(typestr == QLatin1String("crl"))
|
||||
{
|
||||
CRL crl = CRL::fromDER(data);
|
||||
if(crl.isNull())
|
||||
@ -1092,12 +1092,12 @@ public:
|
||||
|
||||
QString storeId(int) const override
|
||||
{
|
||||
return "qca-default-systemstore";
|
||||
return QStringLiteral("qca-default-systemstore");
|
||||
}
|
||||
|
||||
QString name(int) const override
|
||||
{
|
||||
return "System Trusted Certificates";
|
||||
return QStringLiteral("System Trusted Certificates");
|
||||
}
|
||||
|
||||
QList<KeyStoreEntry::Type> entryTypes(int) const override
|
||||
@ -1210,28 +1210,28 @@ public:
|
||||
|
||||
QString name() const override
|
||||
{
|
||||
return "default";
|
||||
return QStringLiteral("default");
|
||||
}
|
||||
|
||||
QStringList features() const override
|
||||
{
|
||||
QStringList list;
|
||||
list += "random";
|
||||
list += "md5";
|
||||
list += "sha1";
|
||||
list += "keystorelist";
|
||||
list += QStringLiteral("random");
|
||||
list += QStringLiteral("md5");
|
||||
list += QStringLiteral("sha1");
|
||||
list += QStringLiteral("keystorelist");
|
||||
return list;
|
||||
}
|
||||
|
||||
Provider::Context *createContext(const QString &type) override
|
||||
{
|
||||
if(type == "random")
|
||||
if(type == QLatin1String("random"))
|
||||
return new DefaultRandomContext(this);
|
||||
else if(type == "md5")
|
||||
else if(type == QLatin1String("md5"))
|
||||
return new DefaultMD5Context(this);
|
||||
else if(type == "sha1")
|
||||
else if(type == QLatin1String("sha1"))
|
||||
return new DefaultSHA1Context(this);
|
||||
else if(type == "keystorelist")
|
||||
else if(type == QLatin1String("keystorelist"))
|
||||
return new DefaultKeyStoreList(this, &shared);
|
||||
else
|
||||
return nullptr;
|
||||
@ -1240,20 +1240,20 @@ public:
|
||||
QVariantMap defaultConfig() const override
|
||||
{
|
||||
QVariantMap config;
|
||||
config["formtype"] = "http://affinix.com/qca/forms/default#1.0";
|
||||
config["use_system"] = true;
|
||||
config["roots_file"] = QString();
|
||||
config["skip_plugins"] = QString();
|
||||
config["plugin_priorities"] = QString();
|
||||
config[QStringLiteral("formtype")] = "http://affinix.com/qca/forms/default#1.0";
|
||||
config[QStringLiteral("use_system")] = true;
|
||||
config[QStringLiteral("roots_file")] = QString();
|
||||
config[QStringLiteral("skip_plugins")] = QString();
|
||||
config[QStringLiteral("plugin_priorities")] = QString();
|
||||
return config;
|
||||
}
|
||||
|
||||
void configChanged(const QVariantMap &config) override
|
||||
{
|
||||
bool use_system = config["use_system"].toBool();
|
||||
QString roots_file = config["roots_file"].toString();
|
||||
QString skip_plugins_str = config["skip_plugins"].toString();
|
||||
QString plugin_priorities_str = config["plugin_priorities"].toString();
|
||||
bool use_system = config[QStringLiteral("use_system")].toBool();
|
||||
QString roots_file = config[QStringLiteral("roots_file")].toString();
|
||||
QString skip_plugins_str = config[QStringLiteral("skip_plugins")].toString();
|
||||
QString plugin_priorities_str = config[QStringLiteral("plugin_priorities")].toString();
|
||||
|
||||
QStringList tmp;
|
||||
|
||||
|
@ -111,8 +111,8 @@ public:
|
||||
, updateCount(0)
|
||||
, owner(nullptr)
|
||||
, storeContextId(-1)
|
||||
, storeId("")
|
||||
, name("")
|
||||
, storeId(QLatin1String(""))
|
||||
, name(QLatin1String(""))
|
||||
, type(KeyStore::System)
|
||||
, isReadOnly(false)
|
||||
{
|
||||
@ -211,7 +211,7 @@ public Q_SLOTS:
|
||||
for(int n = 0; n < list.count(); ++n)
|
||||
{
|
||||
Provider *p = list[n];
|
||||
if(p->features().contains("keystorelist") && !haveProviderSource(p))
|
||||
if(p->features().contains(QStringLiteral("keystorelist")) && !haveProviderSource(p))
|
||||
startProvider(p);
|
||||
}
|
||||
|
||||
@ -234,7 +234,7 @@ public Q_SLOTS:
|
||||
}
|
||||
}
|
||||
|
||||
if(p && p->features().contains("keystorelist") && !haveProviderSource(p))
|
||||
if(p && p->features().contains(QStringLiteral("keystorelist")) && !haveProviderSource(p))
|
||||
startProvider(p);
|
||||
}
|
||||
|
||||
@ -408,7 +408,7 @@ private:
|
||||
|
||||
void startProvider(Provider *p)
|
||||
{
|
||||
KeyStoreListContext *c = static_cast<KeyStoreListContext *>(getContext("keystorelist", p));
|
||||
KeyStoreListContext *c = static_cast<KeyStoreListContext *>(getContext(QStringLiteral("keystorelist"), p));
|
||||
if(!c)
|
||||
return;
|
||||
|
||||
@ -422,7 +422,7 @@ private:
|
||||
c->start();
|
||||
c->setUpdatesEnabled(true);
|
||||
|
||||
QCA_logTextMessage(QString("keystore: startProvider %1").arg(p->name()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("keystore: startProvider %1").arg(p->name()), Logger::Information);
|
||||
}
|
||||
|
||||
bool updateStores(KeyStoreListContext *c)
|
||||
@ -438,7 +438,7 @@ private:
|
||||
{
|
||||
if(items[n].owner == c && !keyStores.contains(items[n].storeContextId))
|
||||
{
|
||||
QCA_logTextMessage(QString("keystore: updateStores remove %1").arg(items[n].storeContextId), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("keystore: updateStores remove %1").arg(items[n].storeContextId), Logger::Information);
|
||||
|
||||
items.removeAt(n);
|
||||
--n; // adjust position
|
||||
@ -470,7 +470,7 @@ private:
|
||||
bool isReadOnly = c->isReadOnly(id);
|
||||
if(i.name != name || i.isReadOnly != isReadOnly)
|
||||
{
|
||||
QCA_logTextMessage(QString("keystore: updateStores update %1").arg(id), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("keystore: updateStores update %1").arg(id), Logger::Information);
|
||||
i.name = name;
|
||||
i.isReadOnly = isReadOnly;
|
||||
changed = true;
|
||||
@ -479,7 +479,7 @@ private:
|
||||
// otherwise, add it
|
||||
else
|
||||
{
|
||||
QCA_logTextMessage(QString("keystore: updateStores add %1").arg(id), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("keystore: updateStores add %1").arg(id), Logger::Information);
|
||||
|
||||
Item i;
|
||||
i.trackerId = tracker_id_at++;
|
||||
@ -504,13 +504,13 @@ private Q_SLOTS:
|
||||
{
|
||||
KeyStoreListContext *c = (KeyStoreListContext *)sender();
|
||||
|
||||
QCA_logTextMessage(QString("keystore: ksl_busyStart %1").arg(c->provider()->name()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("keystore: ksl_busyStart %1").arg(c->provider()->name()), Logger::Information);
|
||||
|
||||
if(!busySources.contains(c))
|
||||
{
|
||||
busySources += c;
|
||||
|
||||
QCA_logTextMessage(QString("keystore: emitting updated"), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("keystore: emitting updated"), Logger::Information);
|
||||
emit updated_p();
|
||||
}
|
||||
}
|
||||
@ -519,7 +519,7 @@ private Q_SLOTS:
|
||||
{
|
||||
KeyStoreListContext *c = (KeyStoreListContext *)sender();
|
||||
|
||||
QCA_logTextMessage(QString("keystore: ksl_busyEnd %1").arg(c->provider()->name()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("keystore: ksl_busyEnd %1").arg(c->provider()->name()), Logger::Information);
|
||||
|
||||
busySources.remove(c);
|
||||
bool changed = updateStores(c);
|
||||
@ -534,7 +534,7 @@ private Q_SLOTS:
|
||||
|
||||
if(!any_busy || changed)
|
||||
{
|
||||
QCA_logTextMessage(QString("keystore: emitting updated"), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("keystore: emitting updated"), Logger::Information);
|
||||
emit updated_p();
|
||||
}
|
||||
}
|
||||
@ -543,12 +543,12 @@ private Q_SLOTS:
|
||||
{
|
||||
KeyStoreListContext *c = (KeyStoreListContext *)sender();
|
||||
|
||||
QCA_logTextMessage(QString("keystore: ksl_updated %1").arg(c->provider()->name()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("keystore: ksl_updated %1").arg(c->provider()->name()), Logger::Information);
|
||||
|
||||
bool changed = updateStores(c);
|
||||
if(changed)
|
||||
{
|
||||
QCA_logTextMessage(QString("keystore: emitting updated"), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("keystore: emitting updated"), Logger::Information);
|
||||
emit updated_p();
|
||||
}
|
||||
}
|
||||
@ -564,7 +564,7 @@ private Q_SLOTS:
|
||||
{
|
||||
KeyStoreListContext *c = (KeyStoreListContext *)sender();
|
||||
|
||||
QCA_logTextMessage(QString("keystore: ksl_storeUpdated %1 %2").arg(c->provider()->name(), QString::number(id)), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("keystore: ksl_storeUpdated %1 %2").arg(c->provider()->name(), QString::number(id)), Logger::Information);
|
||||
|
||||
QMutexLocker locker(&m);
|
||||
for(int n = 0; n < items.count(); ++n)
|
||||
@ -574,9 +574,9 @@ private Q_SLOTS:
|
||||
{
|
||||
++i.updateCount;
|
||||
|
||||
QCA_logTextMessage(QString("keystore: %1 updateCount = %2").arg(i.name, QString::number(i.updateCount)), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("keystore: %1 updateCount = %2").arg(i.name, QString::number(i.updateCount)), Logger::Information);
|
||||
|
||||
QCA_logTextMessage(QString("keystore: emitting updated"), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("keystore: emitting updated"), Logger::Information);
|
||||
emit updated_p();
|
||||
return;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <QLibrary>
|
||||
#include <QPluginLoader>
|
||||
|
||||
#define PLUGIN_SUBDIR "crypto"
|
||||
#define PLUGIN_SUBDIR QStringLiteral("crypto")
|
||||
|
||||
namespace QCA {
|
||||
|
||||
@ -110,7 +110,7 @@ public:
|
||||
if(!loader->load())
|
||||
{
|
||||
if(errstr)
|
||||
*errstr = QString("failed to load: %1").arg(loader->errorString());
|
||||
*errstr = QStringLiteral("failed to load: %1").arg(loader->errorString());
|
||||
delete loader;
|
||||
return nullptr;
|
||||
}
|
||||
@ -118,7 +118,7 @@ public:
|
||||
if(!obj)
|
||||
{
|
||||
if(errstr)
|
||||
*errstr = "failed to get instance";
|
||||
*errstr = QStringLiteral("failed to get instance");
|
||||
loader->unload();
|
||||
delete loader;
|
||||
return nullptr;
|
||||
@ -199,7 +199,7 @@ public:
|
||||
if(!plugin)
|
||||
{
|
||||
if(out_errstr)
|
||||
*out_errstr = "does not offer QCAPlugin interface";
|
||||
*out_errstr = QStringLiteral("does not offer QCAPlugin interface");
|
||||
delete i;
|
||||
return nullptr;
|
||||
}
|
||||
@ -208,7 +208,7 @@ public:
|
||||
if(!p)
|
||||
{
|
||||
if(out_errstr)
|
||||
*out_errstr = "unable to create provider";
|
||||
*out_errstr = QStringLiteral("unable to create provider");
|
||||
delete i;
|
||||
return nullptr;
|
||||
}
|
||||
@ -225,7 +225,7 @@ public:
|
||||
if(!plugin)
|
||||
{
|
||||
if(errstr)
|
||||
*errstr = "does not offer QCAPlugin interface";
|
||||
*errstr = QStringLiteral("does not offer QCAPlugin interface");
|
||||
delete i;
|
||||
return nullptr;
|
||||
}
|
||||
@ -234,7 +234,7 @@ public:
|
||||
if(!p)
|
||||
{
|
||||
if(errstr)
|
||||
*errstr = "unable to create provider";
|
||||
*errstr = QStringLiteral("unable to create provider");
|
||||
delete i;
|
||||
return nullptr;
|
||||
}
|
||||
@ -323,10 +323,10 @@ void ProviderManager::scan()
|
||||
// check static first, but only once
|
||||
if(!scanned_static)
|
||||
{
|
||||
logDebug("Checking Qt static plugins:");
|
||||
logDebug(QStringLiteral("Checking Qt static plugins:"));
|
||||
QObjectList list = QPluginLoader::staticInstances();
|
||||
if(list.isEmpty())
|
||||
logDebug(" (none)");
|
||||
logDebug(QStringLiteral(" (none)"));
|
||||
for(int n = 0; n < list.count(); ++n)
|
||||
{
|
||||
QObject *instance = list[n];
|
||||
@ -336,14 +336,14 @@ void ProviderManager::scan()
|
||||
ProviderItem *i = ProviderItem::loadStatic(instance, &errstr);
|
||||
if(!i)
|
||||
{
|
||||
logDebug(QString(" %1: %2").arg(className, errstr));
|
||||
logDebug(QStringLiteral(" %1: %2").arg(className, errstr));
|
||||
continue;
|
||||
}
|
||||
|
||||
QString providerName = i->p->name();
|
||||
if(haveAlready(providerName))
|
||||
{
|
||||
logDebug(QString(" %1: (as %2) already loaded provider, skipping").arg(className, providerName));
|
||||
logDebug(QStringLiteral(" %1: (as %2) already loaded provider, skipping").arg(className, providerName));
|
||||
delete i;
|
||||
continue;
|
||||
}
|
||||
@ -352,13 +352,13 @@ void ProviderManager::scan()
|
||||
if(!validVersion(ver))
|
||||
{
|
||||
errstr = QString::asprintf("plugin version 0x%06x is in the future", ver);
|
||||
logDebug(QString(" %1: (as %2) %3").arg(className, providerName, errstr));
|
||||
logDebug(QStringLiteral(" %1: (as %2) %3").arg(className, providerName, errstr));
|
||||
delete i;
|
||||
continue;
|
||||
}
|
||||
|
||||
addItem(i, get_default_priority(providerName));
|
||||
logDebug(QString(" %1: loaded as %2").arg(className, providerName));
|
||||
logDebug(QStringLiteral(" %1: loaded as %2").arg(className, providerName));
|
||||
}
|
||||
scanned_static = true;
|
||||
}
|
||||
@ -369,26 +369,26 @@ void ProviderManager::scan()
|
||||
|
||||
const QStringList dirs = pluginPaths();
|
||||
if(dirs.isEmpty())
|
||||
logDebug("No Qt Library Paths");
|
||||
logDebug(QStringLiteral("No Qt Library Paths"));
|
||||
for(const QString &dirIt : dirs)
|
||||
{
|
||||
#ifdef DEVELOPER_MODE
|
||||
logDebug(QString("Checking QCA build tree Path: %1").arg(QDir::toNativeSeparators(dirIt)));
|
||||
logDebug(QStringLiteral("Checking QCA build tree Path: %1").arg(QDir::toNativeSeparators(dirIt)));
|
||||
#else
|
||||
logDebug(QString("Checking Qt Library Path: %1").arg(QDir::toNativeSeparators(dirIt)));
|
||||
logDebug(QStringLiteral("Checking Qt Library Path: %1").arg(QDir::toNativeSeparators(dirIt)));
|
||||
#endif
|
||||
QDir libpath(dirIt);
|
||||
QDir dir(libpath.filePath(PLUGIN_SUBDIR));
|
||||
if(!dir.exists())
|
||||
{
|
||||
logDebug(" (No 'crypto' subdirectory)");
|
||||
logDebug(QStringLiteral(" (No 'crypto' subdirectory)"));
|
||||
continue;
|
||||
}
|
||||
|
||||
QStringList entryList = dir.entryList(QDir::Files);
|
||||
if(entryList.isEmpty())
|
||||
{
|
||||
logDebug(" (No files in 'crypto' subdirectory)");
|
||||
logDebug(QStringLiteral(" (No files in 'crypto' subdirectory)"));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -401,7 +401,7 @@ void ProviderManager::scan()
|
||||
|
||||
if(!QLibrary::isLibrary(filePath))
|
||||
{
|
||||
logDebug(QString(" %1: not a library, skipping").arg(fileName));
|
||||
logDebug(QStringLiteral(" %1: not a library, skipping").arg(fileName));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -418,7 +418,7 @@ void ProviderManager::scan()
|
||||
}
|
||||
if(haveFile)
|
||||
{
|
||||
logDebug(QString(" %1: already loaded file, skipping").arg(fileName));
|
||||
logDebug(QStringLiteral(" %1: already loaded file, skipping").arg(fileName));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -426,7 +426,7 @@ void ProviderManager::scan()
|
||||
ProviderItem *i = ProviderItem::load(filePath, &errstr);
|
||||
if(!i)
|
||||
{
|
||||
logDebug(QString(" %1: %2").arg(fileName, errstr));
|
||||
logDebug(QStringLiteral(" %1: %2").arg(fileName, errstr));
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -435,7 +435,7 @@ void ProviderManager::scan()
|
||||
QString providerName = i->p->name();
|
||||
if(haveAlready(providerName))
|
||||
{
|
||||
logDebug(QString(" %1: (class: %2, as %3) already loaded provider, skipping").arg(fileName, className, providerName));
|
||||
logDebug(QStringLiteral(" %1: (class: %2, as %3) already loaded provider, skipping").arg(fileName, className, providerName));
|
||||
delete i;
|
||||
continue;
|
||||
}
|
||||
@ -444,20 +444,20 @@ void ProviderManager::scan()
|
||||
if(!validVersion(ver))
|
||||
{
|
||||
errstr = QString::asprintf("plugin version 0x%06x is in the future", ver);
|
||||
logDebug(QString(" %1: (class: %2, as %3) %4").arg(fileName, className, providerName, errstr));
|
||||
logDebug(QStringLiteral(" %1: (class: %2, as %3) %4").arg(fileName, className, providerName, errstr));
|
||||
delete i;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(skip_plugins(def).contains(providerName))
|
||||
{
|
||||
logDebug(QString(" %1: (class: %2, as %3) explicitly disabled, skipping").arg(fileName, className, providerName));
|
||||
logDebug(QStringLiteral(" %1: (class: %2, as %3) explicitly disabled, skipping").arg(fileName, className, providerName));
|
||||
delete i;
|
||||
continue;
|
||||
}
|
||||
|
||||
addItem(i, get_default_priority(providerName));
|
||||
logDebug(QString(" %1: (class: %2) loaded as %3").arg(fileName, className, providerName));
|
||||
logDebug(QStringLiteral(" %1: (class: %2) loaded as %3").arg(fileName, className, providerName));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -471,7 +471,7 @@ bool ProviderManager::add(Provider *p, int priority)
|
||||
|
||||
if(haveAlready(providerName))
|
||||
{
|
||||
logDebug(QString("Directly adding: %1: already loaded provider, skipping").arg(providerName));
|
||||
logDebug(QStringLiteral("Directly adding: %1: already loaded provider, skipping").arg(providerName));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -479,13 +479,13 @@ bool ProviderManager::add(Provider *p, int priority)
|
||||
if(!validVersion(ver))
|
||||
{
|
||||
QString errstr = QString::asprintf("plugin version 0x%06x is in the future", ver);
|
||||
logDebug(QString("Directly adding: %1: %2").arg(providerName, errstr));
|
||||
logDebug(QStringLiteral("Directly adding: %1: %2").arg(providerName, errstr));
|
||||
return false;
|
||||
}
|
||||
|
||||
ProviderItem *i = ProviderItem::fromClass(p);
|
||||
addItem(i, priority);
|
||||
logDebug(QString("Directly adding: %1: loaded").arg(providerName));
|
||||
logDebug(QStringLiteral("Directly adding: %1: loaded").arg(providerName));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -503,7 +503,7 @@ bool ProviderManager::unload(const QString &name)
|
||||
providerItemList.removeAt(n);
|
||||
providerList.removeAt(n);
|
||||
|
||||
logDebug(QString("Unloaded: %1").arg(name));
|
||||
logDebug(QStringLiteral("Unloaded: %1").arg(name));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -527,7 +527,7 @@ void ProviderManager::unloadAll()
|
||||
providerItemList.removeFirst();
|
||||
providerList.removeFirst();
|
||||
|
||||
logDebug(QString("Unloaded: %1").arg(name));
|
||||
logDebug(QStringLiteral("Unloaded: %1").arg(name));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ public:
|
||||
static QList<DLGroupSet> getList(Provider *p)
|
||||
{
|
||||
QList<DLGroupSet> list;
|
||||
const DLGroupContext *c = static_cast<const DLGroupContext *>(getContext("dlgroup", p));
|
||||
const DLGroupContext *c = static_cast<const DLGroupContext *>(getContext(QStringLiteral("dlgroup"), p));
|
||||
if(!c)
|
||||
return list;
|
||||
list = c->supportedGroupSets();
|
||||
@ -128,7 +128,7 @@ public:
|
||||
static QList<PBEAlgorithm> getList(Provider *p)
|
||||
{
|
||||
QList<PBEAlgorithm> list;
|
||||
const PKeyContext *c = static_cast<const PKeyContext *>(getContext("pkey", p));
|
||||
const PKeyContext *c = static_cast<const PKeyContext *>(getContext(QStringLiteral("pkey"), p));
|
||||
if(!c)
|
||||
return list;
|
||||
list = c->supportedPBEAlgorithms();
|
||||
@ -143,7 +143,7 @@ public:
|
||||
static QList<PKey::Type> getList(Provider *p)
|
||||
{
|
||||
QList<PKey::Type> list;
|
||||
const PKeyContext *c = static_cast<const PKeyContext *>(getContext("pkey", p));
|
||||
const PKeyContext *c = static_cast<const PKeyContext *>(getContext(QStringLiteral("pkey"), p));
|
||||
if(!c)
|
||||
return list;
|
||||
list = c->supportedTypes();
|
||||
@ -158,7 +158,7 @@ public:
|
||||
static QList<PKey::Type> getList(Provider *p)
|
||||
{
|
||||
QList<PKey::Type> list;
|
||||
const PKeyContext *c = static_cast<const PKeyContext *>(getContext("pkey", p));
|
||||
const PKeyContext *c = static_cast<const PKeyContext *>(getContext(QStringLiteral("pkey"), p));
|
||||
if(!c)
|
||||
return list;
|
||||
list = c->supportedIOTypes();
|
||||
@ -186,7 +186,7 @@ public:
|
||||
static PublicKey getKey(Provider *p, const I &in, const SecureArray &, ConvertResult *result)
|
||||
{
|
||||
PublicKey k;
|
||||
PKeyContext *c = static_cast<PKeyContext *>(getContext("pkey", p));
|
||||
PKeyContext *c = static_cast<PKeyContext *>(getContext(QStringLiteral("pkey"), p));
|
||||
if(!c)
|
||||
{
|
||||
if(result)
|
||||
@ -223,7 +223,7 @@ public:
|
||||
static PrivateKey getKey(Provider *p, const I &in, const SecureArray &passphrase, ConvertResult *result)
|
||||
{
|
||||
PrivateKey k;
|
||||
PKeyContext *c = static_cast<PKeyContext *>(getContext("pkey", p));
|
||||
PKeyContext *c = static_cast<PKeyContext *>(getContext(QStringLiteral("pkey"), p));
|
||||
if(!c)
|
||||
{
|
||||
if(result)
|
||||
@ -432,13 +432,13 @@ static const unsigned char pkcs_ripemd160[] =
|
||||
|
||||
QByteArray get_hash_id(const QString &name)
|
||||
{
|
||||
if(name == "sha1")
|
||||
if(name == QLatin1String("sha1"))
|
||||
return QByteArray::fromRawData((const char *)pkcs_sha1, sizeof(pkcs_sha1));
|
||||
else if(name == "md5")
|
||||
else if(name == QLatin1String("md5"))
|
||||
return QByteArray::fromRawData((const char *)pkcs_md5, sizeof(pkcs_md5));
|
||||
else if(name == "md2")
|
||||
else if(name == QLatin1String("md2"))
|
||||
return QByteArray::fromRawData((const char *)pkcs_md2, sizeof(pkcs_md2));
|
||||
else if(name == "ripemd160")
|
||||
else if(name == QLatin1String("ripemd160"))
|
||||
return QByteArray::fromRawData((const char *)pkcs_ripemd160, sizeof(pkcs_ripemd160));
|
||||
else
|
||||
return QByteArray();
|
||||
@ -890,7 +890,7 @@ QByteArray PublicKey::toDER() const
|
||||
}
|
||||
else
|
||||
{
|
||||
PKeyContext *pk = static_cast<PKeyContext *>(getContext("pkey", p));
|
||||
PKeyContext *pk = static_cast<PKeyContext *>(getContext(QStringLiteral("pkey"), p));
|
||||
if(pk && pk->importKey(cur->key()))
|
||||
out = pk->publicToDER();
|
||||
delete pk;
|
||||
@ -913,7 +913,7 @@ QString PublicKey::toPEM() const
|
||||
}
|
||||
else
|
||||
{
|
||||
PKeyContext *pk = static_cast<PKeyContext *>(getContext("pkey", p));
|
||||
PKeyContext *pk = static_cast<PKeyContext *>(getContext(QStringLiteral("pkey"), p));
|
||||
if(pk && pk->importKey(cur->key()))
|
||||
out = pk->publicToPEM();
|
||||
delete pk;
|
||||
@ -1075,7 +1075,7 @@ SecureArray PrivateKey::toDER(const SecureArray &passphrase, PBEAlgorithm pbe) c
|
||||
}
|
||||
else
|
||||
{
|
||||
PKeyContext *pk = static_cast<PKeyContext *>(getContext("pkey", p));
|
||||
PKeyContext *pk = static_cast<PKeyContext *>(getContext(QStringLiteral("pkey"), p));
|
||||
if(pk->importKey(cur->key()))
|
||||
out = pk->privateToDER(passphrase, pbe);
|
||||
delete pk;
|
||||
@ -1098,7 +1098,7 @@ QString PrivateKey::toPEM(const SecureArray &passphrase, PBEAlgorithm pbe) const
|
||||
}
|
||||
else
|
||||
{
|
||||
PKeyContext *pk = static_cast<PKeyContext *>(getContext("pkey", p));
|
||||
PKeyContext *pk = static_cast<PKeyContext *>(getContext(QStringLiteral("pkey"), p));
|
||||
if(pk->importKey(cur->key()))
|
||||
out = pk->privateToPEM(passphrase, pbe);
|
||||
delete pk;
|
||||
@ -1241,10 +1241,10 @@ PrivateKey KeyGenerator::createRSA(int bits, int exp, const QString &provider)
|
||||
|
||||
d->key = PrivateKey();
|
||||
d->wasBlocking = d->blocking;
|
||||
d->k = static_cast<RSAContext *>(getContext("rsa", provider));
|
||||
d->k = static_cast<RSAContext *>(getContext(QStringLiteral("rsa"), provider));
|
||||
if (!d->k)
|
||||
return PrivateKey();
|
||||
d->dest = static_cast<PKeyContext *>(getContext("pkey", d->k->provider()));
|
||||
d->dest = static_cast<PKeyContext *>(getContext(QStringLiteral("pkey"), d->k->provider()));
|
||||
|
||||
if(!d->blocking)
|
||||
{
|
||||
@ -1269,8 +1269,8 @@ PrivateKey KeyGenerator::createDSA(const DLGroup &domain, const QString &provide
|
||||
|
||||
d->key = PrivateKey();
|
||||
d->wasBlocking = d->blocking;
|
||||
d->k = static_cast<DSAContext *>(getContext("dsa", provider));
|
||||
d->dest = static_cast<PKeyContext *>(getContext("pkey", d->k->provider()));
|
||||
d->k = static_cast<DSAContext *>(getContext(QStringLiteral("dsa"), provider));
|
||||
d->dest = static_cast<PKeyContext *>(getContext(QStringLiteral("pkey"), d->k->provider()));
|
||||
|
||||
if(!d->blocking)
|
||||
{
|
||||
@ -1295,8 +1295,8 @@ PrivateKey KeyGenerator::createDH(const DLGroup &domain, const QString &provider
|
||||
|
||||
d->key = PrivateKey();
|
||||
d->wasBlocking = d->blocking;
|
||||
d->k = static_cast<DHContext *>(getContext("dh", provider));
|
||||
d->dest = static_cast<PKeyContext *>(getContext("pkey", d->k->provider()));
|
||||
d->k = static_cast<DHContext *>(getContext(QStringLiteral("dh"), provider));
|
||||
d->dest = static_cast<PKeyContext *>(getContext(QStringLiteral("pkey"), d->k->provider()));
|
||||
|
||||
if(!d->blocking)
|
||||
{
|
||||
@ -1330,7 +1330,7 @@ DLGroup KeyGenerator::createDLGroup(QCA::DLGroupSet set, const QString &provider
|
||||
else
|
||||
p = providerForGroupSet(set);
|
||||
|
||||
d->dc = static_cast<DLGroupContext *>(getContext("dlgroup", p));
|
||||
d->dc = static_cast<DLGroupContext *>(getContext(QStringLiteral("dlgroup"), p));
|
||||
d->group = DLGroup();
|
||||
|
||||
if (d->dc)
|
||||
@ -1365,9 +1365,9 @@ RSAPublicKey::RSAPublicKey()
|
||||
|
||||
RSAPublicKey::RSAPublicKey(const BigInteger &n, const BigInteger &e, const QString &provider)
|
||||
{
|
||||
RSAContext *k = static_cast<RSAContext *>(getContext("rsa", provider));
|
||||
RSAContext *k = static_cast<RSAContext *>(getContext(QStringLiteral("rsa"), provider));
|
||||
k->createPublic(n, e);
|
||||
PKeyContext *c = static_cast<PKeyContext *>(getContext("pkey", k->provider()));
|
||||
PKeyContext *c = static_cast<PKeyContext *>(getContext(QStringLiteral("pkey"), k->provider()));
|
||||
c->setKey(k);
|
||||
change(c);
|
||||
}
|
||||
@ -1396,9 +1396,9 @@ RSAPrivateKey::RSAPrivateKey()
|
||||
|
||||
RSAPrivateKey::RSAPrivateKey(const BigInteger &n, const BigInteger &e, const BigInteger &p, const BigInteger &q, const BigInteger &d, const QString &provider)
|
||||
{
|
||||
RSAContext *k = static_cast<RSAContext *>(getContext("rsa", provider));
|
||||
RSAContext *k = static_cast<RSAContext *>(getContext(QStringLiteral("rsa"), provider));
|
||||
k->createPrivate(n, e, p, q, d);
|
||||
PKeyContext *c = static_cast<PKeyContext *>(getContext("pkey", k->provider()));
|
||||
PKeyContext *c = static_cast<PKeyContext *>(getContext(QStringLiteral("pkey"), k->provider()));
|
||||
c->setKey(k);
|
||||
change(c);
|
||||
}
|
||||
@ -1437,9 +1437,9 @@ DSAPublicKey::DSAPublicKey()
|
||||
|
||||
DSAPublicKey::DSAPublicKey(const DLGroup &domain, const BigInteger &y, const QString &provider)
|
||||
{
|
||||
DSAContext *k = static_cast<DSAContext *>(getContext("dsa", provider));
|
||||
DSAContext *k = static_cast<DSAContext *>(getContext(QStringLiteral("dsa"), provider));
|
||||
k->createPublic(domain, y);
|
||||
PKeyContext *c = static_cast<PKeyContext *>(getContext("pkey", k->provider()));
|
||||
PKeyContext *c = static_cast<PKeyContext *>(getContext(QStringLiteral("pkey"), k->provider()));
|
||||
c->setKey(k);
|
||||
change(c);
|
||||
}
|
||||
@ -1468,9 +1468,9 @@ DSAPrivateKey::DSAPrivateKey()
|
||||
|
||||
DSAPrivateKey::DSAPrivateKey(const DLGroup &domain, const BigInteger &y, const BigInteger &x, const QString &provider)
|
||||
{
|
||||
DSAContext *k = static_cast<DSAContext *>(getContext("dsa", provider));
|
||||
DSAContext *k = static_cast<DSAContext *>(getContext(QStringLiteral("dsa"), provider));
|
||||
k->createPrivate(domain, y, x);
|
||||
PKeyContext *c = static_cast<PKeyContext *>(getContext("pkey", k->provider()));
|
||||
PKeyContext *c = static_cast<PKeyContext *>(getContext(QStringLiteral("pkey"), k->provider()));
|
||||
c->setKey(k);
|
||||
change(c);
|
||||
}
|
||||
@ -1499,9 +1499,9 @@ DHPublicKey::DHPublicKey()
|
||||
|
||||
DHPublicKey::DHPublicKey(const DLGroup &domain, const BigInteger &y, const QString &provider)
|
||||
{
|
||||
DHContext *k = static_cast<DHContext *>(getContext("dh", provider));
|
||||
DHContext *k = static_cast<DHContext *>(getContext(QStringLiteral("dh"), provider));
|
||||
k->createPublic(domain, y);
|
||||
PKeyContext *c = static_cast<PKeyContext *>(getContext("pkey", k->provider()));
|
||||
PKeyContext *c = static_cast<PKeyContext *>(getContext(QStringLiteral("pkey"), k->provider()));
|
||||
c->setKey(k);
|
||||
change(c);
|
||||
}
|
||||
@ -1530,9 +1530,9 @@ DHPrivateKey::DHPrivateKey()
|
||||
|
||||
DHPrivateKey::DHPrivateKey(const DLGroup &domain, const BigInteger &y, const BigInteger &x, const QString &provider)
|
||||
{
|
||||
DHContext *k = static_cast<DHContext *>(getContext("dh", provider));
|
||||
DHContext *k = static_cast<DHContext *>(getContext(QStringLiteral("dh"), provider));
|
||||
k->createPrivate(domain, y, x);
|
||||
PKeyContext *c = static_cast<PKeyContext *>(getContext("pkey", k->provider()));
|
||||
PKeyContext *c = static_cast<PKeyContext *>(getContext(QStringLiteral("pkey"), k->provider()));
|
||||
c->setKey(k);
|
||||
change(c);
|
||||
}
|
||||
|
@ -372,14 +372,14 @@ public:
|
||||
}
|
||||
c->setMTU(packet_mtu);
|
||||
|
||||
QCA_logTextMessage(QString("tls[%1]: c->start()").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("tls[%1]: c->start()").arg(q->objectName()), Logger::Information);
|
||||
op = OpStart;
|
||||
c->start();
|
||||
}
|
||||
|
||||
void close()
|
||||
{
|
||||
QCA_logTextMessage(QString("tls[%1]: close").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("tls[%1]: close").arg(q->objectName()), Logger::Information);
|
||||
|
||||
if(state != Connected)
|
||||
return;
|
||||
@ -390,7 +390,7 @@ public:
|
||||
|
||||
void continueAfterStep()
|
||||
{
|
||||
QCA_logTextMessage(QString("tls[%1]: continueAfterStep").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("tls[%1]: continueAfterStep").arg(q->objectName()), Logger::Information);
|
||||
|
||||
if(!blocked)
|
||||
return;
|
||||
@ -405,7 +405,7 @@ public:
|
||||
{
|
||||
if(need_update)
|
||||
{
|
||||
QCA_logTextMessage(QString("tls[%1]: need_update").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("tls[%1]: need_update").arg(q->objectName()), Logger::Information);
|
||||
update();
|
||||
}
|
||||
return;
|
||||
@ -440,7 +440,7 @@ public:
|
||||
actionTrigger.start();
|
||||
}
|
||||
|
||||
QCA_logTextMessage(QString("tls[%1]: handshaken").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("tls[%1]: handshaken").arg(q->objectName()), Logger::Information);
|
||||
|
||||
if(connect_handshaken)
|
||||
{
|
||||
@ -494,17 +494,17 @@ public:
|
||||
|
||||
void update()
|
||||
{
|
||||
QCA_logTextMessage(QString("tls[%1]: update").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("tls[%1]: update").arg(q->objectName()), Logger::Information);
|
||||
|
||||
if(blocked)
|
||||
{
|
||||
QCA_logTextMessage(QString("tls[%1]: ignoring update while blocked").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("tls[%1]: ignoring update while blocked").arg(q->objectName()), Logger::Information);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!actionQueue.isEmpty())
|
||||
{
|
||||
QCA_logTextMessage(QString("tls[%1]: ignoring update while processing actions").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("tls[%1]: ignoring update while processing actions").arg(q->objectName()), Logger::Information);
|
||||
need_update = true;
|
||||
return;
|
||||
}
|
||||
@ -512,7 +512,7 @@ public:
|
||||
// only allow one operation at a time
|
||||
if(op != -1)
|
||||
{
|
||||
QCA_logTextMessage(QString("tls[%1]: ignoring update while operation active").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("tls[%1]: ignoring update while operation active").arg(q->objectName()), Logger::Information);
|
||||
need_update = true;
|
||||
return;
|
||||
}
|
||||
@ -569,14 +569,14 @@ public:
|
||||
|
||||
if(arg_from_net.isEmpty() && arg_from_app.isEmpty() && !maybe_input)
|
||||
{
|
||||
QCA_logTextMessage(QString("tls[%1]: ignoring update: no output and no expected input").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("tls[%1]: ignoring update: no output and no expected input").arg(q->objectName()), Logger::Information);
|
||||
return;
|
||||
}
|
||||
|
||||
// clear this flag
|
||||
maybe_input = false;
|
||||
|
||||
QCA_logTextMessage(QString("tls[%1]: c->update").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("tls[%1]: c->update").arg(q->objectName()), Logger::Information);
|
||||
op = OpUpdate;
|
||||
c->update(arg_from_net, arg_from_app);
|
||||
}
|
||||
@ -622,7 +622,7 @@ public:
|
||||
QByteArray c_to_net = c->to_net();
|
||||
if(!c_to_net.isEmpty())
|
||||
{
|
||||
QCA_logTextMessage(QString("tls[%1]: to_net %2").arg(q->objectName(), QString::number(c_to_net.size())), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("tls[%1]: to_net %2").arg(q->objectName(), QString::number(c_to_net.size())), Logger::Information);
|
||||
}
|
||||
|
||||
if(state == Closing)
|
||||
@ -694,7 +694,7 @@ public:
|
||||
QByteArray c_to_app = c->to_app();
|
||||
if(!c_to_app.isEmpty())
|
||||
{
|
||||
QCA_logTextMessage(QString("tls[%1]: to_app %2").arg(q->objectName(), QString::number(c_to_app.size())), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("tls[%1]: to_app %2").arg(q->objectName(), QString::number(c_to_app.size())), Logger::Information);
|
||||
}
|
||||
|
||||
bool eof = c->eof();
|
||||
@ -758,7 +758,7 @@ public:
|
||||
|
||||
if(eof || io_pending)
|
||||
{
|
||||
QCA_logTextMessage(QString("tls[%1]: eof || io_pending").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("tls[%1]: eof || io_pending").arg(q->objectName()), Logger::Information);
|
||||
update();
|
||||
}
|
||||
|
||||
@ -770,7 +770,7 @@ public:
|
||||
private Q_SLOTS:
|
||||
void tls_resultsReady()
|
||||
{
|
||||
QCA_logTextMessage(QString("tls[%1]: c->resultsReady()").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("tls[%1]: c->resultsReady()").arg(q->objectName()), Logger::Information);
|
||||
|
||||
Q_ASSERT(op != -1);
|
||||
|
||||
@ -785,7 +785,7 @@ private Q_SLOTS:
|
||||
|
||||
void tls_dtlsTimeout()
|
||||
{
|
||||
QCA_logTextMessage(QString("tls[%1]: c->dtlsTimeout()").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("tls[%1]: c->dtlsTimeout()").arg(q->objectName()), Logger::Information);
|
||||
|
||||
maybe_input = true;
|
||||
update();
|
||||
@ -798,13 +798,13 @@ private Q_SLOTS:
|
||||
};
|
||||
|
||||
TLS::TLS(QObject *parent, const QString &provider)
|
||||
:SecureLayer(parent), Algorithm("tls", provider)
|
||||
:SecureLayer(parent), Algorithm(QStringLiteral("tls"), provider)
|
||||
{
|
||||
d = new Private(this, TLS::Stream);
|
||||
}
|
||||
|
||||
TLS::TLS(Mode mode, QObject *parent, const QString &provider)
|
||||
:SecureLayer(parent), Algorithm(mode == Stream ? "tls" : "dtls", provider)
|
||||
:SecureLayer(parent), Algorithm(mode == Stream ? QStringLiteral("tls") : QStringLiteral("dtls"), provider)
|
||||
{
|
||||
d = new Private(this, mode);
|
||||
}
|
||||
@ -1074,7 +1074,7 @@ void TLS::write(const QByteArray &a)
|
||||
}
|
||||
else
|
||||
d->packet_out.append(a);
|
||||
QCA_logTextMessage(QString("tls[%1]: write").arg(objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("tls[%1]: write").arg(objectName()), Logger::Information);
|
||||
d->update();
|
||||
}
|
||||
|
||||
@ -1101,7 +1101,7 @@ void TLS::writeIncoming(const QByteArray &a)
|
||||
d->from_net.append(a);
|
||||
else
|
||||
d->packet_from_net.append(a);
|
||||
QCA_logTextMessage(QString("tls[%1]: writeIncoming %2").arg(objectName(), QString::number(a.size())), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("tls[%1]: writeIncoming %2").arg(objectName(), QString::number(a.size())), Logger::Information);
|
||||
d->update();
|
||||
}
|
||||
|
||||
@ -1466,12 +1466,12 @@ public:
|
||||
|
||||
if(server)
|
||||
{
|
||||
QCA_logTextMessage(QString("sasl[%1]: c->startServer()").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("sasl[%1]: c->startServer()").arg(q->objectName()), Logger::Information);
|
||||
c->startServer(server_realm, disableServerSendLast);
|
||||
}
|
||||
else
|
||||
{
|
||||
QCA_logTextMessage(QString("sasl[%1]: c->startClient()").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("sasl[%1]: c->startClient()").arg(q->objectName()), Logger::Information);
|
||||
c->startClient(mechlist, allowClientSendFirst);
|
||||
}
|
||||
}
|
||||
@ -1481,7 +1481,7 @@ public:
|
||||
if(op != -1)
|
||||
return;
|
||||
|
||||
QCA_logTextMessage(QString("sasl[%1]: c->serverFirstStep()").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("sasl[%1]: c->serverFirstStep()").arg(q->objectName()), Logger::Information);
|
||||
op = OpServerFirstStep;
|
||||
c->serverFirstStep(mech, clientInit);
|
||||
}
|
||||
@ -1491,7 +1491,7 @@ public:
|
||||
if(op != -1)
|
||||
return;
|
||||
|
||||
QCA_logTextMessage(QString("sasl[%1]: c->nextStep()").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("sasl[%1]: c->nextStep()").arg(q->objectName()), Logger::Information);
|
||||
op = OpNextStep;
|
||||
c->nextStep(stepData);
|
||||
}
|
||||
@ -1501,7 +1501,7 @@ public:
|
||||
if(op != -1)
|
||||
return;
|
||||
|
||||
QCA_logTextMessage(QString("sasl[%1]: c->tryAgain()").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("sasl[%1]: c->tryAgain()").arg(q->objectName()), Logger::Information);
|
||||
op = OpTryAgain;
|
||||
c->tryAgain();
|
||||
}
|
||||
@ -1544,7 +1544,7 @@ public:
|
||||
actionTrigger.start();
|
||||
}
|
||||
|
||||
QCA_logTextMessage(QString("sasl[%1]: authenticated").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("sasl[%1]: authenticated").arg(q->objectName()), Logger::Information);
|
||||
emit q->authenticated();
|
||||
}
|
||||
else if(a.type == Action::ReadyRead)
|
||||
@ -1562,13 +1562,13 @@ public:
|
||||
// defer writes while authenticating
|
||||
if(!authed)
|
||||
{
|
||||
QCA_logTextMessage(QString("sasl[%1]: ignoring update while not yet authenticated").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("sasl[%1]: ignoring update while not yet authenticated").arg(q->objectName()), Logger::Information);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!actionQueue.isEmpty())
|
||||
{
|
||||
QCA_logTextMessage(QString("sasl[%1]: ignoring update while processing actions").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("sasl[%1]: ignoring update while processing actions").arg(q->objectName()), Logger::Information);
|
||||
need_update = true;
|
||||
return;
|
||||
}
|
||||
@ -1576,14 +1576,14 @@ public:
|
||||
// only allow one operation at a time
|
||||
if(op != -1)
|
||||
{
|
||||
QCA_logTextMessage(QString("sasl[%1]: ignoring update while operation active").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("sasl[%1]: ignoring update while operation active").arg(q->objectName()), Logger::Information);
|
||||
need_update = true;
|
||||
return;
|
||||
}
|
||||
|
||||
need_update = false;
|
||||
|
||||
QCA_logTextMessage(QString("sasl[%1]: c->update()").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("sasl[%1]: c->update()").arg(q->objectName()), Logger::Information);
|
||||
op = OpUpdate;
|
||||
out_pending += out.size();
|
||||
c->update(from_net, out);
|
||||
@ -1594,7 +1594,7 @@ public:
|
||||
private Q_SLOTS:
|
||||
void sasl_resultsReady()
|
||||
{
|
||||
QCA_logTextMessage(QString("sasl[%1]: c->resultsReady()").arg(q->objectName()), Logger::Information);
|
||||
QCA_logTextMessage(QStringLiteral("sasl[%1]: c->resultsReady()").arg(q->objectName()), Logger::Information);
|
||||
|
||||
int last_op = op;
|
||||
op = -1;
|
||||
@ -1773,7 +1773,7 @@ private Q_SLOTS:
|
||||
};
|
||||
|
||||
SASL::SASL(QObject *parent, const QString &provider)
|
||||
:SecureLayer(parent), Algorithm("sasl", provider)
|
||||
:SecureLayer(parent), Algorithm(QStringLiteral("sasl"), provider)
|
||||
{
|
||||
d = new Private(this);
|
||||
}
|
||||
|
@ -621,7 +621,7 @@ SecureMessageSystem::~SecureMessageSystem()
|
||||
// OpenPGP
|
||||
//----------------------------------------------------------------------------
|
||||
OpenPGP::OpenPGP(QObject *parent, const QString &provider)
|
||||
:SecureMessageSystem(parent, "openpgp", provider)
|
||||
:SecureMessageSystem(parent, QStringLiteral("openpgp"), provider)
|
||||
{
|
||||
}
|
||||
|
||||
@ -640,7 +640,7 @@ public:
|
||||
};
|
||||
|
||||
CMS::CMS(QObject *parent, const QString &provider)
|
||||
:SecureMessageSystem(parent, "cms", provider)
|
||||
:SecureMessageSystem(parent, QStringLiteral("cms"), provider)
|
||||
{
|
||||
d = new Private;
|
||||
}
|
||||
|
@ -26,13 +26,13 @@ namespace QCA {
|
||||
|
||||
bool qca_have_systemstore()
|
||||
{
|
||||
QFile f(QCA_SYSTEMSTORE_PATH);
|
||||
QFile f(QStringLiteral(QCA_SYSTEMSTORE_PATH));
|
||||
return f.open(QFile::ReadOnly);
|
||||
}
|
||||
|
||||
CertificateCollection qca_get_systemstore(const QString &provider)
|
||||
{
|
||||
return CertificateCollection::fromFlatTextFile(QCA_SYSTEMSTORE_PATH, nullptr, provider);
|
||||
return CertificateCollection::fromFlatTextFile(QStringLiteral(QCA_SYSTEMSTORE_PATH), nullptr, provider);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -849,7 +849,7 @@ public:
|
||||
|
||||
if(c == '\r' || c == '\n')
|
||||
{
|
||||
writeString("\n");
|
||||
writeString(QStringLiteral("\n"));
|
||||
done = true;
|
||||
return false;
|
||||
}
|
||||
@ -859,7 +859,7 @@ public:
|
||||
if(at > 0)
|
||||
{
|
||||
--at;
|
||||
writeString("\b \b");
|
||||
writeString(QStringLiteral("\b \b"));
|
||||
result.resize(at * sizeof(ushort));
|
||||
}
|
||||
return true;
|
||||
@ -872,7 +872,7 @@ public:
|
||||
|
||||
appendChar(c);
|
||||
|
||||
writeString("*");
|
||||
writeString(QStringLiteral("*"));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -63,18 +63,18 @@ void Base64UnitTest::test1_data()
|
||||
QTest::addColumn<QString>("encoded");
|
||||
|
||||
// these are from the Botan test suite. Note that these are hex encoded!
|
||||
QTest::newRow("31") << QString("31") << QString("4d513d3d");
|
||||
QTest::newRow("235c91") << QString("235c91") << QString("49317952");
|
||||
QTest::newRow("414") << QString("4142634452313236")
|
||||
<< QString("51554a6a524649784d6a593d");
|
||||
QTest::newRow("241") << QString("241bb300a3989a620659")
|
||||
<< QString("4a42757a414b4f596d6d494757513d3d");
|
||||
QTest::newRow("313") << QString("31323537374343666671333435337836")
|
||||
<< QString("4d5449314e7a644451325a6d63544d304e544e344e673d3d");
|
||||
QTest::newRow("60e") << QString("60e8e5ebb1a5eac95a01ec7f8796b2dce471")
|
||||
<< QString("594f6a6c3637476c36736c614165782f68356179334f5278");
|
||||
QTest::newRow("3134") << QString("31346d354f33313333372c31274d754e7354307050346231333a29")
|
||||
<< QString("4d5452744e55387a4d544d7a4e7977784a303131546e4e554d4842514e4749784d7a6f70");
|
||||
QTest::newRow("31") << QStringLiteral("31") << QStringLiteral("4d513d3d");
|
||||
QTest::newRow("235c91") << QStringLiteral("235c91") << QStringLiteral("49317952");
|
||||
QTest::newRow("414") << QStringLiteral("4142634452313236")
|
||||
<< QStringLiteral("51554a6a524649784d6a593d");
|
||||
QTest::newRow("241") << QStringLiteral("241bb300a3989a620659")
|
||||
<< QStringLiteral("4a42757a414b4f596d6d494757513d3d");
|
||||
QTest::newRow("313") << QStringLiteral("31323537374343666671333435337836")
|
||||
<< QStringLiteral("4d5449314e7a644451325a6d63544d304e544e344e673d3d");
|
||||
QTest::newRow("60e") << QStringLiteral("60e8e5ebb1a5eac95a01ec7f8796b2dce471")
|
||||
<< QStringLiteral("594f6a6c3637476c36736c614165782f68356179334f5278");
|
||||
QTest::newRow("3134") << QStringLiteral("31346d354f33313333372c31274d754e7354307050346231333a29")
|
||||
<< QStringLiteral("4d5452744e55387a4d544d7a4e7977784a303131546e4e554d4842514e4749784d7a6f70");
|
||||
}
|
||||
|
||||
|
||||
@ -84,20 +84,20 @@ void Base64UnitTest::test2_data()
|
||||
QTest::addColumn<QString>("encoded");
|
||||
|
||||
// these are from Python 2.3's tests for base64
|
||||
QTest::newRow("www.python.org") << QString("www.python.org")
|
||||
<< QString("d3d3LnB5dGhvbi5vcmc=");
|
||||
QTest::newRow("a") << QString("a") << QString("YQ==");
|
||||
QTest::newRow("ab") << QString("ab") << QString("YWI=");
|
||||
QTest::newRow("abc") << QString("abc") << QString("YWJj");
|
||||
QTest::newRow("empty") << QString("") << QString("");
|
||||
QTest::newRow("a-Z") << QString("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#0^&*();:<>,. []{}")
|
||||
<< QString("YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0NTY3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==");
|
||||
QTest::newRow("www.python.org") << QStringLiteral("www.python.org")
|
||||
<< QStringLiteral("d3d3LnB5dGhvbi5vcmc=");
|
||||
QTest::newRow("a") << QStringLiteral("a") << QStringLiteral("YQ==");
|
||||
QTest::newRow("ab") << QStringLiteral("ab") << QStringLiteral("YWI=");
|
||||
QTest::newRow("abc") << QStringLiteral("abc") << QStringLiteral("YWJj");
|
||||
QTest::newRow("empty") << QString(QLatin1String("")) << QString(QLatin1String(""));
|
||||
QTest::newRow("a-Z") << QStringLiteral("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#0^&*();:<>,. []{}")
|
||||
<< QStringLiteral("YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0NTY3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==");
|
||||
|
||||
// these are generated by Python 2.3. I removed the trailing newline
|
||||
QTest::newRow("31") << QString("31") << QString("MzE=");
|
||||
QTest::newRow("QCA_2.0") << QString("QCA_2.0") << QString("UUNBXzIuMA==");
|
||||
QTest::newRow("j-0") << QString("jh/*-*/*-/4983589230")
|
||||
<< QString("amgvKi0qLyotLzQ5ODM1ODkyMzA=");
|
||||
QTest::newRow("31") << QStringLiteral("31") << QStringLiteral("MzE=");
|
||||
QTest::newRow("QCA_2.0") << QStringLiteral("QCA_2.0") << QStringLiteral("UUNBXzIuMA==");
|
||||
QTest::newRow("j-0") << QStringLiteral("jh/*-*/*-/4983589230")
|
||||
<< QStringLiteral("amgvKi0qLyotLzQ5ODM1ODkyMzA=");
|
||||
}
|
||||
|
||||
void Base64UnitTest::test1()
|
||||
|
@ -59,8 +59,8 @@ void BigIntUnitTest::allTests()
|
||||
// Some string conversion tests
|
||||
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") );
|
||||
QCOMPARE( QCA::BigInteger("255").toString(), QStringLiteral("255") );
|
||||
QCOMPARE( QCA::BigInteger("-255").toString(), QStringLiteral("-255") );
|
||||
QCOMPARE( QCA::BigInteger("255"), QCA::BigInteger(QCA::BigInteger(255).toArray()) );
|
||||
QCOMPARE( QCA::BigInteger("-255"), QCA::BigInteger(QCA::BigInteger(-255).toArray()) );
|
||||
|
||||
@ -87,7 +87,7 @@ void BigIntUnitTest::allTests()
|
||||
QString testString;
|
||||
QTextStream ts( &testString, QIODevice::WriteOnly);
|
||||
ts << a << b << c << endl;
|
||||
QCOMPARE( testString, QString( "4000000000000-40000000000002000000000000\n") );
|
||||
QCOMPARE( testString, QStringLiteral( "4000000000000-40000000000002000000000000\n") );
|
||||
|
||||
// Botan's addition tests
|
||||
QCOMPARE( QCA::BigInteger( 255 ) += QCA::BigInteger ( 1 ), QCA::BigInteger( 256 ) );
|
||||
@ -95,592 +95,592 @@ void BigIntUnitTest::allTests()
|
||||
QCOMPARE( result.toString(), QCA::BigInteger( 256 ).toString() );
|
||||
|
||||
result = QCA::BigInteger( "65535" ) += QCA::BigInteger( "1" );
|
||||
QCOMPARE( result.toString(), QString( "65536" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "65536" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "65536") );
|
||||
|
||||
result = QCA::BigInteger( "4294967295" ) += QCA::BigInteger( 1 );
|
||||
QCOMPARE( result.toString(), QString( "4294967296" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "4294967296" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "4294967296" ) );
|
||||
|
||||
result = QCA::BigInteger( "18446744073709551615" ) += QCA::BigInteger( 1 );
|
||||
QCOMPARE( result.toString(), QString( "18446744073709551616" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "18446744073709551616" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "18446744073709551616" ) );
|
||||
|
||||
result = QCA::BigInteger( "124536363637272472" ) += QCA::BigInteger( "124536363637272472" );
|
||||
QCOMPARE( result.toString(), QString ( "249072727274544944" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "249072727274544944" ) );
|
||||
QCOMPARE( result, QCA::BigInteger ( "249072727274544944" ) );
|
||||
|
||||
result = QCA::BigInteger( "9223372036854775807" ) += QCA::BigInteger( "281474976710655" );
|
||||
QCOMPARE( result.toString(), QString ( "9223653511831486462" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "9223653511831486462" ) );
|
||||
QCOMPARE( result, QCA::BigInteger ( "9223653511831486462" ) );
|
||||
|
||||
result = QCA::BigInteger( "9223372036854775807" ) += QCA::BigInteger( "137438953471" );
|
||||
QCOMPARE( result.toString(), QString( "9223372174293729278" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "9223372174293729278" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "9223372174293729278" ) );
|
||||
|
||||
|
||||
// Botan's carry tests
|
||||
result = QCA::BigInteger( "340282366920938463463374607431768211455" )
|
||||
+= QCA::BigInteger( "340282366920938463463374607431768211455" );
|
||||
QCOMPARE( result.toString(), QString( "680564733841876926926749214863536422910" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "680564733841876926926749214863536422910" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "680564733841876926926749214863536422910" ) );
|
||||
|
||||
result = QCA::BigInteger( "340282366920938463463374607431768211455" )
|
||||
+= QCA::BigInteger( "340282366920938463463374607431768211450" );
|
||||
QCOMPARE( result.toString(), QString( "680564733841876926926749214863536422905" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "680564733841876926926749214863536422905" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "680564733841876926926749214863536422905" ) );
|
||||
|
||||
result = QCA::BigInteger( "115792089237316195423570985008687907853269984665640564039457584007913129639935" )
|
||||
+= QCA::BigInteger( "115792089237316195423570985008687907853269984665640564039457584007913129639935" );
|
||||
QCOMPARE( result.toString(), QString( "231584178474632390847141970017375815706539969331281128078915168015826259279870" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "231584178474632390847141970017375815706539969331281128078915168015826259279870" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "231584178474632390847141970017375815706539969331281128078915168015826259279870" ) );
|
||||
|
||||
result = QCA::BigInteger( "115792089237316195423570985008687907853269984665640564039457584007913129639935" )
|
||||
+= QCA::BigInteger( "115792089237316195423570985008687907853269984665640564039457584007913129639919" );
|
||||
QCOMPARE( result.toString(), QString( "231584178474632390847141970017375815706539969331281128078915168015826259279854") );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "231584178474632390847141970017375815706539969331281128078915168015826259279854") );
|
||||
QCOMPARE( result, QCA::BigInteger( "231584178474632390847141970017375815706539969331281128078915168015826259279854") );
|
||||
|
||||
result = QCA::BigInteger( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084095" )
|
||||
+= QCA::BigInteger( "18446744073709551616" );
|
||||
QCOMPARE( result.toString(), QString( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946588393177722715635711" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946588393177722715635711" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946588393177722715635711" ) );
|
||||
|
||||
|
||||
result = QCA::BigInteger( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084095" )
|
||||
+= QCA::BigInteger( "1" );
|
||||
QCOMPARE( result.toString(), QString( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084096" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084096" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084096" ) );
|
||||
|
||||
result = QCA::BigInteger( "-39794270013919406610834826960427146769766189764838473416502965291920535601112688579198627475284777498059330306128763345008528325994574657552726381901" )
|
||||
+= QCA::BigInteger( "-342238655038" );
|
||||
QCOMPARE( result.toString(), QString( "-39794270013919406610834826960427146769766189764838473416502965291920535601112688579198627475284777498059330306128763345008528325994574657894965036939" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-39794270013919406610834826960427146769766189764838473416502965291920535601112688579198627475284777498059330306128763345008528325994574657894965036939" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-39794270013919406610834826960427146769766189764838473416502965291920535601112688579198627475284777498059330306128763345008528325994574657894965036939" ) );
|
||||
|
||||
result = QCA::BigInteger( "25110291853498940831251897922987678157346336093292373576945426289097725034326735312448621015537884914" )
|
||||
+= QCA::BigInteger( "-36551081154398645734533965739979697527373251608055056627686956281114038842935173436543461" );
|
||||
QCOMPARE( result.toString(), QString( "25110291853462389750097499277253144191606356395765000325337371232470038078045621273605685842101341453") );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "25110291853462389750097499277253144191606356395765000325337371232470038078045621273605685842101341453") );
|
||||
QCOMPARE( result, QCA::BigInteger( "25110291853462389750097499277253144191606356395765000325337371232470038078045621273605685842101341453") );
|
||||
|
||||
result = QCA::BigInteger( "27802650352" )
|
||||
+= QCA::BigInteger( "660736146705288303126411072388564329913778942" );
|
||||
QCOMPARE( result.toString(), QString( "660736146705288303126411072388564357716429294" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "660736146705288303126411072388564357716429294" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "660736146705288303126411072388564357716429294" ) );
|
||||
|
||||
result = QCA::BigInteger( "-1348245899955041864800954463709881466231496038216683608715424566397833766910915722793041224478985289" )
|
||||
+= QCA::BigInteger( "11517149522866182358565152643595266257020228597058539113114732218008332987904361457299261161227276764386173666571334749062651694592291882972" );
|
||||
QCOMPARE( result.toString(), QString( "11517149522866182358565152643595266257018880351158584071249931263544623106438129961261044477618561339819775832804423833339858653367812897683" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "11517149522866182358565152643595266257018880351158584071249931263544623106438129961261044477618561339819775832804423833339858653367812897683" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "11517149522866182358565152643595266257018880351158584071249931263544623106438129961261044477618561339819775832804423833339858653367812897683" ) );
|
||||
|
||||
result = QCA::BigInteger( "-17540530441681616962868251635133601915039026254996886583618243914226325157426408929602625346567256761818" )
|
||||
+= QCA::BigInteger( "865200427983527245206901810160356641402419461642082623179544681519016990" );
|
||||
QCOMPARE( result.toString(), QString( "-17540530441681616962868251635132736714611042727751679681808083557584922737964766846979445801885737744828" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-17540530441681616962868251635132736714611042727751679681808083557584922737964766846979445801885737744828" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-17540530441681616962868251635132736714611042727751679681808083557584922737964766846979445801885737744828" ) );
|
||||
|
||||
result = QCA::BigInteger( "128844776074298261556398714096948603458177018275051329218555498374" )
|
||||
+= QCA::BigInteger( "443816313829150876362052235134610603220548928107697961229953611873695276391917150913346479060246759720475193648" );
|
||||
QCOMPARE( result.toString(), QString( "443816313829150876362052235134610603220548928236542737304251873430093990488865754371523497335298088939030692022" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "443816313829150876362052235134610603220548928236542737304251873430093990488865754371523497335298088939030692022" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "443816313829150876362052235134610603220548928236542737304251873430093990488865754371523497335298088939030692022" ) );
|
||||
|
||||
result = QCA::BigInteger( "1709484189262457846620911889502097055085989595277300243221975568275935717696463" )
|
||||
+= QCA::BigInteger( "-1646592344139809206374540620411514484579951199941360" );
|
||||
QCOMPARE( result.toString(), QString( "1709484189262457846620911887855504710946180388902759622810461083695984517755103" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "1709484189262457846620911887855504710946180388902759622810461083695984517755103" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "1709484189262457846620911887855504710946180388902759622810461083695984517755103" ) );
|
||||
|
||||
result = QCA::BigInteger( "320175865429637176165709341576187102540180627806418015204928771170233538951323952509055929139673223273528062883083030595199153877335714942842" )
|
||||
+= QCA::BigInteger( "-2828241696960736089879965882386687935938570856545481227619497640844399275054327390050478930503975773972" );
|
||||
QCOMPARE( result.toString(), QString( "320175865429637176165709341576187102537352386109457279115048805287846851015385381652510447912053725632683663608028703205148674946831739168870" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "320175865429637176165709341576187102537352386109457279115048805287846851015385381652510447912053725632683663608028703205148674946831739168870" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "320175865429637176165709341576187102537352386109457279115048805287846851015385381652510447912053725632683663608028703205148674946831739168870" ) );
|
||||
|
||||
result = QCA::BigInteger( "-4035398360542181725908295312107496142105415014744259439963377204111754181625695349185753326709217" )
|
||||
+= QCA::BigInteger( "85450213703789913646546187382091037800" );
|
||||
QCOMPARE( result.toString(), QString( "-4035398360542181725908295312107496142105415014744259439963291753898050391712048802998371235671417" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-4035398360542181725908295312107496142105415014744259439963291753898050391712048802998371235671417" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-4035398360542181725908295312107496142105415014744259439963291753898050391712048802998371235671417" ) );
|
||||
|
||||
result = QCA::BigInteger( "-1292166446073479876801522363382357887431657639184151284775525387363973852756087726243671676713861533673009088319851" )
|
||||
+= QCA::BigInteger( "804538895874518175537499425282375058236245531798590350403343841766955572070643267141945695624895109330242749935754739434394691714971" );
|
||||
QCOMPARE( result.toString(), QString( "804538895874518174245332979208895181434723168416232462971686202582804287295117879777971842868807383086571073221893205761385603395120" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "804538895874518174245332979208895181434723168416232462971686202582804287295117879777971842868807383086571073221893205761385603395120" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "804538895874518174245332979208895181434723168416232462971686202582804287295117879777971842868807383086571073221893205761385603395120" ) );
|
||||
|
||||
result = QCA::BigInteger( "-451986588700926309459451756852005697379481014956007968529234251884946522682901215022086432597024324062240835564200177389" )
|
||||
+= QCA::BigInteger( "15762983479" );
|
||||
QCOMPARE( result.toString(), QString( "-451986588700926309459451756852005697379481014956007968529234251884946522682901215022086432597024324062240835548437193910" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-451986588700926309459451756852005697379481014956007968529234251884946522682901215022086432597024324062240835548437193910" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-451986588700926309459451756852005697379481014956007968529234251884946522682901215022086432597024324062240835548437193910" ) );
|
||||
|
||||
result = QCA::BigInteger( "-3907475412115728816974567022055278374116794025624287474334038831885743634200801846649105209920908153587891040882946582394429615396962188674594744360388466" )
|
||||
+= QCA::BigInteger( "193893611236537854694879677478106237157079207398283117392998175454362643521031390" );
|
||||
QCOMPARE( result.toString(), QString( "-3907475412115728816974567022055278374116794025624287474334038831885743634006908235412567355226028476109784803725867374996146498003964013220232100839357076" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-3907475412115728816974567022055278374116794025624287474334038831885743634006908235412567355226028476109784803725867374996146498003964013220232100839357076" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-3907475412115728816974567022055278374116794025624287474334038831885743634006908235412567355226028476109784803725867374996146498003964013220232100839357076" ) );
|
||||
|
||||
|
||||
result = QCA::BigInteger( "-72603710637966201224690926289" )
|
||||
+= QCA::BigInteger( "-13618442642298533261581255034923612640512507150728017106768861506299813289801666559564532" );
|
||||
QCOMPARE( result.toString(), QString( "-13618442642298533261581255034923612640512507150728017106768934110010451256002891250490821" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-13618442642298533261581255034923612640512507150728017106768934110010451256002891250490821" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-13618442642298533261581255034923612640512507150728017106768934110010451256002891250490821" ) );
|
||||
|
||||
result = QCA::BigInteger( "56077960835713056831402948406790747107889446769357509759472207603483968107693997028111823994257399379783658853302692762256851623103019589392739" )
|
||||
+= QCA::BigInteger( "-427057313888431079237360487703561848638868677065083968842" );
|
||||
QCOMPARE( result.toString(), QString( "56077960835713056831402948406790747107889446769357509759472207603483968107693997028111396936943510948704421492814989200408212754425954505423897" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "56077960835713056831402948406790747107889446769357509759472207603483968107693997028111396936943510948704421492814989200408212754425954505423897" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "56077960835713056831402948406790747107889446769357509759472207603483968107693997028111396936943510948704421492814989200408212754425954505423897" ) );
|
||||
|
||||
result = QCA::BigInteger( "-2209800838508504443494783762534800337712101405156784708782197580824527899758308" )
|
||||
+= QCA::BigInteger( "42844076503039495864500213925837598507817708418354152774112078596443089606598570396235816327987463393971710495985285591895096794994387176281079" );
|
||||
QCOMPARE( result.toString(), QString( "42844076503039495864500213925837598507817708418354152774112078594233288768090065952741032565452663056259609090828500883112899214169859276522771" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "42844076503039495864500213925837598507817708418354152774112078594233288768090065952741032565452663056259609090828500883112899214169859276522771" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "42844076503039495864500213925837598507817708418354152774112078594233288768090065952741032565452663056259609090828500883112899214169859276522771" ) );
|
||||
|
||||
result = QCA::BigInteger( "33887767308809826842417841176152232321272231788338404526859019370507113927387984766381329515371768224976188337692" )
|
||||
+= QCA::BigInteger( "349484339542971517481628970179002500341" );
|
||||
QCOMPARE( result.toString(), QString( "33887767308809826842417841176152232321272231788338404526859019370507113927737469105924301032853397195155190838033" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "33887767308809826842417841176152232321272231788338404526859019370507113927737469105924301032853397195155190838033" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "33887767308809826842417841176152232321272231788338404526859019370507113927737469105924301032853397195155190838033" ) );
|
||||
|
||||
result = QCA::BigInteger( "85748089639858660722587321621536298082690707526412426951630101551228144063151688592419555048867068162" )
|
||||
+= QCA::BigInteger( "-383634567691961960211191292397062452265352651123492760493087381707279" );
|
||||
QCOMPARE( result.toString(), QString( "85748089639858660722587321621535914448123015564452215760337704488775878710500565099659061961485360883" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "85748089639858660722587321621535914448123015564452215760337704488775878710500565099659061961485360883" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "85748089639858660722587321621535914448123015564452215760337704488775878710500565099659061961485360883" ) );
|
||||
|
||||
result = QCA::BigInteger( "23889807888563742283608049816129153552608399262924421832404872043475" )
|
||||
+= QCA::BigInteger( "995" );
|
||||
QCOMPARE( result.toString(), QString( "23889807888563742283608049816129153552608399262924421832404872044470" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "23889807888563742283608049816129153552608399262924421832404872044470" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "23889807888563742283608049816129153552608399262924421832404872044470" ) );
|
||||
|
||||
result = QCA::BigInteger( "-654786925833474864669230962582694222611472680701859262466465606239654996048306783957549697781271829257774329538985" )
|
||||
+= QCA::BigInteger( "-276137507159648540503039013089014674747" );
|
||||
QCOMPARE( result.toString(), QString( "-654786925833474864669230962582694222611472680701859262466465606239654996048582921464709346321774868270863344213732" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-654786925833474864669230962582694222611472680701859262466465606239654996048582921464709346321774868270863344213732" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-654786925833474864669230962582694222611472680701859262466465606239654996048582921464709346321774868270863344213732" ) );
|
||||
|
||||
result = QCA::BigInteger( "50463316268089933" )
|
||||
+= QCA::BigInteger( "-140591583463431806921000349498135287589005423318927850947894242995310138569473157521312413652439234324419130527702899917161307657443381774866237429" );
|
||||
QCOMPARE( result.toString(), QString( "-140591583463431806921000349498135287589005423318927850947894242995310138569473157521312413652439234324419130527702899917161307657392918458598147496" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-140591583463431806921000349498135287589005423318927850947894242995310138569473157521312413652439234324419130527702899917161307657392918458598147496" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-140591583463431806921000349498135287589005423318927850947894242995310138569473157521312413652439234324419130527702899917161307657392918458598147496" ) );
|
||||
|
||||
result = QCA::BigInteger( "1339015021665554488163337105187026760232395594198925052890859936\
|
||||
418304234254229440059229155546157793544192" )
|
||||
+= QCA::BigInteger( "6294037420283433712414743361937677483761554699961644450461297486224793278823004487175687771163597590566132592591599249970281125781761944353272" );
|
||||
QCOMPARE( result.toString(), QString( "6294037420283433712414743361937677485100569721627198938624634591411820039055400081374612824054457526984436826845828690029510281327919737897464" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "6294037420283433712414743361937677485100569721627198938624634591411820039055400081374612824054457526984436826845828690029510281327919737897464" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "6294037420283433712414743361937677485100569721627198938624634591411820039055400081374612824054457526984436826845828690029510281327919737897464" ) );
|
||||
|
||||
result = QCA::BigInteger( "-241446683" )
|
||||
+= QCA::BigInteger( "-282671163032866994488211995758272717472259277760825940523445628\
|
||||
442206062910449311538519756165635175664610569214430918184214" );
|
||||
QCOMPARE( result.toString(), QString( "-282671163032866994488211995758272717472259277760825940523445628442206062910449311538519756165635175664610569214431159630897" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-282671163032866994488211995758272717472259277760825940523445628442206062910449311538519756165635175664610569214431159630897" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-282671163032866994488211995758272717472259277760825940523445628442206062910449311538519756165635175664610569214431159630897" ) );
|
||||
|
||||
result = QCA::BigInteger( "2358605503303452637996081421902056515951744611718383128442445119505739707550326378912342448355046239066896995563581" )
|
||||
+= QCA::BigInteger( "-3830437229145325165273364525551261440648845791949681661260946956860463720730123941973615" );
|
||||
QCOMPARE( result.toString(), QString( "2358605503303452637996081418071619286806419446445018602891183678856893915600644717651395491494582518336773053589966" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "2358605503303452637996081418071619286806419446445018602891183678856893915600644717651395491494582518336773053589966" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "2358605503303452637996081418071619286806419446445018602891183678856893915600644717651395491494582518336773053589966" ) );
|
||||
|
||||
result = QCA::BigInteger( "1860794367587960058388097846258490" )
|
||||
+= QCA::BigInteger( "-237344494507203983863096991896035366478949095337787603280" );
|
||||
QCOMPARE( result.toString(), QString( "-237344494507203983863095131101667778518890707239941344790" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-237344494507203983863095131101667778518890707239941344790" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-237344494507203983863095131101667778518890707239941344790" ) );
|
||||
|
||||
result = QCA::BigInteger( "-286399096802321907543674770412181810379003627366516307780436082546" )
|
||||
+= QCA::BigInteger( "6433131620680089024037442172197761714707480582555136398379812339597187475099646442833150194" );
|
||||
QCOMPARE( result.toString(), QString( "6433131620680089024037441885798664912385573038880365986198001960593560108583338662397067648" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "6433131620680089024037441885798664912385573038880365986198001960593560108583338662397067648" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "6433131620680089024037441885798664912385573038880365986198001960593560108583338662397067648" ) );
|
||||
|
||||
result = QCA::BigInteger( "181180339077102369559537817583627894783322804181859729574752442572146800569023773490164987520541203125338295785763244283224569259250011493" )
|
||||
+= QCA::BigInteger( "-1199127665773503170250307078028035875479459397657178356959526245067549497129923023348187933280753018204983010837846725666878521137637491" );
|
||||
QCOMPARE( result.toString(), QString( "179981211411328866389287510505599858907843344784202551217792916327079251071893850466816799587260450107133312774925397557557690738112374002" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "179981211411328866389287510505599858907843344784202551217792916327079251071893850466816799587260450107133312774925397557557690738112374002" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "179981211411328866389287510505599858907843344784202551217792916327079251071893850466816799587260450107133312774925397557557690738112374002" ) );
|
||||
|
||||
result = QCA::BigInteger( "-64140201395555533811408642891620184652051275811075926176282032144915585503450776768366775652419022149512034611311149858695307750874152" )
|
||||
+= QCA::BigInteger( "174441039" );
|
||||
QCOMPARE( result.toString(), QString( "-64140201395555533811408642891620184652051275811075926176282032144915585503450776768366775652419022149512034611311149858695307576433113" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-64140201395555533811408642891620184652051275811075926176282032144915585503450776768366775652419022149512034611311149858695307576433113" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-64140201395555533811408642891620184652051275811075926176282032144915585503450776768366775652419022149512034611311149858695307576433113" ) );
|
||||
|
||||
result = QCA::BigInteger( "1272757944308835857208037878018507337530557445422230495561634616503724419877512717512360239259640193513601352202821462208896049331599624285621" )
|
||||
+= QCA::BigInteger( "7326562354017884140300121264633612334070903165496641915889499701\
|
||||
38457507491850467631029977010" );
|
||||
QCOMPARE( result.toString(), QString( "1272757944308835857208037878018507337530557445422963151797036404917754432003976078745767329576189857705190302172959919716387899799230654262631" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "1272757944308835857208037878018507337530557445422963151797036404917754432003976078745767329576189857705190302172959919716387899799230654262631" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "1272757944308835857208037878018507337530557445422963151797036404917754432003976078745767329576189857705190302172959919716387899799230654262631" ) );
|
||||
|
||||
result = QCA::BigInteger( "-296171972628230" )
|
||||
+= QCA::BigInteger( "-8295766099121843219000823699362222865173820102569731517716391727126741710202086962877467940292139" );
|
||||
QCOMPARE( result.toString(), QString( "-8295766099121843219000823699362222865173820102569731517716391727126741710202086963173639912920369" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-8295766099121843219000823699362222865173820102569731517716391727126741710202086963173639912920369" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-8295766099121843219000823699362222865173820102569731517716391727126741710202086963173639912920369" ) );
|
||||
|
||||
result = QCA::BigInteger( "746985914068199510024843682108839444828414222769191520615967632362127522466922882591" )
|
||||
+= QCA::BigInteger( "-20487191102299831461877807785745372724903547246374023" );
|
||||
QCOMPARE( result.toString(), QString( "746985914068199510024843682108818957637311922937729642808181886989402618919676508568" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "746985914068199510024843682108818957637311922937729642808181886989402618919676508568" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "746985914068199510024843682108818957637311922937729642808181886989402618919676508568" ) );
|
||||
|
||||
result = QCA::BigInteger( "-4" )
|
||||
+= QCA::BigInteger( "-2344390090753264806043234960981151613122271366762590006930318876906455201397017135" );
|
||||
QCOMPARE( result.toString(), QString( "-2344390090753264806043234960981151613122271366762590006930318876906455201397017139" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-2344390090753264806043234960981151613122271366762590006930318876906455201397017139" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-2344390090753264806043234960981151613122271366762590006930318876906455201397017139" ) );
|
||||
|
||||
result = QCA::BigInteger( "-44876180273995737337769331875058141129678736711749946388832275767882143882764" )
|
||||
+= QCA::BigInteger( "20982187786" );
|
||||
QCOMPARE( result.toString(), QString( "-44876180273995737337769331875058141129678736711749946388832275767861161694978" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-44876180273995737337769331875058141129678736711749946388832275767861161694978" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-44876180273995737337769331875058141129678736711749946388832275767861161694978" ) );
|
||||
|
||||
result = QCA::BigInteger( "-6019440082648243511340058232981487443695615379104154368957939907896782179207195666302228625496897271988494" )
|
||||
+= QCA::BigInteger( "532566302499155416003316607801593784583652720754079760364736422291735917382015688217276924340984564880" );
|
||||
QCOMPARE( result.toString(), QString( "-6018907516345744355924054916373685849911031726383400289197575171474490443289813650614011348572556287423614" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-6018907516345744355924054916373685849911031726383400289197575171474490443289813650614011348572556287423614" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-6018907516345744355924054916373685849911031726383400289197575171474490443289813650614011348572556287423614" ) );
|
||||
|
||||
result = QCA::BigInteger( "-73755471563616026847726349357167530833850959662921059052928229237814728719448868719278211294785998253117976812683153264088230182865250970217610487" )
|
||||
+= QCA::BigInteger( "-30100016097092378349958946184353117306134810372681" );
|
||||
QCOMPARE( result.toString(), QString( "-73755471563616026847726349357167530833850959662921059052928229237814728719448868719278211294786028353134073905061503223034414535982557105027983168" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-73755471563616026847726349357167530833850959662921059052928229237814728719448868719278211294786028353134073905061503223034414535982557105027983168" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-73755471563616026847726349357167530833850959662921059052928229237814728719448868719278211294786028353134073905061503223034414535982557105027983168" ) );
|
||||
|
||||
result = QCA::BigInteger( "-2211177066689704345686852756638946306674958952044447080285364283965878599873864667094550865713828159912" )
|
||||
+= QCA::BigInteger( "-5365560439372456892007565798761606781997269201538475736814780300517383963455858081652308237033460360040921820049494698892905680307378540208" );
|
||||
QCOMPARE( result.toString(), QString( "-5365560439372456892007565798761606784208446268228180082501633057156330270130817033696755317318824644006800419923359365987456546021206700120" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-5365560439372456892007565798761606784208446268228180082501633057156330270130817033696755317318824644006800419923359365987456546021206700120" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-5365560439372456892007565798761606784208446268228180082501633057156330270130817033696755317318824644006800419923359365987456546021206700120" ) );
|
||||
|
||||
result = QCA::BigInteger( "6074122512337108841968521649035076841633691574254417104144285970819068715158037023149867252146570418484850234979838064249373816163440" )
|
||||
+= QCA::BigInteger( "301843614094506325875637699" );
|
||||
QCOMPARE( result.toString(), QString( "6074122512337108841968521649035076841633691574254417104144285970819068715158037023149867252146570418484850536823452158755699691801139" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "6074122512337108841968521649035076841633691574254417104144285970819068715158037023149867252146570418484850536823452158755699691801139" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "6074122512337108841968521649035076841633691574254417104144285970819068715158037023149867252146570418484850536823452158755699691801139" ) );
|
||||
|
||||
result = QCA::BigInteger( "-518214776931158149908771340564348982010543985108065053479219152734659892042499774128809654713651547833087206893256740737426200715673766732196603988" )
|
||||
+= QCA::BigInteger( "-29835172557747693726115525887386137004674545311422557345658884038760353928226157702249175218280718951979" );
|
||||
QCOMPARE( result.toString(), QString( "-518214776931158149908771340564348982010544014943237611226912878850185779428636778803354966136208893491971245653610668963583902964848985012915555967" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-518214776931158149908771340564348982010544014943237611226912878850185779428636778803354966136208893491971245653610668963583902964848985012915555967" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-518214776931158149908771340564348982010544014943237611226912878850185779428636778803354966136208893491971245653610668963583902964848985012915555967" ) );
|
||||
|
||||
result = QCA::BigInteger( "15937412249227240968245047444122" )
|
||||
+= QCA::BigInteger( "186214680376169426108822450700978827886569053440254258585576645530381613666540347032550716844628275956253" );
|
||||
QCOMPARE( result.toString(), QString( "186214680376169426108822450700978827886569053440254258585576645530381613682477759281777957812873323400375" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "186214680376169426108822450700978827886569053440254258585576645530381613682477759281777957812873323400375" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "186214680376169426108822450700978827886569053440254258585576645530381613682477759281777957812873323400375" ) );
|
||||
|
||||
result = QCA::BigInteger( "-12528010116258685855047504252928107623923105458701761707911969527003855713485846140551107967495813584097081777160" )
|
||||
+= QCA::BigInteger( "-539986280927242338236008809854961759996986302156061552378097160849129372827386927545686899193598721998757419572890" );
|
||||
QCOMPARE( result.toString(), QString( "-552514291043501024091056314107889867620909407614763314086009130376133228540872773686238007161094535582854501350050" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-552514291043501024091056314107889867620909407614763314086009130376133228540872773686238007161094535582854501350050" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-552514291043501024091056314107889867620909407614763314086009130376133228540872773686238007161094535582854501350050" ) );
|
||||
|
||||
result = QCA::BigInteger( "-2454746908" )
|
||||
+= QCA::BigInteger( "-3822957127889394780055242156360370187075592078655552376050604679934415014573879513870030211860839641756441626913419699098985245833920954444218" );
|
||||
QCOMPARE( result.toString(), QString( "-3822957127889394780055242156360370187075592078655552376050604679934415014573879513870030211860839641756441626913419699098985245833923409191126" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-3822957127889394780055242156360370187075592078655552376050604679934415014573879513870030211860839641756441626913419699098985245833923409191126" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-3822957127889394780055242156360370187075592078655552376050604679934415014573879513870030211860839641756441626913419699098985245833923409191126" ) );
|
||||
|
||||
|
||||
result = QCA::BigInteger( "-54288706131860071583318409080596095357980447323635" )
|
||||
+= QCA::BigInteger( "-425339410556015631098973742993327323051438456819027069606294261157940297643297240559452124432779202181589763874" );
|
||||
QCOMPARE( result.toString(), QString( "-425339410556015631098973742993327323051438456819027069606294315446646429503368823877861205028874560162037087509" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-425339410556015631098973742993327323051438456819027069606294315446646429503368823877861205028874560162037087509" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-425339410556015631098973742993327323051438456819027069606294315446646429503368823877861205028874560162037087509" ) );
|
||||
|
||||
result = QCA::BigInteger( "1418766894051319870818496026367686195459604395660119754151922014257535705077512233275240217434104" )
|
||||
+= QCA::BigInteger( "-111987390206074845527" );
|
||||
QCOMPARE( result.toString(), QString( "1418766894051319870818496026367686195459604395660119754151922014257535705077400245885034142588577" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "1418766894051319870818496026367686195459604395660119754151922014257535705077400245885034142588577" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "1418766894051319870818496026367686195459604395660119754151922014257535705077400245885034142588577" ) );
|
||||
|
||||
result = QCA::BigInteger( "-690410131860410477456103857594543515409677479242833618634809302452962600476353286822550168231234854116465153078845744722987447719420052500874721214723" )
|
||||
+= QCA::BigInteger( "-2584690377433946747311356992432788361455494791066739384837409609897387109736539600623155880918146331681272708396146283818299" );
|
||||
QCOMPARE( result.toString(), QString( "-690410131860410477456103860179233892843624226554190611067597663908457391543092671659959778128621963853004753702001625641133779400692760897021005033022" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-690410131860410477456103860179233892843624226554190611067597663908457391543092671659959778128621963853004753702001625641133779400692760897021005033022" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-690410131860410477456103860179233892843624226554190611067597663908457391543092671659959778128621963853004753702001625641133779400692760897021005033022" ) );
|
||||
|
||||
result = QCA::BigInteger( "-2326153002179462643778624079324592172489363679671158" )
|
||||
+= QCA::BigInteger( "-109819757548464054181938329012610459679" );
|
||||
QCOMPARE( result.toString(), QString( "-2326153002179572463536172543378774110818376290130837" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-2326153002179572463536172543378774110818376290130837" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-2326153002179572463536172543378774110818376290130837" ) );
|
||||
|
||||
result = QCA::BigInteger( "-4428752250566525488353857709194941742993785578807911414016959206453045495320705299466107784149485981354180907411034982168391" )
|
||||
+= QCA::BigInteger( "-39247778259374215325521768005388007526581235832446540589720560855741992694947322437679214611686905696" );
|
||||
QCOMPARE( result.toString(), QString( "-4428752250566525488353896956973201117209111100575916802024485787688877941861295020026963526142180928676618586625646669074087" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-4428752250566525488353896956973201117209111100575916802024485787688877941861295020026963526142180928676618586625646669074087" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-4428752250566525488353896956973201117209111100575916802024485787688877941861295020026963526142180928676618586625646669074087" ) );
|
||||
|
||||
result = QCA::BigInteger( "3047" )
|
||||
+= QCA::BigInteger( "-73564587850313153523776932163719610733433776890390204618040173797196000100856070829277943048343156165795282307508135277641315214" );
|
||||
QCOMPARE( result.toString(), QString( "-73564587850313153523776932163719610733433776890390204618040173797196000100856070829277943048343156165795282307508135277641312167" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-73564587850313153523776932163719610733433776890390204618040173797196000100856070829277943048343156165795282307508135277641312167" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-73564587850313153523776932163719610733433776890390204618040173797196000100856070829277943048343156165795282307508135277641312167" ) );
|
||||
|
||||
result = QCA::BigInteger( "71397189765381049110362731262243394989390499523719445987286843598407339615555456955143712741779487184644001767776382991377987516772847242986" )
|
||||
+= QCA::BigInteger( "-5821969555717973232123574849275726788359152255219972775831" );
|
||||
QCOMPARE( result.toString(), QString( "71397189765381049110362731262243394989390499523719445987286843598407339615555456949321743186061513952520426918500656203018835261552874467155" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "71397189765381049110362731262243394989390499523719445987286843598407339615555456949321743186061513952520426918500656203018835261552874467155" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "71397189765381049110362731262243394989390499523719445987286843598407339615555456949321743186061513952520426918500656203018835261552874467155" ) );
|
||||
|
||||
result = QCA::BigInteger( "-181409752656613138777964092635909379021826360390960647186726991165227400176766831466541160049935205507919070233410228328274" )
|
||||
+= QCA::BigInteger( "-523301382154855044703947051892202646490840761177533623732372519689918420769842424772676407501350528096714904915297347684247802773107355881667545916901" );
|
||||
QCOMPARE( result.toString(), QString( "-523301382154855044703947052073612399147453899955497716368281898711744781160803071959403398666577928273481736381838507734183008281026426115077774245175" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-523301382154855044703947052073612399147453899955497716368281898711744781160803071959403398666577928273481736381838507734183008281026426115077774245175" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-523301382154855044703947052073612399147453899955497716368281898711744781160803071959403398666577928273481736381838507734183008281026426115077774245175" ) );
|
||||
|
||||
result = QCA::BigInteger( "6858961373707073067" )
|
||||
+= QCA::BigInteger( "-334051508933893061433844279764271107181974906283364991309903077649971606436918071327072869826471946094594594115614990907" );
|
||||
QCOMPARE( result.toString(), QString( "-334051508933893061433844279764271107181974906283364991309903077649971606436918071327072869826471946087735632741907917840" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-334051508933893061433844279764271107181974906283364991309903077649971606436918071327072869826471946087735632741907917840" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-334051508933893061433844279764271107181974906283364991309903077649971606436918071327072869826471946087735632741907917840" ) );
|
||||
|
||||
result = QCA::BigInteger( "-23635098930374569407171906960429616870908424281519944658490940109956689534874971218650241680916564611" )
|
||||
+= QCA::BigInteger( "-18958917875779522833599589133142827952448539301142718746979271443846670235982743793439686626736428198541647202983677887505430060922528525205" );
|
||||
QCOMPARE( result.toString(), QString( "-18958917875779522833599589133142827952472174400073093316386443350807099852853652217721206571394919138651603892518552858724080302603445089816" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-18958917875779522833599589133142827952472174400073093316386443350807099852853652217721206571394919138651603892518552858724080302603445089816" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-18958917875779522833599589133142827952472174400073093316386443350807099852853652217721206571394919138651603892518552858724080302603445089816" ) );
|
||||
|
||||
// Botan's subtraction tests
|
||||
result = QCA::BigInteger( "0" )
|
||||
-= QCA::BigInteger( "0" );
|
||||
QCOMPARE( result.toString(), QString( "0" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "0" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "0" ) );
|
||||
|
||||
result = QCA::BigInteger( "0" )
|
||||
-= QCA::BigInteger( "1" );
|
||||
QCOMPARE( result.toString(), QString( "-1" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-1" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-1" ) );
|
||||
|
||||
result = QCA::BigInteger( "0" )
|
||||
-= QCA::BigInteger( "4294967296" );
|
||||
QCOMPARE( result.toString(), QString( "-4294967296" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-4294967296" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-4294967296" ) );
|
||||
|
||||
// Next test is labelled # 2^512 - 1
|
||||
result = QCA::BigInteger( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084095" )
|
||||
-= QCA::BigInteger( "1" );
|
||||
QCOMPARE( result.toString(), QString( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084094" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084094" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "13407807929942597099574024998205846127479365820592393377723561443721764030073546976801874298166903427690031858186486050853753882811946569946433649006084094" ) );
|
||||
|
||||
result = QCA::BigInteger( "89094716573076464980713547115099137014719483620102078148320806773871083148864" )
|
||||
-= QCA::BigInteger( "49505213825110728957828173754776257356620450607893971553289366249708672306581" );
|
||||
QCOMPARE( result.toString(), QString( "39589502747965736022885373360322879658099033012208106595031440524162410842283" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "39589502747965736022885373360322879658099033012208106595031440524162410842283" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "39589502747965736022885373360322879658099033012208106595031440524162410842283" ) );
|
||||
|
||||
result = QCA::BigInteger( "65894747009896006767807716946835412110318548717263922395390971078905789585431" )
|
||||
-= QCA::BigInteger( "3884269741925508225990715416862047284194603799902650748631039608684367281358" );
|
||||
QCOMPARE( result.toString(), QString( "62010477267970498541817001529973364826123944917361271646759931470221422304073" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "62010477267970498541817001529973364826123944917361271646759931470221422304073" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "62010477267970498541817001529973364826123944917361271646759931470221422304073" ) );
|
||||
|
||||
result = QCA::BigInteger( "5950196396451977566902121301707054218364717196893101360011491777761952253736964709165962613347710607164178682987783755894811024288429224592316636383" )
|
||||
-= QCA::BigInteger( "8750653273562160761286422180115618621879821429145276197424652349306577311499807887070429373153777028581165316131683348567" );
|
||||
QCOMPARE( result.toString(), QString( "5950196396451977566902121292956400944802556435606679179895873155882130824591688511741310264041133295664370795917354382741033995707263908460633287816" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "5950196396451977566902121292956400944802556435606679179895873155882130824591688511741310264041133295664370795917354382741033995707263908460633287816" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "5950196396451977566902121292956400944802556435606679179895873155882130824591688511741310264041133295664370795917354382741033995707263908460633287816" ) );
|
||||
|
||||
result = QCA::BigInteger( "9815262808265519920770782360080149146267723690" )
|
||||
-= QCA::BigInteger( "14067005768891609281364919358115291341352189918255780397560060748765650205261663193732434161580120817" );
|
||||
QCOMPARE( result.toString(), QString( "-14067005768891609281364919358115291341352189918255780387744797940500130284490880833652285015312397127" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-14067005768891609281364919358115291341352189918255780387744797940500130284490880833652285015312397127" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-14067005768891609281364919358115291341352189918255780387744797940500130284490880833652285015312397127" ) );
|
||||
|
||||
result = QCA::BigInteger( "-390149102941948621568479722346940666704376013734485343840154221605853412503154993878886490867020934777530894593416337175399865065870417717658815158195790" )
|
||||
-= QCA::BigInteger( "1456031684988128870809574635750149625240648487837308" );
|
||||
QCOMPARE( result.toString(), QString( "-390149102941948621568479722346940666704376013734485343840154221605853412503154993878886490867020934778986926278404466046209439701620567342899463646033098" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-390149102941948621568479722346940666704376013734485343840154221605853412503154993878886490867020934778986926278404466046209439701620567342899463646033098" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-390149102941948621568479722346940666704376013734485343840154221605853412503154993878886490867020934778986926278404466046209439701620567342899463646033098" ) );
|
||||
|
||||
result = QCA::BigInteger( "7473774301764883450943" )
|
||||
-= QCA::BigInteger( "-26256369859367890755157372820052387483402723790185562908491933812453" );
|
||||
QCOMPARE( result.toString(), QString( "26256369859367890755157372820052387483402723797659337210256817263396" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "26256369859367890755157372820052387483402723797659337210256817263396" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "26256369859367890755157372820052387483402723797659337210256817263396" ) );
|
||||
|
||||
result = QCA::BigInteger( "36246343251214922024139186757009148849295485593397952003237349660142296147421019916619944353877490544706223768684758263065399016597969" )
|
||||
-= QCA::BigInteger( "2574427901445527995149185461475228850098549655325125750771680756403104624569522792792597223218143154924988199562355517064962665954307425375180" );
|
||||
QCOMPARE( result.toString(), QString( "-2574427865199184743934263437336042093089400806029640157373728753165754964427226645371577306598198801047497654856131748380204402888908408777211" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-2574427865199184743934263437336042093089400806029640157373728753165754964427226645371577306598198801047497654856131748380204402888908408777211" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-2574427865199184743934263437336042093089400806029640157373728753165754964427226645371577306598198801047497654856131748380204402888908408777211" ) );
|
||||
|
||||
result = QCA::BigInteger( "30129746266682790628283889040897642317014108334116727" )
|
||||
-= QCA::BigInteger( "-1580480523895398762563721715474380903630073871362143915864398724834897608423" );
|
||||
QCOMPARE( result.toString(), QString( "1580480523895398762563751845220647586420702155251184813506715738943231725150" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "1580480523895398762563751845220647586420702155251184813506715738943231725150" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "1580480523895398762563751845220647586420702155251184813506715738943231725150" ) );
|
||||
|
||||
result = QCA::BigInteger( "-4614735863800137951667138933166372061" )
|
||||
-= QCA::BigInteger( "87175694379075561307234146162193190462135078700346746992273" );
|
||||
QCOMPARE( result.toString(), QString( "-87175694379075561307238760898056990600086745839279913364334" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-87175694379075561307238760898056990600086745839279913364334" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-87175694379075561307238760898056990600086745839279913364334" ) );
|
||||
|
||||
result = QCA::BigInteger( "-3753904" )
|
||||
-= QCA::BigInteger( "-11269137783745339515071988205310702154422777729974" );
|
||||
QCOMPARE( result.toString(), QString( "11269137783745339515071988205310702154422773976070" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "11269137783745339515071988205310702154422773976070" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "11269137783745339515071988205310702154422773976070" ) );
|
||||
|
||||
result = QCA::BigInteger( "592523948495379440082021279738170088402918858455470050140652787171830058864932939900794505955437856926902975870288" )
|
||||
-= QCA::BigInteger( "-205854658295495452479104108497931263758143158076949293929661651111" );
|
||||
QCOMPARE( result.toString(), QString( "592523948495379440082021279738170088402918858455675904798948282624309162973430871164552649113514806220832637521399" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "592523948495379440082021279738170088402918858455675904798948282624309162973430871164552649113514806220832637521399" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "592523948495379440082021279738170088402918858455675904798948282624309162973430871164552649113514806220832637521399" ) );
|
||||
|
||||
result = QCA::BigInteger( "-33993701617495591491176844355" )
|
||||
-= QCA::BigInteger( "3438065097398894672826284379125235190693300918673662774192379185002391232383325160416036963599856704698280" );
|
||||
QCOMPARE( result.toString(), QString( "-3438065097398894672826284379125235190693300918673662774192379185002391232383359154117654459191347881542635" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-3438065097398894672826284379125235190693300918673662774192379185002391232383359154117654459191347881542635" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-3438065097398894672826284379125235190693300918673662774192379185002391232383359154117654459191347881542635" ) );
|
||||
|
||||
result = QCA::BigInteger( "26876428790838270949718735111909136008255051776703" )
|
||||
-= QCA::BigInteger( "-1781128112966810373286192008831149275546995635268767241859967609117529616872536681035700534316457543887601645022" );
|
||||
QCOMPARE( result.toString(), QString( "1781128112966810373286192008831149275546995635268767241859967635993958407710807630754435646225593552142653421725" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "1781128112966810373286192008831149275546995635268767241859967635993958407710807630754435646225593552142653421725" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "1781128112966810373286192008831149275546995635268767241859967635993958407710807630754435646225593552142653421725" ) );
|
||||
|
||||
result = QCA::BigInteger( "2059771092932179758019770618974659367350250375647433386639519387\
|
||||
69317693429941871882153770641334267205446421916220398066553188" )
|
||||
-= QCA::BigInteger( "3342500267594994347156312297990633112620923791590960237694328174171473763026" );
|
||||
QCOMPARE( result.toString(), QString( "205977109293217975801977061897465936735025037564739996163684343774970537117643881249041149717542676245208727588046226592790162" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "205977109293217975801977061897465936735025037564739996163684343774970537117643881249041149717542676245208727588046226592790162" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "205977109293217975801977061897465936735025037564739996163684343774970537117643881249041149717542676245208727588046226592790162" ) );
|
||||
|
||||
result = QCA::BigInteger( "5545520403000578843599072515870982842927227412121917598877293331575380404618111609" )
|
||||
-= QCA::BigInteger( "5991287327241003718821424770352575362437680738923552868139860461945460339860477495902" );
|
||||
QCOMPARE( result.toString(), QString( "-5985741806838003139977825697836704379594753511511430950540983168613884959455859384293" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-5985741806838003139977825697836704379594753511511430950540983168613884959455859384293" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-5985741806838003139977825697836704379594753511511430950540983168613884959455859384293" ) );
|
||||
|
||||
result = QCA::BigInteger( "248039029608125071340" )
|
||||
-= QCA::BigInteger( "3664608673" );
|
||||
QCOMPARE( result.toString(), QString( "248039029604460462667" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "248039029604460462667" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "248039029604460462667" ) );
|
||||
|
||||
result = QCA::BigInteger( "15425705711415937103627" )
|
||||
-= QCA::BigInteger( "-1435504065517745703440045276868982910754081405474123003767554211132837427846963435621523810229738262235546179779885824" );
|
||||
QCOMPARE( result.toString(), QString( "1435504065517745703440045276868982910754081405474123003767554211132837427846963435621523810229753687941257595716989451" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "1435504065517745703440045276868982910754081405474123003767554211132837427846963435621523810229753687941257595716989451" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "1435504065517745703440045276868982910754081405474123003767554211132837427846963435621523810229753687941257595716989451" ) );
|
||||
|
||||
result = QCA::BigInteger( "50882847205108645607281568922683652688671738236030732914347600821086" )
|
||||
-= QCA::BigInteger( "12176160963158" );
|
||||
QCOMPARE( result.toString(), QString( "50882847205108645607281568922683652688671738236030732902171439857928" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "50882847205108645607281568922683652688671738236030732902171439857928" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "50882847205108645607281568922683652688671738236030732902171439857928" ) );
|
||||
|
||||
result = QCA::BigInteger( "-35426518565985818947670047877033022885542172461973566228509771053416312543201815881190953762207629232160412058300173038824256783171761132" )
|
||||
-= QCA::BigInteger( "-4864862607366468843184694353123830534588538011093812418208808135799" );
|
||||
QCOMPARE( result.toString(), QString( "-35426518565985818947670047877033022885542172461973566228509771053416307678339208514722110577513276108329877469762161945011838574363625333" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-35426518565985818947670047877033022885542172461973566228509771053416307678339208514722110577513276108329877469762161945011838574363625333" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-35426518565985818947670047877033022885542172461973566228509771053416307678339208514722110577513276108329877469762161945011838574363625333" ) );
|
||||
|
||||
result = QCA::BigInteger( "-1428596214712268310382144828171384812520179141608121870013556402879770424002218157546599921571184" )
|
||||
-= QCA::BigInteger( "-4054101" );
|
||||
QCOMPARE( result.toString(), QString( "-1428596214712268310382144828171384812520179141608121870013556402879770424002218157546599917517083" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-1428596214712268310382144828171384812520179141608121870013556402879770424002218157546599917517083" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-1428596214712268310382144828171384812520179141608121870013556402879770424002218157546599917517083" ) );
|
||||
|
||||
result = QCA::BigInteger( "-200931" )
|
||||
-= QCA::BigInteger( "-44558802460130495759482832913160717791151786725570519475449607659705171682283111490834930835045735142966847483009157514950177565952218520297258834187372" );
|
||||
QCOMPARE( result.toString(), QString( "44558802460130495759482832913160717791151786725570519475449607659705171682283111490834930835045735142966847483009157514950177565952218520297258833986441" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "44558802460130495759482832913160717791151786725570519475449607659705171682283111490834930835045735142966847483009157514950177565952218520297258833986441" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "44558802460130495759482832913160717791151786725570519475449607659705171682283111490834930835045735142966847483009157514950177565952218520297258833986441" ) );
|
||||
|
||||
result = QCA::BigInteger( "105704314890799915321259" )
|
||||
-= QCA::BigInteger( "827923545945076415574912438499169814414563066877494100831657761190490697473854369477784874118787495351405549803329615347120938123226038208" );
|
||||
QCOMPARE( result.toString(), QString( "-827923545945076415574912438499169814414563066877494100831657761190490697473854369477784874118787495351405549803329509642806047323310716949" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-827923545945076415574912438499169814414563066877494100831657761190490697473854369477784874118787495351405549803329509642806047323310716949" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-827923545945076415574912438499169814414563066877494100831657761190490697473854369477784874118787495351405549803329509642806047323310716949" ) );
|
||||
|
||||
result = QCA::BigInteger( "1448979433940064018828919290452280235308901982649341" )
|
||||
-= QCA::BigInteger( "303926827425887072291878308433008512899006711759770318009" );
|
||||
QCOMPARE( result.toString(), QString( "-303925378446453132227859479513718060618771402857787668668" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-303925378446453132227859479513718060618771402857787668668" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-303925378446453132227859479513718060618771402857787668668" ) );
|
||||
|
||||
result = QCA::BigInteger( "-243237595290235750457450892290434789864" )
|
||||
-= QCA::BigInteger( "19817702076334276402981273067417321098467533300947463865383702005126562800253466403934608765512316565811954342319565128573969" );
|
||||
QCOMPARE( result.toString(), QString( "-19817702076334276402981273067417321098467533300947463865383702005126562800253466403934852003107606801562411793211855563363833" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-19817702076334276402981273067417321098467533300947463865383702005126562800253466403934852003107606801562411793211855563363833" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-19817702076334276402981273067417321098467533300947463865383702005126562800253466403934852003107606801562411793211855563363833" ) );
|
||||
|
||||
result = QCA::BigInteger( "294037338365659932242802023634" )
|
||||
-= QCA::BigInteger( "4401245995535867764294876849802142926077599828776505639975554254356763769548465" );
|
||||
QCOMPARE( result.toString(), QString( "-4401245995535867764294876849802142926077599828776211602637188594424520967524831" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-4401245995535867764294876849802142926077599828776211602637188594424520967524831" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-4401245995535867764294876849802142926077599828776211602637188594424520967524831" ) );
|
||||
|
||||
result = QCA::BigInteger( "7303853946195223307036710881687367004566538357189824031021831088365362" )
|
||||
-= QCA::BigInteger( "119286025999378935715794641163321741" );
|
||||
QCOMPARE( result.toString(), QString( "7303853946195223307036710881687366885280512357810888315227189925043621" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "7303853946195223307036710881687366885280512357810888315227189925043621" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "7303853946195223307036710881687366885280512357810888315227189925043621" ) );
|
||||
|
||||
result = QCA::BigInteger( "571167355343287235687602610714110416067426289363505412908804940696550592413192300554016875" )
|
||||
-= QCA::BigInteger( "15872188842802631759540597" );
|
||||
QCOMPARE( result.toString(), QString( "571167355343287235687602610714110416067426289363505412908804940680678403570389668794476278" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "571167355343287235687602610714110416067426289363505412908804940680678403570389668794476278" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "571167355343287235687602610714110416067426289363505412908804940680678403570389668794476278" ) );
|
||||
|
||||
result = QCA::BigInteger( "1002240129784524388754179399598974973256811336031329881209395070412702275169416754240" )
|
||||
-= QCA::BigInteger( "59429482478860591343145393540420033516478305952872349006715789477946474753657206800070515207967709079933420746952" );
|
||||
QCOMPARE( result.toString(), QString( "-59429482478860591343145393539417793386693781564118169607116814504689663417625876918861120137555006804764003992712" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-59429482478860591343145393539417793386693781564118169607116814504689663417625876918861120137555006804764003992712" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-59429482478860591343145393539417793386693781564118169607116814504689663417625876918861120137555006804764003992712" ) );
|
||||
|
||||
result = QCA::BigInteger( "1370431648825444838359719050380239722263203134555431526491525074601463042144798545817957389" )
|
||||
-= QCA::BigInteger( "3473869878" );
|
||||
QCOMPARE( result.toString(), QString( "1370431648825444838359719050380239722263203134555431526491525074601463042144798542344087511" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "1370431648825444838359719050380239722263203134555431526491525074601463042144798542344087511" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "1370431648825444838359719050380239722263203134555431526491525074601463042144798542344087511" ) );
|
||||
|
||||
result = QCA::BigInteger( "8548280229254726209" )
|
||||
-= QCA::BigInteger( "33066125035269904981849320434016892734943145935582141989968280846973981913056248918" );
|
||||
QCOMPARE( result.toString(), QString( "-33066125035269904981849320434016892734943145935582141989968280838425701683801522709" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-33066125035269904981849320434016892734943145935582141989968280838425701683801522709" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-33066125035269904981849320434016892734943145935582141989968280838425701683801522709" ) );
|
||||
|
||||
result = QCA::BigInteger( "-19023558832687506489508150795966332175990129963029928958584170111759630293276939647334082100169102538364437859846398095065171936899503" )
|
||||
-= QCA::BigInteger( "24899271127523545342283468762809653407638631966220124695751976894193103779443050843040771191227522843088079031762445684377195650493065096847292797" );
|
||||
QCOMPARE( result.toString(), QString( "-24899271127542568901116156269299161558434598298396114825715006823151687949554810473334048130874856925188248134300810122237042048588130268784192300" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-24899271127542568901116156269299161558434598298396114825715006823151687949554810473334048130874856925188248134300810122237042048588130268784192300" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-24899271127542568901116156269299161558434598298396114825715006823151687949554810473334048130874856925188248134300810122237042048588130268784192300" ) );
|
||||
|
||||
result = QCA::BigInteger( "-1800353575522706389288305623797196690530870204356722928042061228497437075035917720399302198953687023" )
|
||||
-= QCA::BigInteger( "-11875668261530466053708538730940776412171106483072624532757177471384128016458332544642788404765469924496127460164" );
|
||||
QCOMPARE( result.toString(), QString( "11875668261528665700133016024551488106547309286382093662552820748456085955229835107567752487045070622297173773141" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "11875668261528665700133016024551488106547309286382093662552820748456085955229835107567752487045070622297173773141" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "11875668261528665700133016024551488106547309286382093662552820748456085955229835107567752487045070622297173773141" ) );
|
||||
|
||||
result = QCA::BigInteger( "-29861551039945217879" )
|
||||
-= QCA::BigInteger( "1113473025916855642353456146647542930581669082348409639697282960877889226500319996380838232582376232872868947624793789212829885934" );
|
||||
QCOMPARE( result.toString(), QString( "-1113473025916855642353456146647542930581669082348409639697282960877889226500319996380838232582376232872868947654655340252775103813" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-1113473025916855642353456146647542930581669082348409639697282960877889226500319996380838232582376232872868947654655340252775103813" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-1113473025916855642353456146647542930581669082348409639697282960877889226500319996380838232582376232872868947654655340252775103813" ) );
|
||||
|
||||
result = QCA::BigInteger( "565532963656761153838218277564957917658707297649757920676303301655328103665512287797108510139837643506491641987188791892506290" )
|
||||
-= QCA::BigInteger( "-2188105671531473889939411772533707" );
|
||||
QCOMPARE( result.toString(), QString( "565532963656761153838218277564957917658707297649757920676303301655328103665512287797108510142025749178023115877128203665039997" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "565532963656761153838218277564957917658707297649757920676303301655328103665512287797108510142025749178023115877128203665039997" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "565532963656761153838218277564957917658707297649757920676303301655328103665512287797108510142025749178023115877128203665039997" ) );
|
||||
|
||||
result = QCA::BigInteger( "-349535960680522202843083381184496349093812380954435872337802226" )
|
||||
-= QCA::BigInteger( "-1829600726218222026679938" );
|
||||
QCOMPARE( result.toString(), QString( "-349535960680522202843083381184496349091982780228217650311122288" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-349535960680522202843083381184496349091982780228217650311122288" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-349535960680522202843083381184496349091982780228217650311122288" ) );
|
||||
|
||||
result = QCA::BigInteger( "-1" ) -= QCA::BigInteger( "-6726974989587128275" );
|
||||
QCOMPARE( result.toString(), QString( "6726974989587128274" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "6726974989587128274" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "6726974989587128274" ) );
|
||||
|
||||
result = QCA::BigInteger( "-107142709838121196902389095205618516687047338619382145236348309762148611647954748824" )
|
||||
-= QCA::BigInteger( "42484103615491" );
|
||||
QCOMPARE( result.toString(), QString( "-107142709838121196902389095205618516687047338619382145236348309762148654132058364315" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-107142709838121196902389095205618516687047338619382145236348309762148654132058364315" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-107142709838121196902389095205618516687047338619382145236348309762148654132058364315" ) );
|
||||
|
||||
result = QCA::BigInteger( "-90546630430085769764839607528116121381848878494574360812027599640018921358040178215575723" )
|
||||
-= QCA::BigInteger( "-118922408531468986902800063237122125617455464103913195171141030774109638861272017660698580914239435114280434761425243" );
|
||||
QCOMPARE( result.toString(), QString( "118922408531468986902800063146575495187369694339073587643024909392260760366697656848670981274220513756240256545849520" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "118922408531468986902800063146575495187369694339073587643024909392260760366697656848670981274220513756240256545849520" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "118922408531468986902800063146575495187369694339073587643024909392260760366697656848670981274220513756240256545849520" ) );
|
||||
|
||||
result = QCA::BigInteger( "-5545044667082427128801726416727657360001588430113578182850657573063241939882570324573086267287272360432363387213743735507218270373633222520429" )
|
||||
-= QCA::BigInteger( "-151423255459028627628896755237194376177115" );
|
||||
QCOMPARE( result.toString(), QString( "-5545044667082427128801726416727657360001588430113578182850657573063241939882570324573086267287272360280940131754715107878321515136438846343314" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-5545044667082427128801726416727657360001588430113578182850657573063241939882570324573086267287272360280940131754715107878321515136438846343314" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-5545044667082427128801726416727657360001588430113578182850657573063241939882570324573086267287272360280940131754715107878321515136438846343314" ) );
|
||||
|
||||
result = QCA::BigInteger( "-5247636471953421659649611318164848102069" )
|
||||
-= QCA::BigInteger( "-4024324110573096565232590473170599175885004" );
|
||||
QCOMPARE( result.toString(), QString( "4019076474101143143572940861852434327782935" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "4019076474101143143572940861852434327782935" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "4019076474101143143572940861852434327782935" ) );
|
||||
|
||||
result = QCA::BigInteger( "39412892606015043322484854253879371723186457838590224795040178472832" )
|
||||
-= QCA::BigInteger( "-5038321321957452145034687815432890684825466579123474921848465393400312" );
|
||||
QCOMPARE( result.toString(), QString( "5077734214563467188357172669686770056548653036962065146643505571873144" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "5077734214563467188357172669686770056548653036962065146643505571873144" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "5077734214563467188357172669686770056548653036962065146643505571873144" ) );
|
||||
|
||||
result = QCA::BigInteger( "-55979414588009227035683624505208766753187469727799640277204274207843317583292736333912783829528270272642583004969175230274821" )
|
||||
-= QCA::BigInteger( "-109633110576212669339535976775635762395927171313557427036242111476016398579345366908401334025571265714128108308032073779442181369365924213118258269679" );
|
||||
QCOMPARE( result.toString(), QString( "109633110576212669339535920796221174386700135629932921827475358288546670779705089704127126182253682421391774395248244251171908726782919243943027994858" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "109633110576212669339535920796221174386700135629932921827475358288546670779705089704127126182253682421391774395248244251171908726782919243943027994858" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "109633110576212669339535920796221174386700135629932921827475358288546670779705089704127126182253682421391774395248244251171908726782919243943027994858" ) );
|
||||
|
||||
result = QCA::BigInteger( "-38752353898173389347479216285772999906325286421302866854350737050533204094183249691110" )
|
||||
-= QCA::BigInteger( "2428819407377764342156426895396654728835493564788997075896393065230009911546390816091652653701035085361" );
|
||||
QCOMPARE( result.toString(), QString( "-2428819407377764380908780793570044076314709850561996982221679486532876765897127866624856747884284776471" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-2428819407377764380908780793570044076314709850561996982221679486532876765897127866624856747884284776471" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "-2428819407377764380908780793570044076314709850561996982221679486532876765897127866624856747884284776471" ) );
|
||||
|
||||
result = QCA::BigInteger( "-2784579005241382005249492720344" )
|
||||
-= QCA::BigInteger( "-164204542616919252351131740123094674" );
|
||||
QCOMPARE( result.toString(), QString( "164201758037914010969126490630374330" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "164201758037914010969126490630374330" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "164201758037914010969126490630374330" ) );
|
||||
|
||||
result = QCA::BigInteger( "200948857420871544747808060972375039052401280822505804851732868100" )
|
||||
-= QCA::BigInteger( "-795957177479360455258269298038670876462147576765875895105714" );
|
||||
QCOMPARE( result.toString(), QString( "200949653378049024108263319241673077723277742970082570727627973814" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "200949653378049024108263319241673077723277742970082570727627973814" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( "200949653378049024108263319241673077723277742970082570727627973814" ) );
|
||||
|
||||
result = QCA::BigInteger( "217570540819" )
|
||||
-= QCA::BigInteger( "121955083597720420983384282166693307394185530431368476834980748302158718406063500763434561937200696970170700" );
|
||||
QCOMPARE( result.toString(), QString( "-121955083597720420983384282166693307394185530431368476834980748302158718406063500763434561937200479399629881" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( QString("-121955083597720420983384282166693307394185530431368476834980748302158718406063500763434561937200479399629881" ) ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-121955083597720420983384282166693307394185530431368476834980748302158718406063500763434561937200479399629881" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( QStringLiteral("-121955083597720420983384282166693307394185530431368476834980748302158718406063500763434561937200479399629881" ) ) );
|
||||
|
||||
result = QCA::BigInteger( QString("2335319252198456765380587281374076367944") )
|
||||
-= QCA::BigInteger( QString("-4500271") );
|
||||
QCOMPARE( result, QCA::BigInteger( QString( "2335319252198456765380587281374080868215" ) ) );
|
||||
result = QCA::BigInteger( QStringLiteral("2335319252198456765380587281374076367944") )
|
||||
-= QCA::BigInteger( QStringLiteral("-4500271") );
|
||||
QCOMPARE( result, QCA::BigInteger( QStringLiteral( "2335319252198456765380587281374080868215" ) ) );
|
||||
|
||||
result = QCA::BigInteger( QString("-393694614027544181700073367147249369966344727230221941008713805434207925307052598" ) )
|
||||
-= QCA::BigInteger( QString("-153972676737062409261153899615588515236137907791841623991260363840680295565313157972489168132345521780658007459602823125797806770" ) );
|
||||
QCOMPARE( result.toString(), QString( "153972676737062409261153899615588515236137907791447929377232819658980222198165908602522823405115299839649293654168615200490754172" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( QString("153972676737062409261153899615588515236137907791447929377232819658980222198165908602522823405115299839649293654168615200490754172" ) ) );
|
||||
result = QCA::BigInteger( QStringLiteral("-393694614027544181700073367147249369966344727230221941008713805434207925307052598" ) )
|
||||
-= QCA::BigInteger( QStringLiteral("-153972676737062409261153899615588515236137907791841623991260363840680295565313157972489168132345521780658007459602823125797806770" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "153972676737062409261153899615588515236137907791447929377232819658980222198165908602522823405115299839649293654168615200490754172" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( QStringLiteral("153972676737062409261153899615588515236137907791447929377232819658980222198165908602522823405115299839649293654168615200490754172" ) ) );
|
||||
|
||||
result = QCA::BigInteger( QString("114832549702862263167") )
|
||||
-= QCA::BigInteger( QString("12921864907229959558745276418830287875386673600892281022286597165773569473039953984775959232814911435097412913078625") );
|
||||
QCOMPARE( result.toString(), QString( "-12921864907229959558745276418830287875386673600892281022286597165773569473039953984775959232814796602547710050815458" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( QString( "-12921864907229959558745276418830287875386673600892281022286597165773569473039953984775959232814796602547710050815458" ) ) );
|
||||
result = QCA::BigInteger( QStringLiteral("114832549702862263167") )
|
||||
-= QCA::BigInteger( QStringLiteral("12921864907229959558745276418830287875386673600892281022286597165773569473039953984775959232814911435097412913078625") );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "-12921864907229959558745276418830287875386673600892281022286597165773569473039953984775959232814796602547710050815458" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( QStringLiteral( "-12921864907229959558745276418830287875386673600892281022286597165773569473039953984775959232814796602547710050815458" ) ) );
|
||||
|
||||
result = QCA::BigInteger( QString( "6489502346837936889305337487724547956628371915228387374094443896266362105931065153072983425911767580294076594078932835008494777866083" ) )
|
||||
-= QCA::BigInteger( QString( "1099205476533612407829257935144627350486541654788267826664706620630745291371323154513322608446957760026881954001581" ) );
|
||||
QCOMPARE( result.toString(), QString( "6489502346837936888206132011190935548799113980083760023607902241478094279266358532442238134540444425780753985631975074981612823864502" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( QString("6489502346837936888206132011190935548799113980083760023607902241478094279266358532442238134540444425780753985631975074981612823864502" ) ) );
|
||||
result = QCA::BigInteger( QStringLiteral( "6489502346837936889305337487724547956628371915228387374094443896266362105931065153072983425911767580294076594078932835008494777866083" ) )
|
||||
-= QCA::BigInteger( QStringLiteral( "1099205476533612407829257935144627350486541654788267826664706620630745291371323154513322608446957760026881954001581" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "6489502346837936888206132011190935548799113980083760023607902241478094279266358532442238134540444425780753985631975074981612823864502" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( QStringLiteral("6489502346837936888206132011190935548799113980083760023607902241478094279266358532442238134540444425780753985631975074981612823864502" ) ) );
|
||||
|
||||
result = QCA::BigInteger( QString("169991144123958754253801313173662977337850870273358378951640521601077152994474340806917796870911557233689087716056557" ) )
|
||||
-= QCA::BigInteger( QString("-15409167") );
|
||||
QCOMPARE( result.toString(), QString( "169991144123958754253801313173662977337850870273358378951640521601077152994474340806917796870911557233689087731465724" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( QString("169991144123958754253801313173662977337850870273358378951640521601077152994474340806917796870911557233689087731465724") ) );
|
||||
result = QCA::BigInteger( QStringLiteral("169991144123958754253801313173662977337850870273358378951640521601077152994474340806917796870911557233689087716056557" ) )
|
||||
-= QCA::BigInteger( QStringLiteral("-15409167") );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "169991144123958754253801313173662977337850870273358378951640521601077152994474340806917796870911557233689087731465724" ) );
|
||||
QCOMPARE( result, QCA::BigInteger( QStringLiteral("169991144123958754253801313173662977337850870273358378951640521601077152994474340806917796870911557233689087731465724") ) );
|
||||
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,7 @@ void CertUnitTest::cleanupTestCase()
|
||||
void CertUnitTest::nullCert()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
// providersToTest.append("qca-botan");
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
@ -91,7 +91,7 @@ void CertUnitTest::nullCert()
|
||||
void CertUnitTest::noSuchFile()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
// providersToTest.append("qca-botan");
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
@ -99,7 +99,7 @@ void CertUnitTest::noSuchFile()
|
||||
QWARN( QString( "Certificate handling not supported for "+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QCA::ConvertResult resultNoFile;
|
||||
QCA::Certificate cert = QCA::Certificate::fromPEMFile( "thisIsJustaFileNameThatWeDontHave", &resultNoFile, provider);
|
||||
QCA::Certificate cert = QCA::Certificate::fromPEMFile( QStringLiteral("thisIsJustaFileNameThatWeDontHave"), &resultNoFile, provider);
|
||||
QCOMPARE( resultNoFile, QCA::ErrorFile );
|
||||
QVERIFY( cert.isNull() );
|
||||
}
|
||||
@ -109,7 +109,7 @@ void CertUnitTest::noSuchFile()
|
||||
void CertUnitTest::CAcertstest()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
// providersToTest.append("qca-botan");
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
@ -117,7 +117,7 @@ void CertUnitTest::CAcertstest()
|
||||
QWARN( QString( "Certificate handling not supported for "+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QCA::ConvertResult resultca1;
|
||||
QCA::Certificate ca1 = QCA::Certificate::fromPEMFile( "certs/RootCAcert.pem", &resultca1, provider);
|
||||
QCA::Certificate ca1 = QCA::Certificate::fromPEMFile( QStringLiteral("certs/RootCAcert.pem"), &resultca1, provider);
|
||||
|
||||
QCOMPARE( resultca1, QCA::ConvertGood );
|
||||
QCOMPARE( ca1.isNull(), false );
|
||||
@ -127,7 +127,7 @@ void CertUnitTest::CAcertstest()
|
||||
|
||||
QCOMPARE( ca1.serialNumber(), QCA::BigInteger(0) );
|
||||
|
||||
QCOMPARE( ca1.commonName(), QString("For Tests Only") );
|
||||
QCOMPARE( ca1.commonName(), QStringLiteral("For Tests Only") );
|
||||
|
||||
QCOMPARE( ca1.notValidBefore().toString(), QDateTime( QDate( 2001, 8, 17 ), QTime( 8, 30, 39 ), Qt::UTC ).toString() );
|
||||
QCOMPARE( ca1.notValidAfter().toString(), QDateTime( QDate( 2011, 8, 15 ), QTime( 8, 30, 39 ), Qt::UTC ).toString() );
|
||||
@ -160,7 +160,7 @@ void CertUnitTest::CAcertstest()
|
||||
void CertUnitTest::qualitysslcatest()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
// providersToTest.append("qca-botan");
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
@ -168,7 +168,7 @@ void CertUnitTest::qualitysslcatest()
|
||||
QWARN( QString( "Certificate handling not supported for "+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QCA::ConvertResult resultca1;
|
||||
QCA::Certificate ca1 = QCA::Certificate::fromPEMFile( "certs/QualitySSLIntermediateCA.crt", &resultca1, provider);
|
||||
QCA::Certificate ca1 = QCA::Certificate::fromPEMFile( QStringLiteral("certs/QualitySSLIntermediateCA.crt"), &resultca1, provider);
|
||||
|
||||
QCOMPARE( resultca1, QCA::ConvertGood );
|
||||
QCOMPARE( ca1.isNull(), false );
|
||||
@ -179,7 +179,7 @@ void CertUnitTest::qualitysslcatest()
|
||||
|
||||
QCOMPARE( ca1.serialNumber(), QCA::BigInteger("33555098") );
|
||||
|
||||
QCOMPARE( ca1.commonName(), QString("Comodo Class 3 Security Services CA") );
|
||||
QCOMPARE( ca1.commonName(), QStringLiteral("Comodo Class 3 Security Services CA") );
|
||||
|
||||
QCOMPARE( ca1.notValidBefore().toString(), QDateTime( QDate( 2002, 8, 27 ), QTime( 19, 02, 00 ), Qt::UTC ).toString() );
|
||||
QCOMPARE( ca1.notValidAfter().toString(), QDateTime( QDate( 2012, 8, 27 ), QTime( 23, 59, 00 ), Qt::UTC ).toString() );
|
||||
@ -212,7 +212,7 @@ void CertUnitTest::qualitysslcatest()
|
||||
void CertUnitTest::checkExpiredClientCerts()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
// providersToTest.append("qca-botan");
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
@ -220,7 +220,7 @@ void CertUnitTest::checkExpiredClientCerts()
|
||||
QWARN( QString( "Certificate handling not supported for "+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QCA::ConvertResult resultClient1;
|
||||
QCA::Certificate client1 = QCA::Certificate::fromPEMFile( "certs/User.pem", &resultClient1, provider);
|
||||
QCA::Certificate client1 = QCA::Certificate::fromPEMFile( QStringLiteral("certs/User.pem"), &resultClient1, provider);
|
||||
QCOMPARE( resultClient1, QCA::ConvertGood );
|
||||
QCOMPARE( client1.isNull(), false );
|
||||
QCOMPARE( client1.isCA(), false );
|
||||
@ -228,7 +228,7 @@ void CertUnitTest::checkExpiredClientCerts()
|
||||
|
||||
QCOMPARE( client1.serialNumber(), QCA::BigInteger(2) );
|
||||
|
||||
QCOMPARE( client1.commonName(), QString("Insecure User Test Cert") );
|
||||
QCOMPARE( client1.commonName(), QStringLiteral("Insecure User Test Cert") );
|
||||
|
||||
QCOMPARE( client1.notValidBefore().toString(), QDateTime( QDate( 2001, 8, 17 ), QTime( 8, 32, 38 ), Qt::UTC ).toString() );
|
||||
QCOMPARE( client1.notValidAfter().toString(), QDateTime( QDate( 2006, 8, 16 ), QTime( 8, 32, 38 ), Qt::UTC ).toString() );
|
||||
@ -257,19 +257,19 @@ void CertUnitTest::checkExpiredClientCerts()
|
||||
|
||||
QCA::CertificateInfo subject1 = client1.subjectInfo();
|
||||
QCOMPARE( subject1.isEmpty(), false );
|
||||
QCOMPARE( subject1.values(QCA::Country).contains("de") == true, true ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( subject1.values(QCA::Organization).contains("InsecureTestCertificate") == true, true ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( subject1.values(QCA::CommonName).contains("Insecure User Test Cert") == true, true ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( subject1.values(QCA::Country).contains(QStringLiteral("de")) == true, true ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( subject1.values(QCA::Organization).contains(QStringLiteral("InsecureTestCertificate")) == true, true ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( subject1.values(QCA::CommonName).contains(QStringLiteral("Insecure User Test Cert")) == true, true ); //clazy:exclude=container-anti-pattern
|
||||
|
||||
QCA::CertificateInfo issuer1 = client1.issuerInfo();
|
||||
QCOMPARE( issuer1.isEmpty(), false );
|
||||
QCOMPARE( issuer1.values(QCA::Country).contains("de") == true, true ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( issuer1.values(QCA::Organization).contains("InsecureTestCertificate") == true, true ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( issuer1.values(QCA::CommonName).contains("For Tests Only") == true, true ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( issuer1.values(QCA::Country).contains(QStringLiteral("de")) == true, true ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( issuer1.values(QCA::Organization).contains(QStringLiteral("InsecureTestCertificate")) == true, true ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( issuer1.values(QCA::CommonName).contains(QStringLiteral("For Tests Only")) == true, true ); //clazy:exclude=container-anti-pattern
|
||||
|
||||
QByteArray subjectKeyID = QCA::Hex().stringToArray("889E7EF729719D7B280F361AAE6D00D39DE1AADB").toByteArray();
|
||||
QByteArray subjectKeyID = QCA::Hex().stringToArray(QStringLiteral("889E7EF729719D7B280F361AAE6D00D39DE1AADB")).toByteArray();
|
||||
QCOMPARE( client1.subjectKeyId(), subjectKeyID );
|
||||
QCOMPARE( QCA::Hex().arrayToString(client1.issuerKeyId()), QString("bf53438278d09ec380e51b67ca0500dfb94883a5") );
|
||||
QCOMPARE( QCA::Hex().arrayToString(client1.issuerKeyId()), QStringLiteral("bf53438278d09ec380e51b67ca0500dfb94883a5") );
|
||||
|
||||
QCA::PublicKey pubkey1 = client1.subjectPublicKey();
|
||||
QCOMPARE( pubkey1.isNull(), false );
|
||||
@ -289,7 +289,7 @@ void CertUnitTest::checkExpiredClientCerts()
|
||||
QCOMPARE( client1.validate( trusted, untrusted ), QCA::ErrorInvalidCA );
|
||||
|
||||
QCA::ConvertResult resultca1;
|
||||
QCA::Certificate ca1 = QCA::Certificate::fromPEMFile( "certs/RootCAcert.pem", &resultca1, provider);
|
||||
QCA::Certificate ca1 = QCA::Certificate::fromPEMFile( QStringLiteral("certs/RootCAcert.pem"), &resultca1, provider);
|
||||
QCOMPARE( resultca1, QCA::ConvertGood );
|
||||
trusted.addCertificate( ca1 );
|
||||
|
||||
@ -320,7 +320,7 @@ void CertUnitTest::checkExpiredClientCerts()
|
||||
void CertUnitTest::checkClientCerts()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
// providersToTest.append("qca-botan");
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
@ -328,7 +328,7 @@ void CertUnitTest::checkClientCerts()
|
||||
QWARN( QString( "Certificate handling not supported for "+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QCA::ConvertResult resultClient2;
|
||||
QCA::Certificate client2 = QCA::Certificate::fromPEMFile( "certs/QcaTestClientCert.pem", &resultClient2, provider);
|
||||
QCA::Certificate client2 = QCA::Certificate::fromPEMFile( QStringLiteral("certs/QcaTestClientCert.pem"), &resultClient2, provider);
|
||||
QCOMPARE( resultClient2, QCA::ConvertGood );
|
||||
QCOMPARE( client2.isNull(), false );
|
||||
QCOMPARE( client2.isCA(), false );
|
||||
@ -336,7 +336,7 @@ void CertUnitTest::checkClientCerts()
|
||||
|
||||
QCOMPARE( client2.serialNumber(), QCA::BigInteger("13149359243510447488") );
|
||||
|
||||
QCOMPARE( client2.commonName(), QString("Qca Test Client Certificate") );
|
||||
QCOMPARE( client2.commonName(), QStringLiteral("Qca Test Client Certificate") );
|
||||
|
||||
QCOMPARE( client2.notValidBefore().toString(), QDateTime( QDate( 2013, 7, 31 ), QTime( 15, 14, 28 ), Qt::UTC ).toString() );
|
||||
QCOMPARE( client2.notValidAfter().toString(), QDateTime( QDate( 2033, 7, 26 ), QTime( 15, 14, 28 ), Qt::UTC ).toString() );
|
||||
@ -365,20 +365,20 @@ void CertUnitTest::checkClientCerts()
|
||||
|
||||
QCA::CertificateInfo subject2 = client2.subjectInfo();
|
||||
QCOMPARE( subject2.isEmpty(), false );
|
||||
QVERIFY( subject2.values(QCA::Country).contains("US") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject2.values(QCA::Organization).contains("Qca Development and Test") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject2.values(QCA::OrganizationalUnit).contains("Certificate Generation Section") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject2.values(QCA::CommonName).contains("Qca Test Client Certificate") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject2.values(QCA::Country).contains(QStringLiteral("US"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject2.values(QCA::Organization).contains(QStringLiteral("Qca Development and Test"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject2.values(QCA::OrganizationalUnit).contains(QStringLiteral("Certificate Generation Section"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject2.values(QCA::CommonName).contains(QStringLiteral("Qca Test Client Certificate"))); //clazy:exclude=container-anti-pattern
|
||||
|
||||
QCA::CertificateInfo issuer2 = client2.issuerInfo();
|
||||
QCOMPARE( issuer2.isEmpty(), false );
|
||||
QVERIFY( issuer2.values(QCA::Country).contains("AU") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer2.values(QCA::Organization).contains("Qca Development and Test") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer2.values(QCA::CommonName).contains("Qca Test Root Certificate") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer2.values(QCA::Country).contains(QStringLiteral("AU"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer2.values(QCA::Organization).contains(QStringLiteral("Qca Development and Test"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer2.values(QCA::CommonName).contains(QStringLiteral("Qca Test Root Certificate"))); //clazy:exclude=container-anti-pattern
|
||||
|
||||
QByteArray subjectKeyID = QCA::Hex().stringToArray("1e604e03127d287ba40427a961b428a2d09b50d1").toByteArray();
|
||||
QByteArray subjectKeyID = QCA::Hex().stringToArray(QStringLiteral("1e604e03127d287ba40427a961b428a2d09b50d1")).toByteArray();
|
||||
QCOMPARE( client2.subjectKeyId(), subjectKeyID );
|
||||
QCOMPARE( QCA::Hex().arrayToString(client2.issuerKeyId()), QString("f61c451de1b0458138c60568c1a7cb0f7ade0363") );
|
||||
QCOMPARE( QCA::Hex().arrayToString(client2.issuerKeyId()), QStringLiteral("f61c451de1b0458138c60568c1a7cb0f7ade0363") );
|
||||
|
||||
QCA::PublicKey pubkey2 = client2.subjectPublicKey();
|
||||
QCOMPARE( pubkey2.isNull(), false );
|
||||
@ -398,7 +398,7 @@ void CertUnitTest::checkClientCerts()
|
||||
QCOMPARE( client2.validate( trusted, untrusted ), QCA::ErrorInvalidCA );
|
||||
|
||||
QCA::ConvertResult resultca2;
|
||||
QCA::Certificate ca2 = QCA::Certificate::fromPEMFile( "certs/QcaTestRootCert.pem", &resultca2, provider);
|
||||
QCA::Certificate ca2 = QCA::Certificate::fromPEMFile( QStringLiteral("certs/QcaTestRootCert.pem"), &resultca2, provider);
|
||||
QCOMPARE( resultca2, QCA::ConvertGood );
|
||||
trusted.addCertificate( ca2 );
|
||||
|
||||
@ -430,13 +430,13 @@ void CertUnitTest::checkClientCerts()
|
||||
void CertUnitTest::derCAcertstest()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
if( !QCA::isSupported( "cert", provider ) )
|
||||
QWARN( QString( "Certificate handling not supported for "+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QFile f("certs/ov-root-ca-cert.crt");
|
||||
QFile f(QStringLiteral("certs/ov-root-ca-cert.crt"));
|
||||
QVERIFY(f.open(QFile::ReadOnly));
|
||||
QByteArray der = f.readAll();
|
||||
QCA::ConvertResult resultca1;
|
||||
@ -455,20 +455,20 @@ void CertUnitTest::derCAcertstest()
|
||||
|
||||
QCOMPARE( ca1.serialNumber(), QCA::BigInteger(0) );
|
||||
|
||||
QCOMPARE( ca1.commonName(), QString("For Tests Only") );
|
||||
QCOMPARE( ca1.commonName(), QStringLiteral("For Tests Only") );
|
||||
|
||||
QCA::CertificateInfo si = ca1.subjectInfo();
|
||||
QCOMPARE( si.isEmpty(), false );
|
||||
QCOMPARE( si.value(QCA::CommonName), QString("For Tests Only") );
|
||||
QCOMPARE( si.value(QCA::Organization), QString("InsecureTestCertificate") );
|
||||
QCOMPARE( si.value(QCA::Country), QString("de") );
|
||||
QCOMPARE( si.value(QCA::CommonName), QStringLiteral("For Tests Only") );
|
||||
QCOMPARE( si.value(QCA::Organization), QStringLiteral("InsecureTestCertificate") );
|
||||
QCOMPARE( si.value(QCA::Country), QStringLiteral("de") );
|
||||
|
||||
|
||||
QCA::CertificateInfo ii = ca1.issuerInfo();
|
||||
QCOMPARE( ii.isEmpty(), false );
|
||||
QCOMPARE( ii.value(QCA::CommonName), QString("For Tests Only") );
|
||||
QCOMPARE( ii.value(QCA::Organization), QString("InsecureTestCertificate") );
|
||||
QCOMPARE( ii.value(QCA::Country), QString("de") );
|
||||
QCOMPARE( ii.value(QCA::CommonName), QStringLiteral("For Tests Only") );
|
||||
QCOMPARE( ii.value(QCA::Organization), QStringLiteral("InsecureTestCertificate") );
|
||||
QCOMPARE( ii.value(QCA::Country), QStringLiteral("de") );
|
||||
|
||||
QCOMPARE( ca1.notValidBefore().toString(), QDateTime( QDate( 2001, 8, 17 ), QTime( 8, 30, 39 ), Qt::UTC ).toString() );
|
||||
QCOMPARE( ca1.notValidAfter().toString(), QDateTime( QDate( 2011, 8, 15 ), QTime( 8, 30, 39 ), Qt::UTC ).toString() );
|
||||
@ -503,7 +503,7 @@ void CertUnitTest::derCAcertstest()
|
||||
void CertUnitTest::altName()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
// providersToTest.append("qca-botan");
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
@ -511,7 +511,7 @@ void CertUnitTest::altName()
|
||||
QWARN( QString( "Certificate handling not supported for "+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QCA::ConvertResult resultClient1;
|
||||
QCA::Certificate client1 = QCA::Certificate::fromPEMFile( "certs/altname.pem", &resultClient1, provider);
|
||||
QCA::Certificate client1 = QCA::Certificate::fromPEMFile( QStringLiteral("certs/altname.pem"), &resultClient1, provider);
|
||||
QCOMPARE( resultClient1, QCA::ConvertGood );
|
||||
QCOMPARE( client1.isNull(), false );
|
||||
QCOMPARE( client1.isCA(), false );
|
||||
@ -519,7 +519,7 @@ void CertUnitTest::altName()
|
||||
|
||||
QCOMPARE( client1.serialNumber(), QCA::BigInteger(1) );
|
||||
|
||||
QCOMPARE( client1.commonName(), QString("Valid RFC822 nameConstraints EE Certificate Test21") );
|
||||
QCOMPARE( client1.commonName(), QStringLiteral("Valid RFC822 nameConstraints EE Certificate Test21") );
|
||||
|
||||
QCOMPARE( client1.constraints().contains(QCA::DigitalSignature) == true, true );
|
||||
QCOMPARE( client1.constraints().contains(QCA::NonRepudiation) == true, true );
|
||||
@ -541,24 +541,24 @@ void CertUnitTest::altName()
|
||||
QCOMPARE( client1.constraints().contains(QCA::OCSPSigning) == true, false );
|
||||
|
||||
QCOMPARE( client1.policies().count(), 1 );
|
||||
QCOMPARE( client1.policies().at(0), QString("2.16.840.1.101.3.2.1.48.1") );
|
||||
QCOMPARE( client1.policies().at(0), QStringLiteral("2.16.840.1.101.3.2.1.48.1") );
|
||||
|
||||
QCA::CertificateInfo subject1 = client1.subjectInfo();
|
||||
QCOMPARE( subject1.isEmpty(), false );
|
||||
QVERIFY( subject1.values(QCA::Country).contains("US") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::Organization).contains("Test Certificates") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::CommonName).contains("Valid RFC822 nameConstraints EE Certificate Test21") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::Email).contains("Test21EE@mailserver.testcertificates.gov") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::Country).contains(QStringLiteral("US"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::Organization).contains(QStringLiteral("Test Certificates"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::CommonName).contains(QStringLiteral("Valid RFC822 nameConstraints EE Certificate Test21"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::Email).contains(QStringLiteral("Test21EE@mailserver.testcertificates.gov"))); //clazy:exclude=container-anti-pattern
|
||||
|
||||
QCA::CertificateInfo issuer1 = client1.issuerInfo();
|
||||
QCOMPARE( issuer1.isEmpty(), false );
|
||||
QVERIFY( issuer1.values(QCA::Country).contains("US") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::Organization).contains("Test Certificates") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::CommonName).contains("nameConstraints RFC822 CA1") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::Country).contains(QStringLiteral("US"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::Organization).contains(QStringLiteral("Test Certificates"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::CommonName).contains(QStringLiteral("nameConstraints RFC822 CA1"))); //clazy:exclude=container-anti-pattern
|
||||
|
||||
QByteArray subjectKeyID = QCA::Hex().stringToArray("b4200d42cd95ea87d463d54f0ed6d10fe5b73bfb").toByteArray();
|
||||
QByteArray subjectKeyID = QCA::Hex().stringToArray(QStringLiteral("b4200d42cd95ea87d463d54f0ed6d10fe5b73bfb")).toByteArray();
|
||||
QCOMPARE( client1.subjectKeyId(), subjectKeyID );
|
||||
QCOMPARE( QCA::Hex().arrayToString(client1.issuerKeyId()), QString("e37f857a8ea23b9eeeb8121d7913aac4bd2e59ad") );
|
||||
QCOMPARE( QCA::Hex().arrayToString(client1.issuerKeyId()), QStringLiteral("e37f857a8ea23b9eeeb8121d7913aac4bd2e59ad") );
|
||||
|
||||
QCA::PublicKey pubkey1 = client1.subjectPublicKey();
|
||||
QCOMPARE( pubkey1.isNull(), false );
|
||||
@ -579,7 +579,7 @@ void CertUnitTest::altName()
|
||||
void CertUnitTest::extXMPP()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
// providersToTest.append("qca-botan");
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
@ -587,7 +587,7 @@ void CertUnitTest::extXMPP()
|
||||
QWARN( QString( "Certificate handling not supported for "+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QCA::ConvertResult resultClient1;
|
||||
QCA::Certificate client1 = QCA::Certificate::fromPEMFile( "certs/xmppcert.pem", &resultClient1, provider);
|
||||
QCA::Certificate client1 = QCA::Certificate::fromPEMFile( QStringLiteral("certs/xmppcert.pem"), &resultClient1, provider);
|
||||
QCOMPARE( resultClient1, QCA::ConvertGood );
|
||||
QCOMPARE( client1.isNull(), false );
|
||||
QCOMPARE( client1.isCA(), false );
|
||||
@ -595,25 +595,25 @@ void CertUnitTest::extXMPP()
|
||||
|
||||
QCOMPARE( client1.serialNumber(), QCA::BigInteger("9635301556349760241") );
|
||||
|
||||
QCOMPARE( client1.commonName(), QString("demo.jabber.com") );
|
||||
QCOMPARE( client1.commonName(), QStringLiteral("demo.jabber.com") );
|
||||
|
||||
QCA::CertificateInfo subject1 = client1.subjectInfo();
|
||||
QCOMPARE( subject1.isEmpty(), false );
|
||||
QVERIFY( subject1.values(QCA::Country).contains("US") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::Organization).contains("Jabber, Inc.") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::Locality).contains("Denver") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::State).contains("Colorado") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::CommonName).contains("demo.jabber.com") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::DNS).contains("demo.jabber.com") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::XMPP).contains("demo.jabber.com") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::Country).contains(QStringLiteral("US"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::Organization).contains(QStringLiteral("Jabber, Inc."))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::Locality).contains(QStringLiteral("Denver"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::State).contains(QStringLiteral("Colorado"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::CommonName).contains(QStringLiteral("demo.jabber.com"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::DNS).contains(QStringLiteral("demo.jabber.com"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::XMPP).contains(QStringLiteral("demo.jabber.com"))); //clazy:exclude=container-anti-pattern
|
||||
|
||||
QCA::CertificateInfo issuer1 = client1.issuerInfo();
|
||||
QCOMPARE( issuer1.isEmpty(), false );
|
||||
QVERIFY( issuer1.values(QCA::Country).contains("US") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::Organization).contains("Jabber, Inc.") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::Locality).contains("Denver") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::State).contains("Colorado") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::CommonName).contains("demo.jabber.com") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::Country).contains(QStringLiteral("US"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::Organization).contains(QStringLiteral("Jabber, Inc."))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::Locality).contains(QStringLiteral("Denver"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::State).contains(QStringLiteral("Colorado"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::CommonName).contains(QStringLiteral("demo.jabber.com"))); //clazy:exclude=container-anti-pattern
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -621,7 +621,7 @@ void CertUnitTest::extXMPP()
|
||||
void CertUnitTest::altNames76()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
// providersToTest.append("qca-botan");
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
@ -629,7 +629,7 @@ void CertUnitTest::altNames76()
|
||||
QWARN( QString( "Certificate handling not supported for "+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QCA::ConvertResult resultClient1;
|
||||
QCA::Certificate client1 = QCA::Certificate::fromPEMFile( "certs/76.pem", &resultClient1, provider);
|
||||
QCA::Certificate client1 = QCA::Certificate::fromPEMFile( QStringLiteral("certs/76.pem"), &resultClient1, provider);
|
||||
QCOMPARE( resultClient1, QCA::ConvertGood );
|
||||
QCOMPARE( client1.isNull(), false );
|
||||
QCOMPARE( client1.isCA(), false );
|
||||
@ -637,7 +637,7 @@ void CertUnitTest::altNames76()
|
||||
|
||||
QCOMPARE( client1.serialNumber(), QCA::BigInteger(118) );
|
||||
|
||||
QCOMPARE( client1.commonName(), QString("sip1.su.se") );
|
||||
QCOMPARE( client1.commonName(), QStringLiteral("sip1.su.se") );
|
||||
|
||||
QCOMPARE( client1.constraints().contains(QCA::DigitalSignature) == true, true );
|
||||
QCOMPARE( client1.constraints().contains(QCA::NonRepudiation) == true, true );
|
||||
@ -662,40 +662,40 @@ void CertUnitTest::altNames76()
|
||||
|
||||
QCA::CertificateInfo subject1 = client1.subjectInfo();
|
||||
QCOMPARE( subject1.isEmpty(), false );
|
||||
QVERIFY( subject1.values(QCA::Country).contains("SE") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::Organization).contains("Stockholms universitet") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::CommonName).contains("sip1.su.se") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::Country).contains(QStringLiteral("SE"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::Organization).contains(QStringLiteral("Stockholms universitet"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::CommonName).contains(QStringLiteral("sip1.su.se"))); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( subject1.values(QCA::Email).count(), 0 ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( subject1.values(QCA::DNS).count(), 8 ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::DNS).contains("incomingproxy.sip.su.se") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::DNS).contains("incomingproxy1.sip.su.se") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::DNS).contains("outgoingproxy.sip.su.se") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::DNS).contains("outgoingproxy1.sip.su.se") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::DNS).contains("out.sip.su.se") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::DNS).contains("appserver.sip.su.se") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::DNS).contains("appserver1.sip.su.se") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::DNS).contains("sip1.su.se") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::DNS).contains(QStringLiteral("incomingproxy.sip.su.se"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::DNS).contains(QStringLiteral("incomingproxy1.sip.su.se"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::DNS).contains(QStringLiteral("outgoingproxy.sip.su.se"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::DNS).contains(QStringLiteral("outgoingproxy1.sip.su.se"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::DNS).contains(QStringLiteral("out.sip.su.se"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::DNS).contains(QStringLiteral("appserver.sip.su.se"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::DNS).contains(QStringLiteral("appserver1.sip.su.se"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::DNS).contains(QStringLiteral("sip1.su.se"))); //clazy:exclude=container-anti-pattern
|
||||
|
||||
QVERIFY( client1.matchesHostName("incomingproxy.sip.su.se") );
|
||||
QVERIFY( client1.matchesHostName("incomingproxy1.sip.su.se") );
|
||||
QVERIFY( client1.matchesHostName("outgoingproxy.sip.su.se") );
|
||||
QVERIFY( client1.matchesHostName("outgoingproxy1.sip.su.se") );
|
||||
QVERIFY( client1.matchesHostName("out.sip.su.se") );
|
||||
QVERIFY( client1.matchesHostName("appserver.sip.su.se") );
|
||||
QVERIFY( client1.matchesHostName("appserver1.sip.su.se") );
|
||||
QVERIFY( client1.matchesHostName("sip1.su.se") );
|
||||
QVERIFY( client1.matchesHostName(QStringLiteral("incomingproxy.sip.su.se")));
|
||||
QVERIFY( client1.matchesHostName(QStringLiteral("incomingproxy1.sip.su.se")));
|
||||
QVERIFY( client1.matchesHostName(QStringLiteral("outgoingproxy.sip.su.se")));
|
||||
QVERIFY( client1.matchesHostName(QStringLiteral("outgoingproxy1.sip.su.se")));
|
||||
QVERIFY( client1.matchesHostName(QStringLiteral("out.sip.su.se")));
|
||||
QVERIFY( client1.matchesHostName(QStringLiteral("appserver.sip.su.se")));
|
||||
QVERIFY( client1.matchesHostName(QStringLiteral("appserver1.sip.su.se")));
|
||||
QVERIFY( client1.matchesHostName(QStringLiteral("sip1.su.se")));
|
||||
|
||||
QCA::CertificateInfo issuer1 = client1.issuerInfo();
|
||||
QCOMPARE( issuer1.isEmpty(), false );
|
||||
QVERIFY( issuer1.values(QCA::Country).contains("SE") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::Organization).contains("Stockholms universitet") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::CommonName).contains("Stockholm University CA") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::URI).contains("http://ca.su.se") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::Email).contains("ca@su.se") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::Country).contains(QStringLiteral("SE"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::Organization).contains(QStringLiteral("Stockholms universitet"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::CommonName).contains(QStringLiteral("Stockholm University CA"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::URI).contains(QStringLiteral("http://ca.su.se"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::Email).contains(QStringLiteral("ca@su.se"))); //clazy:exclude=container-anti-pattern
|
||||
|
||||
QByteArray subjectKeyID = QCA::Hex().stringToArray("3a5c5cd1cc2c9edf73f73bd81b59b1eab83035c5").toByteArray();
|
||||
QByteArray subjectKeyID = QCA::Hex().stringToArray(QStringLiteral("3a5c5cd1cc2c9edf73f73bd81b59b1eab83035c5")).toByteArray();
|
||||
QCOMPARE( client1.subjectKeyId(), subjectKeyID );
|
||||
QCOMPARE( QCA::Hex().arrayToString(client1.issuerKeyId()), QString("9e2e30ba37d95144c99dbf1821f1bd7eeeb58648") );
|
||||
QCOMPARE( QCA::Hex().arrayToString(client1.issuerKeyId()), QStringLiteral("9e2e30ba37d95144c99dbf1821f1bd7eeeb58648") );
|
||||
|
||||
QCA::PublicKey pubkey1 = client1.subjectPublicKey();
|
||||
QCOMPARE( pubkey1.isNull(), false );
|
||||
@ -716,14 +716,14 @@ void CertUnitTest::altNames76()
|
||||
void CertUnitTest::sha256cert()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
// providersToTest.append("qca-botan");
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
if( !QCA::isSupported( "cert", provider ) )
|
||||
QWARN( QString( "Certificate handling not supported for "+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QFile f("certs/RAIZ2007_CERTIFICATE_AND_CRL_SIGNING_SHA256.crt");
|
||||
QFile f(QStringLiteral("certs/RAIZ2007_CERTIFICATE_AND_CRL_SIGNING_SHA256.crt"));
|
||||
QVERIFY(f.open(QFile::ReadOnly));
|
||||
QByteArray der = f.readAll();
|
||||
QCA::ConvertResult resultcert;
|
||||
@ -755,7 +755,7 @@ void CertUnitTest::sha256cert()
|
||||
void CertUnitTest::checkExpiredServerCerts()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
// providersToTest.append("qca-botan");
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
@ -763,7 +763,7 @@ void CertUnitTest::checkExpiredServerCerts()
|
||||
QWARN( QString( "Certificate handling not supported for "+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QCA::ConvertResult resultServer1;
|
||||
QCA::Certificate server1 = QCA::Certificate::fromPEMFile( "certs/Server.pem", &resultServer1, provider);
|
||||
QCA::Certificate server1 = QCA::Certificate::fromPEMFile( QStringLiteral("certs/Server.pem"), &resultServer1, provider);
|
||||
QCOMPARE( resultServer1, QCA::ConvertGood );
|
||||
QCOMPARE( server1.isNull(), false );
|
||||
QCOMPARE( server1.isCA(), false );
|
||||
@ -771,7 +771,7 @@ void CertUnitTest::checkExpiredServerCerts()
|
||||
|
||||
QCOMPARE( server1.serialNumber(), QCA::BigInteger(4) );
|
||||
|
||||
QCOMPARE( server1.commonName(), QString("Insecure Server Cert") );
|
||||
QCOMPARE( server1.commonName(), QStringLiteral("Insecure Server Cert") );
|
||||
|
||||
QCOMPARE( server1.notValidBefore().toString(), QDateTime( QDate( 2001, 8, 17 ), QTime( 8, 46, 24 ), Qt::UTC ).toString() );
|
||||
QCOMPARE( server1.notValidAfter().toString(), QDateTime( QDate( 2006, 8, 16 ), QTime( 8, 46, 24 ), Qt::UTC ).toString() );
|
||||
@ -800,19 +800,19 @@ void CertUnitTest::checkExpiredServerCerts()
|
||||
|
||||
QCA::CertificateInfo subject1 = server1.subjectInfo();
|
||||
QCOMPARE( subject1.isEmpty(), false );
|
||||
QCOMPARE( subject1.values(QCA::Country).contains("de") == true, true ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( subject1.values(QCA::Organization).contains("InsecureTestCertificate") == true, true ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( subject1.values(QCA::CommonName).contains("Insecure Server Cert") == true, true ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( subject1.values(QCA::Country).contains(QStringLiteral("de")) == true, true ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( subject1.values(QCA::Organization).contains(QStringLiteral("InsecureTestCertificate")) == true, true ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( subject1.values(QCA::CommonName).contains(QStringLiteral("Insecure Server Cert")) == true, true ); //clazy:exclude=container-anti-pattern
|
||||
|
||||
QCA::CertificateInfo issuer1 = server1.issuerInfo();
|
||||
QCOMPARE( issuer1.isEmpty(), false );
|
||||
QCOMPARE( issuer1.values(QCA::Country).contains("de") == true, true ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( issuer1.values(QCA::Organization).contains("InsecureTestCertificate") == true, true ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( issuer1.values(QCA::CommonName).contains("For Tests Only") == true, true ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( issuer1.values(QCA::Country).contains(QStringLiteral("de")) == true, true ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( issuer1.values(QCA::Organization).contains(QStringLiteral("InsecureTestCertificate")) == true, true ); //clazy:exclude=container-anti-pattern
|
||||
QCOMPARE( issuer1.values(QCA::CommonName).contains(QStringLiteral("For Tests Only")) == true, true ); //clazy:exclude=container-anti-pattern
|
||||
|
||||
QByteArray subjectKeyID = QCA::Hex().stringToArray("0234E2C906F6E0B44253BE04C0CBA7823A6DB509").toByteArray();
|
||||
QByteArray subjectKeyID = QCA::Hex().stringToArray(QStringLiteral("0234E2C906F6E0B44253BE04C0CBA7823A6DB509")).toByteArray();
|
||||
QCOMPARE( server1.subjectKeyId(), subjectKeyID );
|
||||
QByteArray authorityKeyID = QCA::Hex().stringToArray("BF53438278D09EC380E51B67CA0500DFB94883A5").toByteArray();
|
||||
QByteArray authorityKeyID = QCA::Hex().stringToArray(QStringLiteral("BF53438278D09EC380E51B67CA0500DFB94883A5")).toByteArray();
|
||||
QCOMPARE( server1.issuerKeyId(), authorityKeyID );
|
||||
|
||||
QCA::PublicKey pubkey1 = server1.subjectPublicKey();
|
||||
@ -833,7 +833,7 @@ void CertUnitTest::checkExpiredServerCerts()
|
||||
QCOMPARE( server1.validate( trusted, untrusted ), QCA::ErrorInvalidCA );
|
||||
|
||||
QCA::ConvertResult resultca1;
|
||||
QCA::Certificate ca1 = QCA::Certificate::fromPEMFile( "certs/RootCAcert.pem", &resultca1, provider);
|
||||
QCA::Certificate ca1 = QCA::Certificate::fromPEMFile( QStringLiteral("certs/RootCAcert.pem"), &resultca1, provider);
|
||||
QCOMPARE( resultca1, QCA::ConvertGood );
|
||||
trusted.addCertificate( ca1 );
|
||||
QCOMPARE( server1.validate( trusted, untrusted ), QCA::ErrorExpired );
|
||||
@ -858,7 +858,7 @@ void CertUnitTest::checkExpiredServerCerts()
|
||||
void CertUnitTest::checkServerCerts()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
// providersToTest.append("qca-botan");
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
@ -866,7 +866,7 @@ void CertUnitTest::checkServerCerts()
|
||||
QWARN( QString( "Certificate handling not supported for "+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QCA::ConvertResult resultServer1;
|
||||
QCA::Certificate server1 = QCA::Certificate::fromPEMFile( "certs/QcaTestServerCert.pem", &resultServer1, provider);
|
||||
QCA::Certificate server1 = QCA::Certificate::fromPEMFile( QStringLiteral("certs/QcaTestServerCert.pem"), &resultServer1, provider);
|
||||
QCOMPARE( resultServer1, QCA::ConvertGood );
|
||||
QCOMPARE( server1.isNull(), false );
|
||||
QCOMPARE( server1.isCA(), false );
|
||||
@ -874,7 +874,7 @@ void CertUnitTest::checkServerCerts()
|
||||
|
||||
QCOMPARE( server1.serialNumber(), QCA::BigInteger("13149359243510447489") );
|
||||
|
||||
QCOMPARE( server1.commonName(), QString("Qca Server Test certificate") );
|
||||
QCOMPARE( server1.commonName(), QStringLiteral("Qca Server Test certificate") );
|
||||
|
||||
QCOMPARE( server1.notValidBefore().toString(), QDateTime( QDate( 2013, 7, 31 ), QTime( 15, 23, 25 ), Qt::UTC ).toString() );
|
||||
QCOMPARE( server1.notValidAfter().toString(), QDateTime( QDate( 2033, 7, 26 ), QTime( 15, 23, 25 ), Qt::UTC ).toString() );
|
||||
@ -903,21 +903,21 @@ void CertUnitTest::checkServerCerts()
|
||||
|
||||
QCA::CertificateInfo subject1 = server1.subjectInfo();
|
||||
QCOMPARE( subject1.isEmpty(), false );
|
||||
QVERIFY( subject1.values(QCA::Country).contains("IL") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::Organization).contains("Qca Development and Test") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::OrganizationalUnit).contains("Server Management Section") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::CommonName).contains("Qca Server Test certificate") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::Country).contains(QStringLiteral("IL"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::Organization).contains(QStringLiteral("Qca Development and Test"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::OrganizationalUnit).contains(QStringLiteral("Server Management Section"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject1.values(QCA::CommonName).contains(QStringLiteral("Qca Server Test certificate"))); //clazy:exclude=container-anti-pattern
|
||||
|
||||
QCA::CertificateInfo issuer1 = server1.issuerInfo();
|
||||
QCOMPARE( issuer1.isEmpty(), false );
|
||||
QVERIFY( issuer1.values(QCA::Country).contains("AU") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::Organization).contains("Qca Development and Test") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::OrganizationalUnit).contains("Certificate Generation Section") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::CommonName).contains("Qca Test Root Certificate") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::Country).contains(QStringLiteral("AU"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::Organization).contains(QStringLiteral("Qca Development and Test"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::OrganizationalUnit).contains(QStringLiteral("Certificate Generation Section"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer1.values(QCA::CommonName).contains(QStringLiteral("Qca Test Root Certificate"))); //clazy:exclude=container-anti-pattern
|
||||
|
||||
QByteArray subjectKeyID = QCA::Hex().stringToArray("819870c8b81eab53e72d0446b65790aa0d3eab1a").toByteArray();
|
||||
QByteArray subjectKeyID = QCA::Hex().stringToArray(QStringLiteral("819870c8b81eab53e72d0446b65790aa0d3eab1a")).toByteArray();
|
||||
QCOMPARE( server1.subjectKeyId(), subjectKeyID );
|
||||
QByteArray authorityKeyID = QCA::Hex().stringToArray("f61c451de1b0458138c60568c1a7cb0f7ade0363").toByteArray();
|
||||
QByteArray authorityKeyID = QCA::Hex().stringToArray(QStringLiteral("f61c451de1b0458138c60568c1a7cb0f7ade0363")).toByteArray();
|
||||
QCOMPARE( server1.issuerKeyId(), authorityKeyID );
|
||||
|
||||
QCA::PublicKey pubkey1 = server1.subjectPublicKey();
|
||||
@ -938,7 +938,7 @@ void CertUnitTest::checkServerCerts()
|
||||
QCOMPARE( server1.validate( trusted, untrusted ), QCA::ErrorInvalidCA );
|
||||
|
||||
QCA::ConvertResult resultca1;
|
||||
QCA::Certificate ca1 = QCA::Certificate::fromPEMFile( "certs/QcaTestRootCert.pem", &resultca1, provider);
|
||||
QCA::Certificate ca1 = QCA::Certificate::fromPEMFile( QStringLiteral("certs/QcaTestRootCert.pem"), &resultca1, provider);
|
||||
QCOMPARE( resultca1, QCA::ConvertGood );
|
||||
trusted.addCertificate( ca1 );
|
||||
QCOMPARE( server1.validate( trusted, untrusted ), QCA::ValidityGood );
|
||||
@ -977,7 +977,7 @@ void CertUnitTest::checkSystemStore()
|
||||
void CertUnitTest::crl()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
// providersToTest.append("qca-botan");
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
@ -988,18 +988,18 @@ void CertUnitTest::crl()
|
||||
QVERIFY( emptyCRL.isNull() );
|
||||
|
||||
QCA::ConvertResult resultCrl;
|
||||
QCA::CRL crl1 = QCA::CRL::fromPEMFile( "certs/Test_CRL.crl", &resultCrl, provider);
|
||||
QCA::CRL crl1 = QCA::CRL::fromPEMFile( QStringLiteral("certs/Test_CRL.crl"), &resultCrl, provider);
|
||||
QCOMPARE( resultCrl, QCA::ConvertGood );
|
||||
QCOMPARE( crl1.isNull(), false );
|
||||
|
||||
QCA::CertificateInfo issuer = crl1.issuerInfo();
|
||||
QCOMPARE( issuer.isEmpty(), false );
|
||||
QVERIFY( issuer.values(QCA::Country).contains("de") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer.values(QCA::Organization).contains("InsecureTestCertificate") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer.values(QCA::CommonName).contains("For Tests Only") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer.values(QCA::Country).contains(QStringLiteral("de"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer.values(QCA::Organization).contains(QStringLiteral("InsecureTestCertificate"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer.values(QCA::CommonName).contains(QStringLiteral("For Tests Only"))); //clazy:exclude=container-anti-pattern
|
||||
|
||||
// No keyid extension on this crl
|
||||
QCOMPARE( QCA::arrayToHex( crl1.issuerKeyId() ), QString("") );
|
||||
QCOMPARE( QCA::arrayToHex( crl1.issuerKeyId() ), QLatin1String("") );
|
||||
|
||||
QCOMPARE( crl1.thisUpdate(), QDateTime(QDate(2001, 8, 17), QTime(11, 12, 03), Qt::UTC) );
|
||||
QCOMPARE( crl1.nextUpdate(), QDateTime(QDate(2006, 8, 16), QTime(11, 12, 03), Qt::UTC) );
|
||||
@ -1038,7 +1038,7 @@ void CertUnitTest::crl()
|
||||
void CertUnitTest::crl2()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
// providersToTest.append("qca-botan");
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
@ -1046,23 +1046,23 @@ void CertUnitTest::crl2()
|
||||
QWARN( QString( "Certificate revocation not supported for "+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QCA::ConvertResult resultCrl;
|
||||
QCA::CRL crl1 = QCA::CRL::fromPEMFile( "certs/GoodCACRL.pem", &resultCrl, provider);
|
||||
QCA::CRL crl1 = QCA::CRL::fromPEMFile( QStringLiteral("certs/GoodCACRL.pem"), &resultCrl, provider);
|
||||
QCOMPARE( resultCrl, QCA::ConvertGood );
|
||||
QCOMPARE( crl1.isNull(), false );
|
||||
QCOMPARE( crl1.provider()->name(), provider );
|
||||
|
||||
QCA::CertificateInfo issuer = crl1.issuerInfo();
|
||||
QCOMPARE( issuer.isEmpty(), false );
|
||||
QVERIFY( issuer.values(QCA::Country).contains("US") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer.values(QCA::Organization).contains("Test Certificates") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer.values(QCA::CommonName).contains("Good CA") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer.values(QCA::Country).contains(QStringLiteral("US"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer.values(QCA::Organization).contains(QStringLiteral("Test Certificates"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( issuer.values(QCA::CommonName).contains(QStringLiteral("Good CA"))); //clazy:exclude=container-anti-pattern
|
||||
|
||||
QCOMPARE( crl1.thisUpdate(), QDateTime(QDate(2001, 4, 19), QTime(14, 57, 20), Qt::UTC) );
|
||||
QCOMPARE( crl1.nextUpdate(), QDateTime(QDate(2011, 4, 19), QTime(14, 57, 20), Qt::UTC) );
|
||||
|
||||
QCOMPARE( crl1.signatureAlgorithm(), QCA::EMSA3_SHA1 );
|
||||
|
||||
QCOMPARE( QCA::arrayToHex( crl1.issuerKeyId() ), QString("b72ea682cbc2c8bca87b2744d73533df9a1594c7") );
|
||||
QCOMPARE( QCA::arrayToHex( crl1.issuerKeyId() ), QStringLiteral("b72ea682cbc2c8bca87b2744d73533df9a1594c7") );
|
||||
QCOMPARE( crl1.number(), 1 );
|
||||
QCOMPARE( crl1, QCA::CRL(crl1) );
|
||||
QCOMPARE( crl1 == QCA::CRL(), false );
|
||||
@ -1105,7 +1105,7 @@ void CertUnitTest::crl2()
|
||||
void CertUnitTest::csr()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
// providersToTest.append("qca-botan");
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
@ -1119,18 +1119,18 @@ void CertUnitTest::csr()
|
||||
QCOMPARE( nullCSR, anotherNullCSR);
|
||||
|
||||
QCA::ConvertResult resultCsr;
|
||||
QCA::CertificateRequest csr1 = QCA::CertificateRequest::fromPEMFile( "certs/csr1.pem", &resultCsr, provider);
|
||||
QCA::CertificateRequest csr1 = QCA::CertificateRequest::fromPEMFile( QStringLiteral("certs/csr1.pem"), &resultCsr, provider);
|
||||
QCOMPARE( resultCsr, QCA::ConvertGood );
|
||||
QCOMPARE( csr1.isNull(), false );
|
||||
QCOMPARE( csr1.provider()->name(), provider );
|
||||
QCA::CertificateInfo subject = csr1.subjectInfo();
|
||||
QCOMPARE( subject.isEmpty(), false );
|
||||
QVERIFY( subject.values(QCA::Country).contains("AU") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::State).contains("Victoria") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::Locality).contains("Mitcham") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::Organization).contains("GE Interlogix") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::OrganizationalUnit).contains("Engineering") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::CommonName).contains("coldfire") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::Country).contains(QStringLiteral("AU"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::State).contains(QStringLiteral("Victoria"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::Locality).contains(QStringLiteral("Mitcham"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::Organization).contains(QStringLiteral("GE Interlogix"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::OrganizationalUnit).contains(QStringLiteral("Engineering"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::CommonName).contains(QStringLiteral("coldfire"))); //clazy:exclude=container-anti-pattern
|
||||
|
||||
QCA::PublicKey pkey = csr1.subjectPublicKey();
|
||||
QCOMPARE( pkey.isNull(), false );
|
||||
@ -1149,7 +1149,7 @@ void CertUnitTest::csr()
|
||||
void CertUnitTest::csr2()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
// providersToTest.append("qca-botan");
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
@ -1157,18 +1157,18 @@ void CertUnitTest::csr2()
|
||||
QWARN( QString( "Certificate signing requests not supported for "+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QCA::ConvertResult resultCsr;
|
||||
QCA::CertificateRequest csr1 = QCA::CertificateRequest::fromPEMFile( "certs/newreq.pem", &resultCsr, provider);
|
||||
QCA::CertificateRequest csr1 = QCA::CertificateRequest::fromPEMFile( QStringLiteral("certs/newreq.pem"), &resultCsr, provider);
|
||||
QCOMPARE( resultCsr, QCA::ConvertGood );
|
||||
QCOMPARE( csr1.isNull(), false );
|
||||
QCOMPARE( csr1.provider()->name(), provider );
|
||||
QCA::CertificateInfo subject = csr1.subjectInfo();
|
||||
QCOMPARE( subject.isEmpty(), false );
|
||||
QVERIFY( subject.values(QCA::Country).contains("AI") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::State).contains("Hutt River Province") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::Locality).contains("Lesser Internet") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::Organization).contains("My Company Ltd") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::OrganizationalUnit).contains("Backwater Branch Office") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::CommonName).contains("FirstName Surname") ); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::Country).contains(QStringLiteral("AI"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::State).contains(QStringLiteral("Hutt River Province"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::Locality).contains(QStringLiteral("Lesser Internet"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::Organization).contains(QStringLiteral("My Company Ltd"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::OrganizationalUnit).contains(QStringLiteral("Backwater Branch Office"))); //clazy:exclude=container-anti-pattern
|
||||
QVERIFY( subject.values(QCA::CommonName).contains(QStringLiteral("FirstName Surname"))); //clazy:exclude=container-anti-pattern
|
||||
|
||||
QCA::PublicKey pkey = csr1.subjectPublicKey();
|
||||
QCOMPARE( pkey.isNull(), false );
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -62,17 +62,17 @@ public:
|
||||
QStringList features() const override
|
||||
{
|
||||
QStringList list;
|
||||
list += "testClientSideProviderFeature1";
|
||||
list += "testClientSideProviderFeature2";
|
||||
list += QStringLiteral("testClientSideProviderFeature1");
|
||||
list += QStringLiteral("testClientSideProviderFeature2");
|
||||
return list;
|
||||
}
|
||||
|
||||
Provider::Context *createContext(const QString &type) override
|
||||
{
|
||||
if(type == "testClientSideProviderFeature1")
|
||||
if(type == QLatin1String("testClientSideProviderFeature1"))
|
||||
// return new Feature1Context(this);
|
||||
return nullptr;
|
||||
else if (type == "testClientSideProviderFeature2")
|
||||
else if (type == QLatin1String("testClientSideProviderFeature2"))
|
||||
// return new Feature2Context(this);
|
||||
return nullptr;
|
||||
else
|
||||
|
@ -75,7 +75,7 @@ void CMSut::xcrypt_data()
|
||||
void CMSut::xcrypt()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
if( !QCA::isSupported( "cert", provider ) )
|
||||
@ -83,7 +83,7 @@ void CMSut::xcrypt()
|
||||
else if( !QCA::isSupported( "cms", provider ) )
|
||||
QWARN( QString( "CMS not supported for "+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QCA::Certificate pubCert = QCA::Certificate::fromPEMFile( "QcaTestClientCert.pem",nullptr, provider );
|
||||
QCA::Certificate pubCert = QCA::Certificate::fromPEMFile( QStringLiteral("QcaTestClientCert.pem"),nullptr, provider );
|
||||
QCOMPARE( pubCert.isNull(), false );
|
||||
|
||||
QCA::SecureMessageKey secMsgKey;
|
||||
@ -124,7 +124,7 @@ void CMSut::xcrypt()
|
||||
|
||||
QCA::ConvertResult res;
|
||||
QCA::SecureArray passPhrase = "start";
|
||||
QCA::PrivateKey privKey = QCA::PrivateKey::fromPEMFile( "QcaTestClientKey.pem", passPhrase, &res );
|
||||
QCA::PrivateKey privKey = QCA::PrivateKey::fromPEMFile( QStringLiteral("QcaTestClientKey.pem"), passPhrase, &res );
|
||||
QCOMPARE( res, QCA::ConvertGood );
|
||||
|
||||
secMsgKey.setX509PrivateKey( privKey );
|
||||
@ -174,7 +174,7 @@ void CMSut::signverify_data()
|
||||
void CMSut::signverify()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
if( !QCA::isSupported( "cert", provider ) )
|
||||
@ -184,10 +184,10 @@ void CMSut::signverify()
|
||||
else {
|
||||
QCA::ConvertResult res;
|
||||
QCA::SecureArray passPhrase = "start";
|
||||
QCA::PrivateKey privKey = QCA::PrivateKey::fromPEMFile( "QcaTestClientKey.pem", passPhrase, &res, provider );
|
||||
QCA::PrivateKey privKey = QCA::PrivateKey::fromPEMFile( QStringLiteral("QcaTestClientKey.pem"), passPhrase, &res, provider );
|
||||
QCOMPARE( res, QCA::ConvertGood );
|
||||
|
||||
QCA::Certificate pubCert = QCA::Certificate::fromPEMFile( "QcaTestClientCert.pem", &res, provider);
|
||||
QCA::Certificate pubCert = QCA::Certificate::fromPEMFile( QStringLiteral("QcaTestClientCert.pem"), &res, provider);
|
||||
QCOMPARE( res, QCA::ConvertGood );
|
||||
QCOMPARE( pubCert.isNull(), false );
|
||||
|
||||
@ -231,7 +231,7 @@ void CMSut::signverify()
|
||||
QCOMPARE( signedResult2.isEmpty(), false );
|
||||
|
||||
QCA::CMS cms;
|
||||
QCA::Certificate caCert = QCA::Certificate::fromPEMFile( "QcaTestRootCert.pem", &res, provider );
|
||||
QCA::Certificate caCert = QCA::Certificate::fromPEMFile( QStringLiteral("QcaTestRootCert.pem"), &res, provider );
|
||||
QCOMPARE( res, QCA::ConvertGood );
|
||||
QCA::CertificateCollection caCertCollection;
|
||||
caCertCollection.addCertificate(caCert);
|
||||
@ -306,7 +306,7 @@ void CMSut::signverify_message_data()
|
||||
void CMSut::signverify_message()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
if( !QCA::isSupported( "cert", provider ) )
|
||||
@ -316,10 +316,10 @@ void CMSut::signverify_message()
|
||||
else {
|
||||
QCA::ConvertResult res;
|
||||
QCA::SecureArray passPhrase = "start";
|
||||
QCA::PrivateKey privKey = QCA::PrivateKey::fromPEMFile( "QcaTestClientKey.pem", passPhrase, &res, provider );
|
||||
QCA::PrivateKey privKey = QCA::PrivateKey::fromPEMFile( QStringLiteral("QcaTestClientKey.pem"), passPhrase, &res, provider );
|
||||
QCOMPARE( res, QCA::ConvertGood );
|
||||
|
||||
QCA::Certificate pubCert = QCA::Certificate::fromPEMFile( "QcaTestClientCert.pem", &res, provider );
|
||||
QCA::Certificate pubCert = QCA::Certificate::fromPEMFile( QStringLiteral("QcaTestClientCert.pem"), &res, provider );
|
||||
QCOMPARE( res, QCA::ConvertGood );
|
||||
QCOMPARE( pubCert.isNull(), false );
|
||||
|
||||
@ -363,7 +363,7 @@ void CMSut::signverify_message()
|
||||
QCOMPARE( signedResult2.isEmpty(), false );
|
||||
|
||||
QCA::CMS cms;
|
||||
QCA::Certificate caCert = QCA::Certificate::fromPEMFile( "QcaTestRootCert.pem", &res, provider );
|
||||
QCA::Certificate caCert = QCA::Certificate::fromPEMFile( QStringLiteral("QcaTestRootCert.pem"), &res, provider );
|
||||
QCOMPARE( res, QCA::ConvertGood );
|
||||
|
||||
QCA::CertificateCollection caCertCollection;
|
||||
@ -424,7 +424,7 @@ void CMSut::signverify_message_invalid_data()
|
||||
void CMSut::signverify_message_invalid()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
if( !QCA::isSupported( "cert", provider ) )
|
||||
@ -434,10 +434,10 @@ void CMSut::signverify_message_invalid()
|
||||
else {
|
||||
QCA::ConvertResult res;
|
||||
QCA::SecureArray passPhrase = "start";
|
||||
QCA::PrivateKey privKey = QCA::PrivateKey::fromPEMFile( "QcaTestClientKey.pem", passPhrase, &res, provider );
|
||||
QCA::PrivateKey privKey = QCA::PrivateKey::fromPEMFile( QStringLiteral("QcaTestClientKey.pem"), passPhrase, &res, provider );
|
||||
QCOMPARE( res, QCA::ConvertGood );
|
||||
|
||||
QCA::Certificate pubCert = QCA::Certificate::fromPEMFile( "QcaTestClientCert.pem", &res, provider );
|
||||
QCA::Certificate pubCert = QCA::Certificate::fromPEMFile( QStringLiteral("QcaTestClientCert.pem"), &res, provider );
|
||||
QCOMPARE( res, QCA::ConvertGood );
|
||||
QCOMPARE( pubCert.isNull(), false );
|
||||
|
||||
@ -469,7 +469,7 @@ void CMSut::signverify_message_invalid()
|
||||
QCOMPARE( signedResult1.isEmpty(), false );
|
||||
|
||||
QCA::CMS cms;
|
||||
QCA::Certificate caCert = QCA::Certificate::fromPEMFile( "QcaTestRootCert.pem", &res, provider );
|
||||
QCA::Certificate caCert = QCA::Certificate::fromPEMFile( QStringLiteral("QcaTestRootCert.pem"), &res, provider );
|
||||
QCOMPARE( res, QCA::ConvertGood );
|
||||
|
||||
QCA::CertificateCollection caCertCollection;
|
||||
|
@ -94,18 +94,18 @@ void HashUnitTest::md2test_data()
|
||||
QTest::addColumn<QByteArray>("input");
|
||||
QTest::addColumn<QString>("expectedHash");
|
||||
|
||||
QTest::newRow("md2()") << QByteArray("") << QString("8350e5a3e24c153df2275c9f80692773");
|
||||
QTest::newRow("md2(a)") << QByteArray("a") << QString("32ec01ec4a6dac72c0ab96fb34c0b5d1");
|
||||
QTest::newRow("md2()") << QByteArray("") << QStringLiteral("8350e5a3e24c153df2275c9f80692773");
|
||||
QTest::newRow("md2(a)") << QByteArray("a") << QStringLiteral("32ec01ec4a6dac72c0ab96fb34c0b5d1");
|
||||
QTest::newRow("md2(abc)") << QByteArray("abc")
|
||||
<< QString("da853b0d3f88d99b30283a69e6ded6bb");
|
||||
<< QStringLiteral("da853b0d3f88d99b30283a69e6ded6bb");
|
||||
QTest::newRow("md2(messageDigest)") << QByteArray("message digest")
|
||||
<< QString("ab4f496bfb2a530b219ff33031fe06b0");
|
||||
<< QStringLiteral("ab4f496bfb2a530b219ff33031fe06b0");
|
||||
QTest::newRow("md2([a-z])") << QByteArray("abcdefghijklmnopqrstuvwxyz")
|
||||
<< QString("4e8ddff3650292ab5a4108c3aa47940b");
|
||||
<< QStringLiteral("4e8ddff3650292ab5a4108c3aa47940b");
|
||||
QTest::newRow("md2([A-z,0-9])") << QByteArray("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")
|
||||
<< QString("da33def2a42df13975352846c30338cd");
|
||||
<< QStringLiteral("da33def2a42df13975352846c30338cd");
|
||||
QTest::newRow("md2(nums)") << QByteArray("12345678901234567890123456789012345678901234567890123456789012345678901234567890")
|
||||
<< QString("d5976f79d83d3a0dc9806c3c66f3efd8");
|
||||
<< QStringLiteral("d5976f79d83d3a0dc9806c3c66f3efd8");
|
||||
}
|
||||
|
||||
void HashUnitTest::md2test()
|
||||
@ -118,7 +118,7 @@ void HashUnitTest::md2test()
|
||||
if(QCA::isSupported("md2", provider)) {
|
||||
anyProviderTested = true;
|
||||
|
||||
QCA::Hash hash = QCA::Hash("md2", provider);
|
||||
QCA::Hash hash = QCA::Hash(QStringLiteral("md2"), provider);
|
||||
QCA::Hash copy = hash;
|
||||
copy.context(); // detach
|
||||
|
||||
@ -136,18 +136,18 @@ void HashUnitTest::md4test_data()
|
||||
QTest::addColumn<QByteArray>("input");
|
||||
QTest::addColumn<QString>("expectedHash");
|
||||
|
||||
QTest::newRow("md4()") << QByteArray("") << QString("31d6cfe0d16ae931b73c59d7e0c089c0");
|
||||
QTest::newRow("md4(a)") << QByteArray("a") << QString("bde52cb31de33e46245e05fbdbd6fb24");
|
||||
QTest::newRow("md4()") << QByteArray("") << QStringLiteral("31d6cfe0d16ae931b73c59d7e0c089c0");
|
||||
QTest::newRow("md4(a)") << QByteArray("a") << QStringLiteral("bde52cb31de33e46245e05fbdbd6fb24");
|
||||
QTest::newRow("md4(abc)") << QByteArray("abc")
|
||||
<< QString("a448017aaf21d8525fc10ae87aa6729d");
|
||||
<< QStringLiteral("a448017aaf21d8525fc10ae87aa6729d");
|
||||
QTest::newRow("md4(messageDigest)") << QByteArray("message digest")
|
||||
<< QString("d9130a8164549fe818874806e1c7014b");
|
||||
<< QStringLiteral("d9130a8164549fe818874806e1c7014b");
|
||||
QTest::newRow("md4([a-z])") << QByteArray("abcdefghijklmnopqrstuvwxyz")
|
||||
<< QString("d79e1c308aa5bbcdeea8ed63df412da9");
|
||||
<< QStringLiteral("d79e1c308aa5bbcdeea8ed63df412da9");
|
||||
QTest::newRow("md4([A-z,0-9])") << QByteArray("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")
|
||||
<< QString("043f8582f241db351ce627e153e7f0e4");
|
||||
<< QStringLiteral("043f8582f241db351ce627e153e7f0e4");
|
||||
QTest::newRow("md4(nums)") << QByteArray("12345678901234567890123456789012345678901234567890123456789012345678901234567890")
|
||||
<< QString("e33b4ddc9c38f2199c3e7b164fcc0536");
|
||||
<< QStringLiteral("e33b4ddc9c38f2199c3e7b164fcc0536");
|
||||
}
|
||||
|
||||
|
||||
@ -161,7 +161,7 @@ void HashUnitTest::md4test()
|
||||
if(QCA::isSupported("md4", provider)) {
|
||||
anyProviderTested = true;
|
||||
|
||||
QCA::Hash hash = QCA::Hash("md4", provider);
|
||||
QCA::Hash hash = QCA::Hash(QStringLiteral("md4"), provider);
|
||||
QCA::Hash copy = hash;
|
||||
hash.context(); // detach
|
||||
|
||||
@ -179,18 +179,18 @@ void HashUnitTest::md5test_data()
|
||||
QTest::addColumn<QByteArray>("input");
|
||||
QTest::addColumn<QString>("expectedHash");
|
||||
|
||||
QTest::newRow("md5()") << QByteArray("") << QString("d41d8cd98f00b204e9800998ecf8427e");
|
||||
QTest::newRow("md5(a)") << QByteArray("a") << QString("0cc175b9c0f1b6a831c399e269772661");
|
||||
QTest::newRow("md5()") << QByteArray("") << QStringLiteral("d41d8cd98f00b204e9800998ecf8427e");
|
||||
QTest::newRow("md5(a)") << QByteArray("a") << QStringLiteral("0cc175b9c0f1b6a831c399e269772661");
|
||||
QTest::newRow("md5(abc)") << QByteArray("abc")
|
||||
<< QString("900150983cd24fb0d6963f7d28e17f72");
|
||||
<< QStringLiteral("900150983cd24fb0d6963f7d28e17f72");
|
||||
QTest::newRow("md5(messageDigest)") << QByteArray("message digest")
|
||||
<< QString("f96b697d7cb7938d525a2f31aaf161d0");
|
||||
<< QStringLiteral("f96b697d7cb7938d525a2f31aaf161d0");
|
||||
QTest::newRow("md5([a-z])") << QByteArray("abcdefghijklmnopqrstuvwxyz")
|
||||
<< QString("c3fcd3d76192e4007dfb496cca67e13b");
|
||||
<< QStringLiteral("c3fcd3d76192e4007dfb496cca67e13b");
|
||||
QTest::newRow("md5([A-z,0-9])") << QByteArray("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")
|
||||
<< QString("d174ab98d277d9f5a5611c2c9f419d9f");
|
||||
<< QStringLiteral("d174ab98d277d9f5a5611c2c9f419d9f");
|
||||
QTest::newRow("md5(nums)") << QByteArray("12345678901234567890123456789012345678901234567890123456789012345678901234567890")
|
||||
<< QString("57edf4a22be3c955ac49da2e2107b67a");
|
||||
<< QStringLiteral("57edf4a22be3c955ac49da2e2107b67a");
|
||||
}
|
||||
|
||||
void HashUnitTest::md5test()
|
||||
@ -203,7 +203,7 @@ void HashUnitTest::md5test()
|
||||
if(QCA::isSupported("md5", provider)) {
|
||||
anyProviderTested = true;
|
||||
|
||||
QCA::Hash hash = QCA::Hash("md5", provider);
|
||||
QCA::Hash hash = QCA::Hash(QStringLiteral("md5"), provider);
|
||||
QCA::Hash copy = hash;
|
||||
hash.context(); // detach
|
||||
|
||||
@ -222,29 +222,29 @@ void HashUnitTest::md5filetest()
|
||||
QFile f1( TEST_DATA_DIR "/data/empty" );
|
||||
QVERIFY( f1.open( QIODevice::ReadOnly ) );
|
||||
{
|
||||
QCA::Hash hashObj("md5", provider);
|
||||
QCA::Hash hashObj(QStringLiteral("md5"), provider);
|
||||
hashObj.update( &f1 );
|
||||
QCOMPARE( QString( QCA::arrayToHex( hashObj.final().toByteArray() ) ),
|
||||
QString( "d41d8cd98f00b204e9800998ecf8427e" ) );
|
||||
QStringLiteral( "d41d8cd98f00b204e9800998ecf8427e" ) );
|
||||
}
|
||||
|
||||
QFile f2( TEST_DATA_DIR "/data/twobytes" );
|
||||
QVERIFY( f2.open( QIODevice::ReadOnly ) );
|
||||
{
|
||||
QCA::Hash hashObj("md5", provider);
|
||||
QCA::Hash hashObj(QStringLiteral("md5"), provider);
|
||||
hashObj.update( &f2 );
|
||||
QCOMPARE( QString( QCA::arrayToHex( hashObj.final().toByteArray() ) ),
|
||||
QString( "5fc9808ed18e442ab4164c59f151e757" ) );
|
||||
QStringLiteral( "5fc9808ed18e442ab4164c59f151e757" ) );
|
||||
}
|
||||
|
||||
|
||||
QFile f3( TEST_DATA_DIR "/data/twohundredbytes" );
|
||||
QVERIFY( f3.open( QIODevice::ReadOnly ) );
|
||||
{
|
||||
QCA::Hash hashObj("md5", provider);
|
||||
QCA::Hash hashObj(QStringLiteral("md5"), provider);
|
||||
hashObj.update( &f3 );
|
||||
QCOMPARE( QString( QCA::arrayToHex( hashObj.final().toByteArray() ) ),
|
||||
QString( "b91c1f114d942520ecdf7e84e580cda3" ) );
|
||||
QStringLiteral( "b91c1f114d942520ecdf7e84e580cda3" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -257,9 +257,9 @@ void HashUnitTest::sha0test_data()
|
||||
QTest::addColumn<QByteArray>("input");
|
||||
QTest::addColumn<QString>("expectedHash");
|
||||
|
||||
QTest::newRow("sha0(abc)") << QByteArray("abc") << QString("0164b8a914cd2a5e74c4f7ff082c4d97f1edf880");
|
||||
QTest::newRow("sha0(abc)") << QByteArray("abc") << QStringLiteral("0164b8a914cd2a5e74c4f7ff082c4d97f1edf880");
|
||||
QTest::newRow("sha0(abc)") << QByteArray("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq")
|
||||
<< QString("d2516ee1acfa5baf33dfc1c471e438449ef134c8");
|
||||
<< QStringLiteral("d2516ee1acfa5baf33dfc1c471e438449ef134c8");
|
||||
}
|
||||
|
||||
void HashUnitTest::sha0test()
|
||||
@ -272,7 +272,7 @@ void HashUnitTest::sha0test()
|
||||
if(QCA::isSupported("sha0", provider)) {
|
||||
anyProviderTested = true;
|
||||
|
||||
QCA::Hash hash = QCA::Hash("sha0", provider);
|
||||
QCA::Hash hash = QCA::Hash(QStringLiteral("sha0"), provider);
|
||||
QCA::Hash copy = hash;
|
||||
hash.context(); // detach
|
||||
|
||||
@ -292,17 +292,17 @@ void HashUnitTest::sha0longtest()
|
||||
|
||||
foreach(QString provider, providersToTest) {
|
||||
if(QCA::isSupported("sha0", provider)) {
|
||||
QCA::Hash shaHash("sha0", provider);
|
||||
QCA::Hash shaHash(QStringLiteral("sha0"), provider);
|
||||
for (int i=0; i<1000; i++)
|
||||
shaHash.update(fillerString);
|
||||
QCOMPARE( QString(QCA::arrayToHex(shaHash.final().toByteArray())),
|
||||
QString("3232affa48628a26653b5aaa44541fd90d690603" ) );
|
||||
QStringLiteral("3232affa48628a26653b5aaa44541fd90d690603" ) );
|
||||
|
||||
shaHash.clear();
|
||||
for (int i=0; i<1000; i++)
|
||||
shaHash.update(fillerString);
|
||||
QCOMPARE( QString(QCA::arrayToHex(shaHash.final().toByteArray())),
|
||||
QString("3232affa48628a26653b5aaa44541fd90d690603" ) );
|
||||
QStringLiteral("3232affa48628a26653b5aaa44541fd90d690603" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -315,18 +315,18 @@ void HashUnitTest::sha1test_data()
|
||||
QTest::addColumn<QString>("expectedHash");
|
||||
|
||||
// FIPS 180-2, Appendix A.1
|
||||
QTest::newRow("sha1(abc)") << QByteArray("abc") << QString("a9993e364706816aba3e25717850c26c9cd0d89d");
|
||||
QTest::newRow("sha1(abc)") << QByteArray("abc") << QStringLiteral("a9993e364706816aba3e25717850c26c9cd0d89d");
|
||||
|
||||
// FIPS 180-2, Appendix A.2
|
||||
QTest::newRow("sha1(a-q)") << QByteArray("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq")
|
||||
<< QString("84983e441c3bd26ebaae4aa1f95129e5e54670f1");
|
||||
<< QStringLiteral("84983e441c3bd26ebaae4aa1f95129e5e54670f1");
|
||||
|
||||
// AS 2805.13.3-200 Appendix A
|
||||
// also has some duplicates from FIPS 180-2
|
||||
QTest::newRow("sha1()") << QByteArray("") << QString("da39a3ee5e6b4b0d3255bfef95601890afd80709");
|
||||
QTest::newRow("sha1(a)") << QByteArray("a") << QString("86f7e437faa5a7fce15d1ddcb9eaeaea377667b8");
|
||||
QTest::newRow("sha1()") << QByteArray("") << QStringLiteral("da39a3ee5e6b4b0d3255bfef95601890afd80709");
|
||||
QTest::newRow("sha1(a)") << QByteArray("a") << QStringLiteral("86f7e437faa5a7fce15d1ddcb9eaeaea377667b8");
|
||||
QTest::newRow("sha1(a-z)") << QByteArray("abcdefghijklmnopqrstuvwxyz")
|
||||
<< QString("32d10c7b8cf96570ca04ce37f2a19d84240d3a89");
|
||||
<< QStringLiteral("32d10c7b8cf96570ca04ce37f2a19d84240d3a89");
|
||||
}
|
||||
|
||||
void HashUnitTest::sha1test()
|
||||
@ -339,7 +339,7 @@ void HashUnitTest::sha1test()
|
||||
if(QCA::isSupported("sha1", provider)) {
|
||||
anyProviderTested = true;
|
||||
|
||||
QCA::Hash hash = QCA::Hash("sha1", provider);
|
||||
QCA::Hash hash = QCA::Hash(QStringLiteral("sha1"), provider);
|
||||
QCA::Hash copy = hash;
|
||||
hash.context(); // detach
|
||||
|
||||
@ -362,37 +362,37 @@ void HashUnitTest::sha1longtest()
|
||||
// This test extracted from OpenOffice.org 1.1.2, in sal/workben/t_digest.c
|
||||
// It basically reflects FIPS 180-2, Appendix A.3
|
||||
// Also as per AS 2805.13.3-2000 Appendix A
|
||||
QCA::Hash shaHash("sha1", provider);
|
||||
QCA::Hash shaHash(QStringLiteral("sha1"), provider);
|
||||
for (int i=0; i<1000; i++)
|
||||
shaHash.update(fillerString);
|
||||
QCOMPARE( QString(QCA::arrayToHex(shaHash.final().toByteArray())),
|
||||
QString("34aa973cd4c4daa4f61eeb2bdbad27316534016f") );
|
||||
QStringLiteral("34aa973cd4c4daa4f61eeb2bdbad27316534016f") );
|
||||
|
||||
QFile f1( TEST_DATA_DIR "/data/empty" );
|
||||
QVERIFY( f1.open( QIODevice::ReadOnly ) );
|
||||
{
|
||||
QCA::Hash hashObj("sha1", provider);
|
||||
QCA::Hash hashObj(QStringLiteral("sha1"), provider);
|
||||
hashObj.update( &f1 );
|
||||
QCOMPARE( QString( QCA::arrayToHex( hashObj.final().toByteArray() ) ),
|
||||
QString( "da39a3ee5e6b4b0d3255bfef95601890afd80709" ) );
|
||||
QStringLiteral( "da39a3ee5e6b4b0d3255bfef95601890afd80709" ) );
|
||||
}
|
||||
|
||||
QFile f2( TEST_DATA_DIR "/data/twobytes" );
|
||||
QVERIFY( f2.open( QIODevice::ReadOnly ) );
|
||||
{
|
||||
QCA::Hash hashObj("sha1", provider);
|
||||
QCA::Hash hashObj(QStringLiteral("sha1"), provider);
|
||||
hashObj.update( &f2 );
|
||||
QCOMPARE( QString( QCA::arrayToHex( hashObj.final().toByteArray() ) ),
|
||||
QString( "efbd6de3c51ca16094391e837bf52f7452593e5c" ) );
|
||||
QStringLiteral( "efbd6de3c51ca16094391e837bf52f7452593e5c" ) );
|
||||
}
|
||||
|
||||
QFile f3( TEST_DATA_DIR "/data/twohundredbytes" );
|
||||
QVERIFY( f3.open( QIODevice::ReadOnly ) );
|
||||
{
|
||||
QCA::Hash hashObj("sha1", provider);
|
||||
QCA::Hash hashObj(QStringLiteral("sha1"), provider);
|
||||
hashObj.update( &f3 );
|
||||
QCOMPARE( QString( QCA::arrayToHex( hashObj.final().toByteArray() ) ),
|
||||
QString( "d636519dfb18d913acbe69fc3ee5a4c7ac870297" ) );
|
||||
QStringLiteral( "d636519dfb18d913acbe69fc3ee5a4c7ac870297" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -406,11 +406,11 @@ void HashUnitTest::sha224test_data()
|
||||
// These are as specified in FIPS 180-2, change notice 1
|
||||
|
||||
// FIPS 180-2, Appendix B.1
|
||||
QTest::newRow("sha224(abc)") << QByteArray("abc") << QString("23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7");
|
||||
QTest::newRow("sha224(abc)") << QByteArray("abc") << QStringLiteral("23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7");
|
||||
|
||||
// FIPS 180-2, Appendix B.2
|
||||
QTest::newRow("sha224(aq)") << QByteArray("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq")
|
||||
<< QString("75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525");
|
||||
<< QStringLiteral("75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525");
|
||||
}
|
||||
|
||||
void HashUnitTest::sha224test()
|
||||
@ -423,7 +423,7 @@ void HashUnitTest::sha224test()
|
||||
if(QCA::isSupported("sha224", provider)) {
|
||||
anyProviderTested = true;
|
||||
|
||||
QCA::Hash hash = QCA::Hash("sha224", provider);
|
||||
QCA::Hash hash = QCA::Hash(QStringLiteral("sha224"), provider);
|
||||
QCA::Hash copy = hash;
|
||||
hash.context(); // detach
|
||||
|
||||
@ -442,19 +442,19 @@ void HashUnitTest::sha224longtest()
|
||||
|
||||
foreach(QString provider, providersToTest) {
|
||||
if(QCA::isSupported("sha224", provider)) {
|
||||
QCA::Hash shaHash("sha224", provider);
|
||||
QCA::Hash shaHash(QStringLiteral("sha224"), provider);
|
||||
|
||||
// This basically reflects FIPS 180-2, change notice 1, section 3
|
||||
for (int i=0; i<1000; i++)
|
||||
shaHash.update(fillerString);
|
||||
QCOMPARE( QString(QCA::arrayToHex(shaHash.final().toByteArray())),
|
||||
QString("20794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67") );
|
||||
QStringLiteral("20794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67") );
|
||||
|
||||
shaHash.clear();
|
||||
for (int i=0; i<1000; i++)
|
||||
shaHash.update(fillerString);
|
||||
QCOMPARE( QString(QCA::arrayToHex(shaHash.final().toByteArray())),
|
||||
QString("20794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67") );
|
||||
QStringLiteral("20794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67") );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -467,11 +467,11 @@ void HashUnitTest::sha256test_data()
|
||||
// These are as specified in FIPS 180-2
|
||||
|
||||
// FIPS 180-2, Appendix B.1
|
||||
QTest::newRow("sha256(abc)") << QByteArray("abc") << QString("ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad");
|
||||
QTest::newRow("sha256(abc)") << QByteArray("abc") << QStringLiteral("ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad");
|
||||
|
||||
// FIPS 180-2, Appendix B.2
|
||||
QTest::newRow("sha256(abc)") << QByteArray("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq")
|
||||
<< QString("248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1");
|
||||
<< QStringLiteral("248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1");
|
||||
}
|
||||
|
||||
void HashUnitTest::sha256test()
|
||||
@ -484,7 +484,7 @@ void HashUnitTest::sha256test()
|
||||
if(QCA::isSupported("sha256", provider)) {
|
||||
anyProviderTested = true;
|
||||
|
||||
QCA::Hash hash = QCA::Hash("sha256", provider);
|
||||
QCA::Hash hash = QCA::Hash(QStringLiteral("sha256"), provider);
|
||||
QCA::Hash copy = hash;
|
||||
hash.context(); // detach
|
||||
|
||||
@ -502,20 +502,20 @@ void HashUnitTest::sha256longtest()
|
||||
|
||||
foreach(QString provider, providersToTest) {
|
||||
if(QCA::isSupported("sha256", provider)) {
|
||||
QCA::Hash shaHash("sha256", provider);
|
||||
QCA::Hash shaHash(QStringLiteral("sha256"), provider);
|
||||
|
||||
// This basically reflects FIPS 180-2, change notice 1, section 3
|
||||
for (int i=0; i<1000; i++)
|
||||
shaHash.update(fillerString);
|
||||
QCOMPARE( QString(QCA::arrayToHex(shaHash.final().toByteArray())),
|
||||
QString("cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0") );
|
||||
QStringLiteral("cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0") );
|
||||
|
||||
|
||||
shaHash.clear();
|
||||
for (int i=0; i<1000; i++)
|
||||
shaHash.update(fillerString);
|
||||
QCOMPARE( QString(QCA::arrayToHex(shaHash.final().toByteArray())),
|
||||
QString("cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0") );
|
||||
QStringLiteral("cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0") );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -530,15 +530,15 @@ void HashUnitTest::sha384test_data()
|
||||
|
||||
// FIPS 180-2, Appendix B.1
|
||||
QTest::newRow("sha384(abc)") << QByteArray("abc")
|
||||
<< QString("cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7");
|
||||
<< QStringLiteral("cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7");
|
||||
|
||||
// FIPS 180-2, Appendix B.2
|
||||
QTest::newRow("sha384(a-u)") << QByteArray("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu")
|
||||
<< QString("09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039");
|
||||
<< QStringLiteral("09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039");
|
||||
|
||||
// Aaron Gifford, vector002.info
|
||||
QTest::newRow("sha384(a-q)") << QByteArray("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq")
|
||||
<< QString("3391fdddfc8dc7393707a65b1b4709397cf8b1d162af05abfe8f450de5f36bc6b0455a8520bc4e6f5fe95b1fe3c8452b");
|
||||
<< QStringLiteral("3391fdddfc8dc7393707a65b1b4709397cf8b1d162af05abfe8f450de5f36bc6b0455a8520bc4e6f5fe95b1fe3c8452b");
|
||||
|
||||
|
||||
}
|
||||
@ -553,7 +553,7 @@ void HashUnitTest::sha384test()
|
||||
if(QCA::isSupported("sha384", provider)) {
|
||||
anyProviderTested = true;
|
||||
|
||||
QCA::Hash hash = QCA::Hash("sha384", provider);
|
||||
QCA::Hash hash = QCA::Hash(QStringLiteral("sha384"), provider);
|
||||
QCA::Hash copy = hash;
|
||||
hash.context(); // detach
|
||||
|
||||
@ -574,20 +574,20 @@ void HashUnitTest::sha384longtest()
|
||||
if(!QCA::isSupported("sha384", provider)) {
|
||||
// QTime t;
|
||||
// t.start();
|
||||
QCA::Hash shaHash("sha384", provider);
|
||||
QCA::Hash shaHash(QStringLiteral("sha384"), provider);
|
||||
|
||||
// This basically reflects FIPS 180-2, change notice 1, section 3
|
||||
for (int i=0; i<1000; i++)
|
||||
shaHash.update(fillerString);
|
||||
QCOMPARE( QString(QCA::arrayToHex(shaHash.final().toByteArray())),
|
||||
QString("9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985") );
|
||||
QStringLiteral("9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985") );
|
||||
|
||||
|
||||
shaHash.clear();
|
||||
for (int i=0; i<1000; i++)
|
||||
shaHash.update(fillerString);
|
||||
QCOMPARE( QString(QCA::arrayToHex(shaHash.final().toByteArray())),
|
||||
QString("9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985") );
|
||||
QStringLiteral("9d0e1809716474cb086e834e310a4a1ced149e9c00f248527972cec5704c2a5b07b8b3dc38ecc4ebae97ddd87f3d8985") );
|
||||
// qDebug() << "SHA384: " << provider << " elapsed " << t.elapsed();
|
||||
}
|
||||
}
|
||||
@ -602,14 +602,14 @@ void HashUnitTest::sha512test_data()
|
||||
|
||||
// FIPS 180-2, Appendix C.1
|
||||
QTest::newRow("sha512(abc)") << QByteArray("abc")
|
||||
<< QString("ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f");
|
||||
<< QStringLiteral("ddaf35a193617abacc417349ae20413112e6fa4e89a97ea20a9eeee64b55d39a2192992a274fc1a836ba3c23a3feebbd454d4423643ce80e2a9ac94fa54ca49f");
|
||||
// FIPS 180-2, Appendix C.2
|
||||
QTest::newRow("sha512(a-u)") << QByteArray("abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu")
|
||||
<< QString("8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909");
|
||||
<< QStringLiteral("8e959b75dae313da8cf4f72814fc143f8f7779c6eb9f7fa17299aeadb6889018501d289e4900f7e4331b99dec4b5433ac7d329eeb6dd26545e96e55b874be909");
|
||||
|
||||
// Aaron Gifford, vector002.info
|
||||
QTest::newRow("sha512(a-q)") << QByteArray("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq")
|
||||
<< QString("204a8fc6dda82f0a0ced7beb8e08a41657c16ef468b228a8279be331a703c33596fd15c13b1b07f9aa1d3bea57789ca031ad85c7a71dd70354ec631238ca3445");
|
||||
<< QStringLiteral("204a8fc6dda82f0a0ced7beb8e08a41657c16ef468b228a8279be331a703c33596fd15c13b1b07f9aa1d3bea57789ca031ad85c7a71dd70354ec631238ca3445");
|
||||
}
|
||||
|
||||
void HashUnitTest::sha512test()
|
||||
@ -622,7 +622,7 @@ void HashUnitTest::sha512test()
|
||||
if(QCA::isSupported("sha512", provider)) {
|
||||
anyProviderTested = true;
|
||||
|
||||
QCA::Hash hash = QCA::Hash("sha512", provider);
|
||||
QCA::Hash hash = QCA::Hash(QStringLiteral("sha512"), provider);
|
||||
QCA::Hash copy = hash;
|
||||
hash.context(); // detach
|
||||
|
||||
@ -640,19 +640,19 @@ void HashUnitTest::sha512longtest()
|
||||
|
||||
foreach(QString provider, providersToTest) {
|
||||
if(QCA::isSupported("sha512", provider)) {
|
||||
QCA::Hash shaHash("sha512", provider);
|
||||
QCA::Hash shaHash(QStringLiteral("sha512"), provider);
|
||||
|
||||
// This basically reflects FIPS 180-2, change notice 1, section 3
|
||||
for (int i=0; i<1000; i++)
|
||||
shaHash.update(fillerString);
|
||||
QCOMPARE( QString(QCA::arrayToHex(shaHash.final().toByteArray())),
|
||||
QString("e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b") );
|
||||
QStringLiteral("e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b") );
|
||||
|
||||
shaHash.clear();
|
||||
for (int i=0; i<1000; i++)
|
||||
shaHash.update(fillerString);
|
||||
QCOMPARE( QString(QCA::arrayToHex(shaHash.final().toByteArray())),
|
||||
QString("e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b") );
|
||||
QStringLiteral("e718483d0ce769644e2e42c7bc15b4638e1f98b13b2044285632a803afa973ebde0ff244877ea60a4cb0432ce577c31beb009c5c2c49aa2e4eadb217ad8cc09b") );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -664,17 +664,17 @@ void HashUnitTest::rmd160test_data()
|
||||
QTest::addColumn<QByteArray>("input");
|
||||
QTest::addColumn<QString>("expectedHash");
|
||||
|
||||
QTest::newRow("rmd160()") << QByteArray("") << QString("9c1185a5c5e9fc54612808977ee8f548b2258d31");
|
||||
QTest::newRow("rmd160(a)") << QByteArray("a") << QString("0bdc9d2d256b3ee9daae347be6f4dc835a467ffe");
|
||||
QTest::newRow("rmd160(abc)") << QByteArray("abc") << QString("8eb208f7e05d987a9b044a8e98c6b087f15a0bfc");
|
||||
QTest::newRow("rmd160(md)") << QByteArray("message digest") << QString("5d0689ef49d2fae572b881b123a85ffa21595f36");
|
||||
QTest::newRow("rmd160(a-z)") << QByteArray("abcdefghijklmnopqrstuvwxyz") << QString("f71c27109c692c1b56bbdceb5b9d2865b3708dbc");
|
||||
QTest::newRow("rmd160()") << QByteArray("") << QStringLiteral("9c1185a5c5e9fc54612808977ee8f548b2258d31");
|
||||
QTest::newRow("rmd160(a)") << QByteArray("a") << QStringLiteral("0bdc9d2d256b3ee9daae347be6f4dc835a467ffe");
|
||||
QTest::newRow("rmd160(abc)") << QByteArray("abc") << QStringLiteral("8eb208f7e05d987a9b044a8e98c6b087f15a0bfc");
|
||||
QTest::newRow("rmd160(md)") << QByteArray("message digest") << QStringLiteral("5d0689ef49d2fae572b881b123a85ffa21595f36");
|
||||
QTest::newRow("rmd160(a-z)") << QByteArray("abcdefghijklmnopqrstuvwxyz") << QStringLiteral("f71c27109c692c1b56bbdceb5b9d2865b3708dbc");
|
||||
QTest::newRow("rmd160(a-q)") << QByteArray("abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq")
|
||||
<< QString("12a053384a9c0c88e405a06c27dcf49ada62eb2b");
|
||||
<< QStringLiteral("12a053384a9c0c88e405a06c27dcf49ada62eb2b");
|
||||
QTest::newRow("rmd160(A-9)") << QByteArray("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")
|
||||
<< QString("b0e20b6e3116640286ed3a87a5713079b21f5189");
|
||||
<< QStringLiteral("b0e20b6e3116640286ed3a87a5713079b21f5189");
|
||||
QTest::newRow("rmd160(1-0)") << QByteArray("12345678901234567890123456789012345678901234567890123456789012345678901234567890")
|
||||
<< QString("9b752e45573d4b39f4dbd3323cab82bf63326bfb");
|
||||
<< QStringLiteral("9b752e45573d4b39f4dbd3323cab82bf63326bfb");
|
||||
}
|
||||
|
||||
|
||||
@ -688,7 +688,7 @@ void HashUnitTest::rmd160test()
|
||||
if(QCA::isSupported("ripemd160", provider)) {
|
||||
anyProviderTested = true;
|
||||
|
||||
QCA::Hash hash = QCA::Hash("ripemd160", provider);
|
||||
QCA::Hash hash = QCA::Hash(QStringLiteral("ripemd160"), provider);
|
||||
QCA::Hash copy = hash;
|
||||
hash.context(); // detach
|
||||
|
||||
@ -706,19 +706,19 @@ void HashUnitTest::rmd160longtest()
|
||||
|
||||
foreach(QString provider, providersToTest) {
|
||||
if(QCA::isSupported("ripemd160", provider)) {
|
||||
QCA::Hash rmdHash("ripemd160", provider);
|
||||
QCA::Hash rmdHash(QStringLiteral("ripemd160"), provider);
|
||||
|
||||
// This is the "million times 'a' test"
|
||||
for (int i=0; i<1000; i++)
|
||||
rmdHash.update(fillerString);
|
||||
QCOMPARE( QString(QCA::arrayToHex(rmdHash.final().toByteArray())),
|
||||
QString("52783243c1697bdbe16d37f97f68f08325dc1528") );
|
||||
QStringLiteral("52783243c1697bdbe16d37f97f68f08325dc1528") );
|
||||
|
||||
rmdHash.clear();
|
||||
for (int i=0; i<1000; i++)
|
||||
rmdHash.update(fillerString);
|
||||
QCOMPARE( QString(QCA::arrayToHex(rmdHash.final().toByteArray())),
|
||||
QString("52783243c1697bdbe16d37f97f68f08325dc1528") );
|
||||
QStringLiteral("52783243c1697bdbe16d37f97f68f08325dc1528") );
|
||||
|
||||
// This is the "8 rounds of 1234567890" test.
|
||||
// It also ensure that we can re-use hash objects correctly.
|
||||
@ -728,7 +728,7 @@ void HashUnitTest::rmd160longtest()
|
||||
for (int i=0; i<8; i++)
|
||||
rmdHash.update(fillerArray);
|
||||
QCOMPARE( QString(QCA::arrayToHex(rmdHash.final().toByteArray())),
|
||||
QString("9b752e45573d4b39f4dbd3323cab82bf63326bfb") );
|
||||
QStringLiteral("9b752e45573d4b39f4dbd3323cab82bf63326bfb") );
|
||||
|
||||
}
|
||||
}
|
||||
@ -741,17 +741,17 @@ void HashUnitTest::whirlpooltest_data()
|
||||
QTest::addColumn<QByteArray>("input");
|
||||
QTest::addColumn<QString>("expectedHash");
|
||||
|
||||
QTest::newRow("whirlpool()") << QByteArray("") << QString("19fa61d75522a4669b44e39c1d2e1726c530232130d407f89afee0964997f7a73e83be698b288febcf88e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3");
|
||||
QTest::newRow("whirlpool(a)") << QByteArray("a") << QString("8aca2602792aec6f11a67206531fb7d7f0dff59413145e6973c45001d0087b42d11bc645413aeff63a42391a39145a591a92200d560195e53b478584fdae231a");
|
||||
QTest::newRow("whirlpool(abc)") << QByteArray("abc") << QString("4e2448a4c6f486bb16b6562c73b4020bf3043e3a731bce721ae1b303d97e6d4c7181eebdb6c57e277d0e34957114cbd6c797fc9d95d8b582d225292076d4eef5");
|
||||
QTest::newRow("whirlpool(md)") << QByteArray("message digest") << QString("378c84a4126e2dc6e56dcc7458377aac838d00032230f53ce1f5700c0ffb4d3b8421557659ef55c106b4b52ac5a4aaa692ed920052838f3362e86dbd37a8903e");
|
||||
QTest::newRow("whirlpool()") << QByteArray("") << QStringLiteral("19fa61d75522a4669b44e39c1d2e1726c530232130d407f89afee0964997f7a73e83be698b288febcf88e3e03c4f0757ea8964e59b63d93708b138cc42a66eb3");
|
||||
QTest::newRow("whirlpool(a)") << QByteArray("a") << QStringLiteral("8aca2602792aec6f11a67206531fb7d7f0dff59413145e6973c45001d0087b42d11bc645413aeff63a42391a39145a591a92200d560195e53b478584fdae231a");
|
||||
QTest::newRow("whirlpool(abc)") << QByteArray("abc") << QStringLiteral("4e2448a4c6f486bb16b6562c73b4020bf3043e3a731bce721ae1b303d97e6d4c7181eebdb6c57e277d0e34957114cbd6c797fc9d95d8b582d225292076d4eef5");
|
||||
QTest::newRow("whirlpool(md)") << QByteArray("message digest") << QStringLiteral("378c84a4126e2dc6e56dcc7458377aac838d00032230f53ce1f5700c0ffb4d3b8421557659ef55c106b4b52ac5a4aaa692ed920052838f3362e86dbd37a8903e");
|
||||
QTest::newRow("whirlpool(a-k)") << QByteArray("abcdbcdecdefdefgefghfghighijhijk")
|
||||
<< QString("2a987ea40f917061f5d6f0a0e4644f488a7a5a52deee656207c562f988e95c6916bdc8031bc5be1b7b947639fe050b56939baaa0adff9ae6745b7b181c3be3fd");
|
||||
QTest::newRow("whirlpool(a-z)") << QByteArray("abcdefghijklmnopqrstuvwxyz") << QString("f1d754662636ffe92c82ebb9212a484a8d38631ead4238f5442ee13b8054e41b08bf2a9251c30b6a0b8aae86177ab4a6f68f673e7207865d5d9819a3dba4eb3b");
|
||||
<< QStringLiteral("2a987ea40f917061f5d6f0a0e4644f488a7a5a52deee656207c562f988e95c6916bdc8031bc5be1b7b947639fe050b56939baaa0adff9ae6745b7b181c3be3fd");
|
||||
QTest::newRow("whirlpool(a-z)") << QByteArray("abcdefghijklmnopqrstuvwxyz") << QStringLiteral("f1d754662636ffe92c82ebb9212a484a8d38631ead4238f5442ee13b8054e41b08bf2a9251c30b6a0b8aae86177ab4a6f68f673e7207865d5d9819a3dba4eb3b");
|
||||
QTest::newRow("whirlpool(A-9)") << QByteArray("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789")
|
||||
<< QString("dc37e008cf9ee69bf11f00ed9aba26901dd7c28cdec066cc6af42e40f82f3a1e08eba26629129d8fb7cb57211b9281a65517cc879d7b962142c65f5a7af01467");
|
||||
<< QStringLiteral("dc37e008cf9ee69bf11f00ed9aba26901dd7c28cdec066cc6af42e40f82f3a1e08eba26629129d8fb7cb57211b9281a65517cc879d7b962142c65f5a7af01467");
|
||||
QTest::newRow("whirlpool(1-0)") << QByteArray("12345678901234567890123456789012345678901234567890123456789012345678901234567890")
|
||||
<< QString("466ef18babb0154d25b9d38a6414f5c08784372bccb204d6549c4afadb6014294d5bd8df2a6c44e538cd047b2681a51a2c60481e88c5a20b2c2a80cf3a9a083b");
|
||||
<< QStringLiteral("466ef18babb0154d25b9d38a6414f5c08784372bccb204d6549c4afadb6014294d5bd8df2a6c44e538cd047b2681a51a2c60481e88c5a20b2c2a80cf3a9a083b");
|
||||
|
||||
}
|
||||
|
||||
@ -766,7 +766,7 @@ void HashUnitTest::whirlpooltest()
|
||||
if(QCA::isSupported("whirlpool", provider)) {
|
||||
anyProviderTested = true;
|
||||
|
||||
QCA::Hash hash = QCA::Hash("whirlpool", provider);
|
||||
QCA::Hash hash = QCA::Hash(QStringLiteral("whirlpool"), provider);
|
||||
QCA::Hash copy = hash;
|
||||
hash.context(); // detach
|
||||
|
||||
@ -784,19 +784,19 @@ void HashUnitTest::whirlpoollongtest()
|
||||
|
||||
foreach(QString provider, providersToTest) {
|
||||
if(QCA::isSupported("whirlpool", provider)) {
|
||||
QCA::Hash rmdHash("whirlpool", provider);
|
||||
QCA::Hash rmdHash(QStringLiteral("whirlpool"), provider);
|
||||
|
||||
// This is the "million times 'a' test"
|
||||
for (int i=0; i<1000; i++)
|
||||
rmdHash.update(fillerString);
|
||||
QCOMPARE( QString(QCA::arrayToHex(rmdHash.final().toByteArray())),
|
||||
QString("0c99005beb57eff50a7cf005560ddf5d29057fd86b20bfd62deca0f1ccea4af51fc15490eddc47af32bb2b66c34ff9ad8c6008ad677f77126953b226e4ed8b01") );
|
||||
QStringLiteral("0c99005beb57eff50a7cf005560ddf5d29057fd86b20bfd62deca0f1ccea4af51fc15490eddc47af32bb2b66c34ff9ad8c6008ad677f77126953b226e4ed8b01") );
|
||||
|
||||
rmdHash.clear();
|
||||
for (int i=0; i<1000; i++)
|
||||
rmdHash.update(fillerString);
|
||||
QCOMPARE( QString(QCA::arrayToHex(rmdHash.final().toByteArray())),
|
||||
QString("0c99005beb57eff50a7cf005560ddf5d29057fd86b20bfd62deca0f1ccea4af51fc15490eddc47af32bb2b66c34ff9ad8c6008ad677f77126953b226e4ed8b01") );
|
||||
QStringLiteral("0c99005beb57eff50a7cf005560ddf5d29057fd86b20bfd62deca0f1ccea4af51fc15490eddc47af32bb2b66c34ff9ad8c6008ad677f77126953b226e4ed8b01") );
|
||||
|
||||
// This is the "8 rounds of 1234567890" test.
|
||||
// It also ensure that we can re-use hash objects correctly.
|
||||
@ -806,7 +806,7 @@ void HashUnitTest::whirlpoollongtest()
|
||||
for (int i=0; i<8; i++)
|
||||
rmdHash.update(fillerArray);
|
||||
QCOMPARE( QString(QCA::arrayToHex(rmdHash.final().toByteArray())),
|
||||
QString("466ef18babb0154d25b9d38a6414f5c08784372bccb204d6549c4afadb6014294d5bd8df2a6c44e538cd047b2681a51a2c60481e88c5a20b2c2a80cf3a9a083b") );
|
||||
QStringLiteral("466ef18babb0154d25b9d38a6414f5c08784372bccb204d6549c4afadb6014294d5bd8df2a6c44e538cd047b2681a51a2c60481e88c5a20b2c2a80cf3a9a083b") );
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -60,19 +60,19 @@ void HexUnitTest::testHexString_data()
|
||||
QTest::addColumn<QString>("raw");
|
||||
QTest::addColumn<QString>("encoded");
|
||||
|
||||
QTest::newRow("abcd") << QString("abcd") << QString("61626364");
|
||||
QTest::newRow("ABCD") << QString("ABCD") << QString("41424344");
|
||||
QTest::newRow("empty") << QString("") << QString("");
|
||||
QTest::newRow("abcddef") << QString("abcddef") << QString("61626364646566");
|
||||
QTest::newRow("empty too") << QString("\0") << QString(""); // Empty QString.
|
||||
QTest::newRow("BEL") << QString("\a") << QString("07"); // BEL
|
||||
QTest::newRow("BS") << QString("\b") << QString("08"); // BS
|
||||
QTest::newRow("HT") << QString("\t") << QString("09"); // HT
|
||||
QTest::newRow("LF") << QString("\n") << QString("0a"); // LF
|
||||
QTest::newRow("VT") << QString("\v") << QString("0b"); // VT
|
||||
QTest::newRow("FF") << QString("\f") << QString("0c"); // FF
|
||||
QTest::newRow("CR") << QString("\r") << QString("0d"); // CR
|
||||
QTest::newRow("bug126735") << QString("@ABCDEFGHIJKLMNO") << QString("404142434445464748494a4b4c4d4e4f");
|
||||
QTest::newRow("abcd") << QStringLiteral("abcd") << QStringLiteral("61626364");
|
||||
QTest::newRow("ABCD") << QStringLiteral("ABCD") << QStringLiteral("41424344");
|
||||
QTest::newRow("empty") << QString(QLatin1String("")) << QString(QLatin1String(""));
|
||||
QTest::newRow("abcddef") << QStringLiteral("abcddef") << QStringLiteral("61626364646566");
|
||||
QTest::newRow("empty too") << QString("\0") << QString(""); // Empty QString. clazy:exclude=qstring-allocations
|
||||
QTest::newRow("BEL") << QStringLiteral("\a") << QStringLiteral("07"); // BEL
|
||||
QTest::newRow("BS") << QStringLiteral("\b") << QStringLiteral("08"); // BS
|
||||
QTest::newRow("HT") << QStringLiteral("\t") << QStringLiteral("09"); // HT
|
||||
QTest::newRow("LF") << QStringLiteral("\n") << QStringLiteral("0a"); // LF
|
||||
QTest::newRow("VT") << QStringLiteral("\v") << QStringLiteral("0b"); // VT
|
||||
QTest::newRow("FF") << QStringLiteral("\f") << QStringLiteral("0c"); // FF
|
||||
QTest::newRow("CR") << QStringLiteral("\r") << QStringLiteral("0d"); // CR
|
||||
QTest::newRow("bug126735") << QStringLiteral("@ABCDEFGHIJKLMNO") << QStringLiteral("404142434445464748494a4b4c4d4e4f");
|
||||
}
|
||||
|
||||
void HexUnitTest::testHexString()
|
||||
|
@ -78,27 +78,27 @@ void KDFUnitTest::pbkdf1md2Tests_data()
|
||||
QTest::addColumn<unsigned int>("iterationCount"); // number of iterations
|
||||
|
||||
// These are from Botan's test suite
|
||||
QTest::newRow("1") << QString("71616c7a73656774")
|
||||
<< QString("7c1991f3f38a09d70cf3b1acadb70bc6")
|
||||
<< QString("40cf117c3865e0cf")
|
||||
QTest::newRow("1") << QStringLiteral("71616c7a73656774")
|
||||
<< QStringLiteral("7c1991f3f38a09d70cf3b1acadb70bc6")
|
||||
<< QStringLiteral("40cf117c3865e0cf")
|
||||
<< static_cast<unsigned int>(16)
|
||||
<< static_cast<unsigned int>(1000);
|
||||
|
||||
QTest::newRow("2") << QString("766e68617a6a66736978626f6d787175")
|
||||
<< QString("677500eda9f0c5e96e0a11f90fb9")
|
||||
<< QString("3a2484ce5d3e1b4d")
|
||||
QTest::newRow("2") << QStringLiteral("766e68617a6a66736978626f6d787175")
|
||||
<< QStringLiteral("677500eda9f0c5e96e0a11f90fb9")
|
||||
<< QStringLiteral("3a2484ce5d3e1b4d")
|
||||
<< static_cast<unsigned int>(14)
|
||||
<< static_cast<unsigned int>(1);
|
||||
|
||||
QTest::newRow("3") << QString("66686565746e657162646d7171716e797977696f716a666c6f6976636371756a")
|
||||
<< QString("91a5b689156b441bf27dd2bdd276")
|
||||
<< QString("5d838b0f4fa22bfa2157f9083d87f8752e0495bb2113012761ef11b66e87c3cb")
|
||||
QTest::newRow("3") << QStringLiteral("66686565746e657162646d7171716e797977696f716a666c6f6976636371756a")
|
||||
<< QStringLiteral("91a5b689156b441bf27dd2bdd276")
|
||||
<< QStringLiteral("5d838b0f4fa22bfa2157f9083d87f8752e0495bb2113012761ef11b66e87c3cb")
|
||||
<< static_cast<unsigned int>(14)
|
||||
<< static_cast<unsigned int>(15);
|
||||
|
||||
QTest::newRow("4") << QString("736e6279696e6a7075696b7176787867726c6b66")
|
||||
<< QString("49516935cc9f438bafa30ff038fb")
|
||||
<< QString("f22d341361b47e3390107bd973fdc0d3e0bc02a3")
|
||||
QTest::newRow("4") << QStringLiteral("736e6279696e6a7075696b7176787867726c6b66")
|
||||
<< QStringLiteral("49516935cc9f438bafa30ff038fb")
|
||||
<< QStringLiteral("f22d341361b47e3390107bd973fdc0d3e0bc02a3")
|
||||
<< static_cast<unsigned int>(14)
|
||||
<< static_cast<unsigned int>(2);
|
||||
}
|
||||
@ -117,7 +117,7 @@ void KDFUnitTest::pbkdf1md2Tests()
|
||||
anyProviderTested = true;
|
||||
QCA::SecureArray password = QCA::hexToArray( secret );
|
||||
QCA::InitializationVector iv( QCA::hexToArray( salt) );
|
||||
QCA::SymmetricKey key = QCA::PBKDF1("md2", provider).makeKey( password,
|
||||
QCA::SymmetricKey key = QCA::PBKDF1(QStringLiteral("md2"), provider).makeKey( password,
|
||||
iv,
|
||||
outputLength,
|
||||
iterationCount);
|
||||
@ -136,33 +136,33 @@ void KDFUnitTest::pbkdf1sha1Tests_data()
|
||||
QTest::addColumn<unsigned int>("iterationCount"); // number of iterations
|
||||
|
||||
// These are from Botan's test suite
|
||||
QTest::newRow("1") << QString("66746c6b6662786474626a62766c6c7662776977")
|
||||
<< QString("768b277dc970f912dbdd3edad48ad2f065d25d")
|
||||
<< QString("40ac5837560251c275af5e30a6a3074e57ced38e")
|
||||
QTest::newRow("1") << QStringLiteral("66746c6b6662786474626a62766c6c7662776977")
|
||||
<< QStringLiteral("768b277dc970f912dbdd3edad48ad2f065d25d")
|
||||
<< QStringLiteral("40ac5837560251c275af5e30a6a3074e57ced38e")
|
||||
<< static_cast<unsigned int>(19)
|
||||
<< static_cast<unsigned int>(6);
|
||||
|
||||
QTest::newRow("2") << QString("786e736f736d6b766867677a7370636e63706f63")
|
||||
<< QString("4d90e846a4b6aaa02ac548014a00e97e506b2afb")
|
||||
<< QString("7008a9dc1b9a81470a2360275c19dab77f716824")
|
||||
QTest::newRow("2") << QStringLiteral("786e736f736d6b766867677a7370636e63706f63")
|
||||
<< QStringLiteral("4d90e846a4b6aaa02ac548014a00e97e506b2afb")
|
||||
<< QStringLiteral("7008a9dc1b9a81470a2360275c19dab77f716824")
|
||||
<< static_cast<unsigned int>(20)
|
||||
<< static_cast<unsigned int>(6);
|
||||
|
||||
QTest::newRow("3") << QString("6f74696c71776c756b717473")
|
||||
<< QString("71ed1a995e693efcd33155935e800037da74ea28")
|
||||
<< QString("ccfc44c09339040e55d3f7f76ca6ef838fde928717241deb9ac1a4ef45a27711")
|
||||
QTest::newRow("3") << QStringLiteral("6f74696c71776c756b717473")
|
||||
<< QStringLiteral("71ed1a995e693efcd33155935e800037da74ea28")
|
||||
<< QStringLiteral("ccfc44c09339040e55d3f7f76ca6ef838fde928717241deb9ac1a4ef45a27711")
|
||||
<< static_cast<unsigned int>(20)
|
||||
<< static_cast<unsigned int>(2001);
|
||||
|
||||
QTest::newRow("4") << QString("6b7a6e657166666c6274767374686e6663746166")
|
||||
<< QString("f345fb8fbd880206b650266661f6")
|
||||
<< QString("8108883fc04a01feb10661651516425dad1c93e0")
|
||||
QTest::newRow("4") << QStringLiteral("6b7a6e657166666c6274767374686e6663746166")
|
||||
<< QStringLiteral("f345fb8fbd880206b650266661f6")
|
||||
<< QStringLiteral("8108883fc04a01feb10661651516425dad1c93e0")
|
||||
<< static_cast<unsigned int>(14)
|
||||
<< static_cast<unsigned int>(10000);
|
||||
|
||||
QTest::newRow("5") << QString("716b78686c7170656d7868796b6d7975636a626f")
|
||||
<< QString("2d54dfed0c7ef7d20b0945ba414a")
|
||||
<< QString("bc8bc53d4604977c3adb1d19c15e87b77a84c2f6")
|
||||
QTest::newRow("5") << QStringLiteral("716b78686c7170656d7868796b6d7975636a626f")
|
||||
<< QStringLiteral("2d54dfed0c7ef7d20b0945ba414a")
|
||||
<< QStringLiteral("bc8bc53d4604977c3adb1d19c15e87b77a84c2f6")
|
||||
<< static_cast<unsigned int>(14)
|
||||
<< static_cast<unsigned int>(10000);
|
||||
}
|
||||
@ -181,7 +181,7 @@ void KDFUnitTest::pbkdf1sha1Tests()
|
||||
anyProviderTested = true;
|
||||
QCA::SecureArray password = QCA::hexToArray( secret );
|
||||
QCA::InitializationVector iv( QCA::hexToArray( salt) );
|
||||
QCA::PBKDF1 pbkdf = QCA::PBKDF1("sha1", provider);
|
||||
QCA::PBKDF1 pbkdf = QCA::PBKDF1(QStringLiteral("sha1"), provider);
|
||||
QCA::PBKDF1 copy = pbkdf;
|
||||
copy.context(); // detach
|
||||
QCA::SymmetricKey key = pbkdf.makeKey( password, iv, outputLength, iterationCount);
|
||||
@ -201,13 +201,13 @@ void KDFUnitTest::pbkdf1sha1TimeTest()
|
||||
|
||||
foreach(QString provider, providersToTest) {
|
||||
if(QCA::isSupported("pbkdf1(sha1)", provider)) {
|
||||
QCA::SymmetricKey key1(QCA::PBKDF1("sha1", provider).makeKey(password,
|
||||
QCA::SymmetricKey key1(QCA::PBKDF1(QStringLiteral("sha1"), provider).makeKey(password,
|
||||
iv,
|
||||
outputLength,
|
||||
timeInterval,
|
||||
&iterationCount));
|
||||
|
||||
QCA::SymmetricKey key2(QCA::PBKDF1("sha1", provider).makeKey(password,
|
||||
QCA::SymmetricKey key2(QCA::PBKDF1(QStringLiteral("sha1"), provider).makeKey(password,
|
||||
iv,
|
||||
outputLength,
|
||||
iterationCount));
|
||||
@ -226,57 +226,57 @@ void KDFUnitTest::pbkdf2Tests_data()
|
||||
QTest::addColumn<unsigned int>("iterationCount"); // number of iterations
|
||||
|
||||
// These are from Botan's test suite
|
||||
QTest::newRow("1") << QString("6a79756571677872736367676c707864796b6366")
|
||||
<< QString("df6d9d72872404bf73e708cf3b7d")
|
||||
<< QString("9b56e55328a4c97a250738f8dba1b992e8a1b508")
|
||||
QTest::newRow("1") << QStringLiteral("6a79756571677872736367676c707864796b6366")
|
||||
<< QStringLiteral("df6d9d72872404bf73e708cf3b7d")
|
||||
<< QStringLiteral("9b56e55328a4c97a250738f8dba1b992e8a1b508")
|
||||
<< static_cast<unsigned int>(14)
|
||||
<< static_cast<unsigned int>(10000);
|
||||
|
||||
QTest::newRow("2") << QString("61717271737a6e7a76767a67746b73616d6d676f")
|
||||
<< QString("fa13f40af1ade2a30f2fffd66fc8a659ef95e6388c1682fc0fe4d15a70109517a32942e39c371440")
|
||||
<< QString("57487813cdd2220dfc485d932a2979ee8769ea8b")
|
||||
QTest::newRow("2") << QStringLiteral("61717271737a6e7a76767a67746b73616d6d676f")
|
||||
<< QStringLiteral("fa13f40af1ade2a30f2fffd66fc8a659ef95e6388c1682fc0fe4d15a70109517a32942e39c371440")
|
||||
<< QStringLiteral("57487813cdd2220dfc485d932a2979ee8769ea8b")
|
||||
<< static_cast<unsigned int>(40)
|
||||
<< static_cast<unsigned int>(101);
|
||||
|
||||
QTest::newRow("3") << QString("6c7465786d666579796c6d6c62727379696b6177")
|
||||
<< QString("027afadd48f4be8dcc4f")
|
||||
<< QString("ed1f39a0a7f3889aaf7e60743b3bc1cc2c738e60")
|
||||
QTest::newRow("3") << QStringLiteral("6c7465786d666579796c6d6c62727379696b6177")
|
||||
<< QStringLiteral("027afadd48f4be8dcc4f")
|
||||
<< QStringLiteral("ed1f39a0a7f3889aaf7e60743b3bc1cc2c738e60")
|
||||
<< static_cast<unsigned int>(10)
|
||||
<< static_cast<unsigned int>(1000);
|
||||
|
||||
QTest::newRow("4") << QString("6378676e7972636772766c6c796c6f6c736a706f")
|
||||
<< QString("7c0d009fc91b48cb6d19bafbfccff3e2ccabfe725eaa234e56bde1d551c132f2")
|
||||
<< QString("94ac88200743fb0f6ac51be62166cbef08d94c15")
|
||||
QTest::newRow("4") << QStringLiteral("6378676e7972636772766c6c796c6f6c736a706f")
|
||||
<< QStringLiteral("7c0d009fc91b48cb6d19bafbfccff3e2ccabfe725eaa234e56bde1d551c132f2")
|
||||
<< QStringLiteral("94ac88200743fb0f6ac51be62166cbef08d94c15")
|
||||
<< static_cast<unsigned int>(32)
|
||||
<< static_cast<unsigned int>(1);
|
||||
|
||||
QTest::newRow("5") << QString("7871796668727865686965646c6865776e76626a")
|
||||
<< QString("4661301d3517ca4443a6a607b32b2a63f69996299df75db75f1e0b98dd0eb7d8")
|
||||
<< QString("24a1a50b17d63ee8394b69fc70887f4f94883d68")
|
||||
QTest::newRow("5") << QStringLiteral("7871796668727865686965646c6865776e76626a")
|
||||
<< QStringLiteral("4661301d3517ca4443a6a607b32b2a63f69996299df75db75f1e0b98dd0eb7d8")
|
||||
<< QStringLiteral("24a1a50b17d63ee8394b69fc70887f4f94883d68")
|
||||
<< static_cast<unsigned int>(32)
|
||||
<< static_cast<unsigned int>(5);
|
||||
|
||||
QTest::newRow("6") << QString("616e6461716b706a7761627663666e706e6a6b6c")
|
||||
<< QString("82fb44a521448d5aac94b5158ead1e4dcd7363081a747b9f7626752bda2d")
|
||||
<< QString("9316c80801623cc2734af74bec42cf4dbaa3f6d5")
|
||||
QTest::newRow("6") << QStringLiteral("616e6461716b706a7761627663666e706e6a6b6c")
|
||||
<< QStringLiteral("82fb44a521448d5aac94b5158ead1e4dcd7363081a747b9f7626752bda2d")
|
||||
<< QStringLiteral("9316c80801623cc2734af74bec42cf4dbaa3f6d5")
|
||||
<< static_cast<unsigned int>(30)
|
||||
<< static_cast<unsigned int>(100);
|
||||
|
||||
QTest::newRow("7") << QString("687361767679766f636c6f79757a746c736e6975")
|
||||
<< QString("f8ec2b0ac817896ac8189d787c6424ed24a6d881436687a4629802c0ecce")
|
||||
<< QString("612cc61df3cf2bdb36e10c4d8c9d73192bddee05")
|
||||
QTest::newRow("7") << QStringLiteral("687361767679766f636c6f79757a746c736e6975")
|
||||
<< QStringLiteral("f8ec2b0ac817896ac8189d787c6424ed24a6d881436687a4629802c0ecce")
|
||||
<< QStringLiteral("612cc61df3cf2bdb36e10c4d8c9d73192bddee05")
|
||||
<< static_cast<unsigned int>(30)
|
||||
<< static_cast<unsigned int>(100);
|
||||
|
||||
QTest::newRow("8") << QString("6561696d72627a70636f706275736171746b6d77")
|
||||
<< QString("c9a0b2622f13916036e29e7462e206e8ba5b50ce9212752eb8ea2a4aa7b40a4cc1bf")
|
||||
<< QString("45248f9d0cebcb86a18243e76c972a1f3b36772a")
|
||||
QTest::newRow("8") << QStringLiteral("6561696d72627a70636f706275736171746b6d77")
|
||||
<< QStringLiteral("c9a0b2622f13916036e29e7462e206e8ba5b50ce9212752eb8ea2a4aa7b40a4cc1bf")
|
||||
<< QStringLiteral("45248f9d0cebcb86a18243e76c972a1f3b36772a")
|
||||
<< static_cast<unsigned int>(34)
|
||||
<< static_cast<unsigned int>(100);
|
||||
|
||||
QTest::newRow("9") << QString("67777278707178756d7364736d626d6866686d666463766c63766e677a6b6967")
|
||||
<< QString("4c9db7ba24955225d5b845f65ef24ef1b0c6e86f2e39c8ddaa4b8abd26082d1f350381fadeaeb560dc447afc68a6b47e6ea1e7412f6cf7b2d82342fccd11d3b4")
|
||||
<< QString("a39b76c6eec8374a11493ad08c246a3e40dfae5064f4ee3489c273646178")
|
||||
QTest::newRow("9") << QStringLiteral("67777278707178756d7364736d626d6866686d666463766c63766e677a6b6967")
|
||||
<< QStringLiteral("4c9db7ba24955225d5b845f65ef24ef1b0c6e86f2e39c8ddaa4b8abd26082d1f350381fadeaeb560dc447afc68a6b47e6ea1e7412f6cf7b2d82342fccd11d3b4")
|
||||
<< QStringLiteral("a39b76c6eec8374a11493ad08c246a3e40dfae5064f4ee3489c273646178")
|
||||
<< static_cast<unsigned int>(64)
|
||||
<< static_cast<unsigned int>(1000);
|
||||
|
||||
@ -297,7 +297,7 @@ void KDFUnitTest::pbkdf2Tests()
|
||||
anyProviderTested = true;
|
||||
QCA::SecureArray password = QCA::hexToArray( secret );
|
||||
QCA::InitializationVector iv( QCA::hexToArray( salt) );
|
||||
QCA::PBKDF2 pbkdf = QCA::PBKDF2("sha1", provider);
|
||||
QCA::PBKDF2 pbkdf = QCA::PBKDF2(QStringLiteral("sha1"), provider);
|
||||
QCA::PBKDF2 copy = pbkdf;
|
||||
copy.context(); // detach
|
||||
QCA::SymmetricKey key = pbkdf.makeKey( password, iv, outputLength, iterationCount);
|
||||
@ -319,13 +319,13 @@ void KDFUnitTest::pbkdf2TimeTest()
|
||||
|
||||
foreach(QString provider, providersToTest) {
|
||||
if(QCA::isSupported("pbkdf2(sha1)", provider)) {
|
||||
QCA::SymmetricKey key1(QCA::PBKDF2("sha1", provider).makeKey(password,
|
||||
QCA::SymmetricKey key1(QCA::PBKDF2(QStringLiteral("sha1"), provider).makeKey(password,
|
||||
iv,
|
||||
outputLength,
|
||||
timeInterval,
|
||||
&iterationCount));
|
||||
|
||||
QCA::SymmetricKey key2(QCA::PBKDF2("sha1", provider).makeKey(password,
|
||||
QCA::SymmetricKey key2(QCA::PBKDF2(QStringLiteral("sha1"), provider).makeKey(password,
|
||||
iv,
|
||||
outputLength,
|
||||
iterationCount));
|
||||
@ -344,8 +344,8 @@ void KDFUnitTest::pbkdf2extraTests()
|
||||
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.toByteArray()), QString( "6349e09cb6b8c1485cfa9780ee3264df" ) );
|
||||
QCA::SymmetricKey passwordOut = QCA::PBKDF2(QStringLiteral("sha1"), provider).makeKey (password, salt, 16, iterations);
|
||||
QCOMPARE( QCA::arrayToHex(passwordOut.toByteArray()), QStringLiteral( "6349e09cb6b8c1485cfa9780ee3264df" ) );
|
||||
}
|
||||
|
||||
// RFC3962, Appendix B
|
||||
@ -353,11 +353,11 @@ void KDFUnitTest::pbkdf2extraTests()
|
||||
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.toByteArray()), QString( "cdedb5281bb2f801565a1122b2563515" ) );
|
||||
passwordOut = QCA::PBKDF2("sha1", provider).makeKey (password, salt, 32, iterations);
|
||||
QCA::SymmetricKey passwordOut = QCA::PBKDF2(QStringLiteral("sha1"), provider).makeKey (password, salt, 16, iterations);
|
||||
QCOMPARE( QCA::arrayToHex(passwordOut.toByteArray()), QStringLiteral( "cdedb5281bb2f801565a1122b2563515" ) );
|
||||
passwordOut = QCA::PBKDF2(QStringLiteral("sha1"), provider).makeKey (password, salt, 32, iterations);
|
||||
QCOMPARE( QCA::arrayToHex(passwordOut.toByteArray()),
|
||||
QString( "cdedb5281bb2f801565a1122b25635150ad1f7a04bb9f3a333ecc0e2e1f70837" ) );
|
||||
QStringLiteral( "cdedb5281bb2f801565a1122b25635150ad1f7a04bb9f3a333ecc0e2e1f70837" ) );
|
||||
}
|
||||
|
||||
// RFC3962, Appendix B
|
||||
@ -365,11 +365,11 @@ void KDFUnitTest::pbkdf2extraTests()
|
||||
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.toByteArray()), QString( "01dbee7f4a9e243e988b62c73cda935d" ) );
|
||||
passwordOut = QCA::PBKDF2("sha1", provider).makeKey (password, salt, 32, iterations);
|
||||
QCA::SymmetricKey passwordOut = QCA::PBKDF2(QStringLiteral("sha1"), provider).makeKey (password, salt, 16, iterations);
|
||||
QCOMPARE( QCA::arrayToHex(passwordOut.toByteArray()), QStringLiteral( "01dbee7f4a9e243e988b62c73cda935d" ) );
|
||||
passwordOut = QCA::PBKDF2(QStringLiteral("sha1"), provider).makeKey (password, salt, 32, iterations);
|
||||
QCOMPARE( QCA::arrayToHex(passwordOut.toByteArray()),
|
||||
QString( "01dbee7f4a9e243e988b62c73cda935da05378b93244ec8f48a99e61ad799d86" ) );
|
||||
QStringLiteral( "01dbee7f4a9e243e988b62c73cda935da05378b93244ec8f48a99e61ad799d86" ) );
|
||||
}
|
||||
|
||||
// RFC3962, Appendix B
|
||||
@ -377,26 +377,26 @@ void KDFUnitTest::pbkdf2extraTests()
|
||||
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.toByteArray()), QString( "5c08eb61fdf71e4e4ec3cf6ba1f5512b" ) );
|
||||
passwordOut = QCA::PBKDF2("sha1", provider).makeKey (password, salt, 32, iterations);
|
||||
QCA::SymmetricKey passwordOut = QCA::PBKDF2(QStringLiteral("sha1"), provider).makeKey (password, salt, 16, iterations);
|
||||
QCOMPARE( QCA::arrayToHex(passwordOut.toByteArray()), QStringLiteral( "5c08eb61fdf71e4e4ec3cf6ba1f5512b" ) );
|
||||
passwordOut = QCA::PBKDF2(QStringLiteral("sha1"), provider).makeKey (password, salt, 32, iterations);
|
||||
QCOMPARE( QCA::arrayToHex(passwordOut.toByteArray()),
|
||||
QString( "5c08eb61fdf71e4e4ec3cf6ba1f5512ba7e52ddbc5e5142f708a31e2e62b1e13" ) );
|
||||
QStringLiteral( "5c08eb61fdf71e4e4ec3cf6ba1f5512ba7e52ddbc5e5142f708a31e2e62b1e13" ) );
|
||||
}
|
||||
|
||||
// RFC3211 and RFC3962, Appendix B
|
||||
{
|
||||
QCA::InitializationVector salt(QCA::hexToArray("1234567878563412"));
|
||||
QCA::InitializationVector salt(QCA::hexToArray(QStringLiteral("1234567878563412")));
|
||||
QCA::SecureArray password("password");
|
||||
int iterations = 5;
|
||||
QCA::SymmetricKey passwordOut = QCA::PBKDF2("sha1", provider).makeKey (password, salt, 16, iterations);
|
||||
QCOMPARE( QCA::arrayToHex(passwordOut.toByteArray()), QString( "d1daa78615f287e6a1c8b120d7062a49" ) );
|
||||
passwordOut = QCA::PBKDF2("sha1", provider).makeKey (password, salt, 32, iterations);
|
||||
QCA::SymmetricKey passwordOut = QCA::PBKDF2(QStringLiteral("sha1"), provider).makeKey (password, salt, 16, iterations);
|
||||
QCOMPARE( QCA::arrayToHex(passwordOut.toByteArray()), QStringLiteral( "d1daa78615f287e6a1c8b120d7062a49" ) );
|
||||
passwordOut = QCA::PBKDF2(QStringLiteral("sha1"), provider).makeKey (password, salt, 32, iterations);
|
||||
QCOMPARE( QCA::arrayToHex(passwordOut.toByteArray()),
|
||||
QString( "d1daa78615f287e6a1c8b120d7062a493f98d203e6be49a6adf4fa574b6e64ee" ) );
|
||||
QStringLiteral( "d1daa78615f287e6a1c8b120d7062a493f98d203e6be49a6adf4fa574b6e64ee" ) );
|
||||
passwordOut = QCA::PBKDF2().makeKey (password, salt, 8, iterations);
|
||||
QCOMPARE( QCA::arrayToHex(passwordOut.toByteArray()),
|
||||
QString( "d1daa78615f287e6" ) );
|
||||
QStringLiteral( "d1daa78615f287e6" ) );
|
||||
}
|
||||
|
||||
// RFC3962, Appendix B
|
||||
@ -404,11 +404,11 @@ void KDFUnitTest::pbkdf2extraTests()
|
||||
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.toByteArray()), QString( "139c30c0966bc32ba55fdbf212530ac9" ) );
|
||||
passwordOut = QCA::PBKDF2("sha1", provider).makeKey (password, salt, 32, iterations);
|
||||
QCA::SymmetricKey passwordOut = QCA::PBKDF2(QStringLiteral("sha1"), provider).makeKey (password, salt, 16, iterations);
|
||||
QCOMPARE( QCA::arrayToHex(passwordOut.toByteArray()), QStringLiteral( "139c30c0966bc32ba55fdbf212530ac9" ) );
|
||||
passwordOut = QCA::PBKDF2(QStringLiteral("sha1"), provider).makeKey (password, salt, 32, iterations);
|
||||
QCOMPARE( QCA::arrayToHex(passwordOut.toByteArray()),
|
||||
QString( "139c30c0966bc32ba55fdbf212530ac9c5ec59f1a452f5cc9ad940fea0598ed1" ) );
|
||||
QStringLiteral( "139c30c0966bc32ba55fdbf212530ac9c5ec59f1a452f5cc9ad940fea0598ed1" ) );
|
||||
}
|
||||
|
||||
// RFC3962, Appendix B
|
||||
@ -417,13 +417,13 @@ void KDFUnitTest::pbkdf2extraTests()
|
||||
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.toByteArray()), QString( "9ccad6d468770cd51b10e6a68721be61" ) );
|
||||
passwordOut = QCA::PBKDF2("sha1", provider).makeKey (password, salt, 32, iterations);
|
||||
QCA::SymmetricKey passwordOut = QCA::PBKDF2(QStringLiteral("sha1"), provider).makeKey (password, salt, 16, iterations);
|
||||
QCOMPARE( QCA::arrayToHex(passwordOut.toByteArray()), QStringLiteral( "9ccad6d468770cd51b10e6a68721be61" ) );
|
||||
passwordOut = QCA::PBKDF2(QStringLiteral("sha1"), provider).makeKey (password, salt, 32, iterations);
|
||||
QCOMPARE( QCA::arrayToHex(passwordOut.toByteArray()),
|
||||
QString( "9ccad6d468770cd51b10e6a68721be611a8b4d282601db3b36be9246915ec82a" ) );
|
||||
QStringLiteral( "9ccad6d468770cd51b10e6a68721be611a8b4d282601db3b36be9246915ec82a" ) );
|
||||
} catch(std::exception &) {
|
||||
if (provider == "qca-botan")
|
||||
if (provider == QLatin1String("qca-botan"))
|
||||
qDebug() << "You should use a later version of Botan";
|
||||
else
|
||||
QFAIL("exception");
|
||||
@ -433,13 +433,13 @@ void KDFUnitTest::pbkdf2extraTests()
|
||||
// RFC3962, Appendix B
|
||||
{
|
||||
QCA::InitializationVector salt(QCA::SecureArray("EXAMPLE.COMpianist"));
|
||||
QCA::SecureArray password(QCA::hexToArray("f09d849e"));
|
||||
QCA::SecureArray password(QCA::hexToArray(QStringLiteral("f09d849e")));
|
||||
int iterations = 50;
|
||||
QCA::SymmetricKey passwordOut = QCA::PBKDF2("sha1", provider).makeKey (password, salt, 16, iterations);
|
||||
QCOMPARE( QCA::arrayToHex(passwordOut.toByteArray()), QString( "6b9cf26d45455a43a5b8bb276a403b39" ) );
|
||||
passwordOut = QCA::PBKDF2("sha1", provider).makeKey (password, salt, 32, iterations);
|
||||
QCA::SymmetricKey passwordOut = QCA::PBKDF2(QStringLiteral("sha1"), provider).makeKey (password, salt, 16, iterations);
|
||||
QCOMPARE( QCA::arrayToHex(passwordOut.toByteArray()), QStringLiteral( "6b9cf26d45455a43a5b8bb276a403b39" ) );
|
||||
passwordOut = QCA::PBKDF2(QStringLiteral("sha1"), provider).makeKey (password, salt, 32, iterations);
|
||||
QCOMPARE( QCA::arrayToHex(passwordOut.toByteArray()),
|
||||
QString( "6b9cf26d45455a43a5b8bb276a403b39e7fe37a0c41e02c281ff3069e1e94f52" ) );
|
||||
QStringLiteral( "6b9cf26d45455a43a5b8bb276a403b39e7fe37a0c41e02c281ff3069e1e94f52" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -453,20 +453,20 @@ void KDFUnitTest::hkdfTests_data()
|
||||
QTest::addColumn<QString>("output"); // the key you get back
|
||||
|
||||
// RFC 5869, Appendix A
|
||||
QTest::newRow("1") << QString("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b")
|
||||
<< QString("000102030405060708090a0b0c")
|
||||
<< QString("f0f1f2f3f4f5f6f7f8f9")
|
||||
<< QString("3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865");
|
||||
QTest::newRow("1") << QStringLiteral("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b")
|
||||
<< QStringLiteral("000102030405060708090a0b0c")
|
||||
<< QStringLiteral("f0f1f2f3f4f5f6f7f8f9")
|
||||
<< QStringLiteral("3cb25f25faacd57a90434f64d0362f2a2d2d0a90cf1a5a4c5db02d56ecc4c5bf34007208d5b887185865");
|
||||
|
||||
QTest::newRow("2") << QString("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f")
|
||||
<< QString("606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf")
|
||||
<< QString("b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff")
|
||||
<< QString("b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87");
|
||||
QTest::newRow("2") << QStringLiteral("000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f")
|
||||
<< QStringLiteral("606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a5a6a7a8a9aaabacadaeaf")
|
||||
<< QStringLiteral("b0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff")
|
||||
<< QStringLiteral("b11e398dc80327a1c8e7f78c596a49344f012eda2d4efad8a050cc4c19afa97c59045a99cac7827271cb41c65e590e09da3275600c2f09b8367793a9aca3db71cc30c58179ec3e87c14c01d5c1f3434f1d87");
|
||||
|
||||
QTest::newRow("3") << QString("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b")
|
||||
QTest::newRow("3") << QStringLiteral("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b")
|
||||
<< QString()
|
||||
<< QString()
|
||||
<< QString("8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8");
|
||||
<< QStringLiteral("8da4e775a563c18f715f802a063c5a31b8a11f5c5ee1879ec3454e5f3c738d2d9d201395faa4b61a96c8");
|
||||
}
|
||||
|
||||
void KDFUnitTest::hkdfTests()
|
||||
@ -483,7 +483,7 @@ void KDFUnitTest::hkdfTests()
|
||||
QCA::SecureArray password = QCA::hexToArray( secret );
|
||||
QCA::InitializationVector saltv( QCA::hexToArray( salt ) );
|
||||
QCA::InitializationVector infov( QCA::hexToArray( info ) );
|
||||
QCA::HKDF hkdf = QCA::HKDF("sha256", provider);
|
||||
QCA::HKDF hkdf = QCA::HKDF(QStringLiteral("sha256"), provider);
|
||||
QCA::HKDF copy = hkdf;
|
||||
copy.context(); // detach
|
||||
|
||||
|
@ -84,7 +84,7 @@ void KeyBundleTest::fromFile()
|
||||
if ( QCA::isSupported("pkcs12") ) {
|
||||
// "start" is the passphrase, but you wouldn't normally
|
||||
// code it in like this
|
||||
QCA::KeyBundle userBundle( "user2good.p12", "start" );
|
||||
QCA::KeyBundle userBundle( QStringLiteral("user2good.p12"), "start" );
|
||||
QCOMPARE( userBundle.isNull(), false );
|
||||
QCOMPARE( userBundle.name(), QString() );
|
||||
QCOMPARE( userBundle.certificateChain().isEmpty(), false );
|
||||
@ -107,19 +107,19 @@ void KeyBundleTest::fromFile()
|
||||
void KeyBundleTest::names()
|
||||
{
|
||||
if ( QCA::isSupported("pkcs12") ) {
|
||||
QCA::KeyBundle serverBundle( "servergood2.p12", "start" );
|
||||
QCA::KeyBundle serverBundle( QStringLiteral("servergood2.p12"), "start" );
|
||||
QCOMPARE( serverBundle.isNull(), false );
|
||||
QCOMPARE( serverBundle.name(), QString() );
|
||||
|
||||
serverBundle.setName( "Some Server Bundle" );
|
||||
QCOMPARE( serverBundle.name(), QString( "Some Server Bundle" ) );
|
||||
serverBundle.setName( QStringLiteral("Some Server Bundle") );
|
||||
QCOMPARE( serverBundle.name(), QStringLiteral( "Some Server Bundle" ) );
|
||||
}
|
||||
}
|
||||
|
||||
void KeyBundleTest::certChain()
|
||||
{
|
||||
if ( QCA::isSupported("pkcs12") ) {
|
||||
QCA::KeyBundle serverBundle( "servergood2.p12", "start" );
|
||||
QCA::KeyBundle serverBundle( QStringLiteral("servergood2.p12"), "start" );
|
||||
QCOMPARE( serverBundle.isNull(), false );
|
||||
QCOMPARE( serverBundle.certificateChain().size(), 1 );
|
||||
}
|
||||
@ -128,7 +128,7 @@ void KeyBundleTest::certChain()
|
||||
void KeyBundleTest::privKey()
|
||||
{
|
||||
if ( QCA::isSupported("pkcs12") ) {
|
||||
QCA::KeyBundle serverBundle( "servergood2.p12", "start" );
|
||||
QCA::KeyBundle serverBundle( QStringLiteral("servergood2.p12"), "start" );
|
||||
QCOMPARE( serverBundle.isNull(), false );
|
||||
QCOMPARE( serverBundle.privateKey().isNull(), false );
|
||||
}
|
||||
@ -142,24 +142,24 @@ void KeyBundleTest::createBundle()
|
||||
if ( !QCA::isSupported( "certificate" ) )
|
||||
return;
|
||||
|
||||
QCA::Certificate ca( "RootCA2cert.pem" );
|
||||
QCA::Certificate ca( QStringLiteral("RootCA2cert.pem") );
|
||||
QCOMPARE( ca.isNull(), false );
|
||||
|
||||
QCA::Certificate primary( "user2goodcert.pem" );
|
||||
QCA::Certificate primary( QStringLiteral("user2goodcert.pem") );
|
||||
QCOMPARE( primary.isNull(), false );
|
||||
|
||||
QCA::PrivateKey key( "user2goodkey.pem" );
|
||||
QCA::PrivateKey key( QStringLiteral("user2goodkey.pem") );
|
||||
QCOMPARE( key.isNull(), false );
|
||||
|
||||
QCA::CertificateChain chain( primary );
|
||||
chain.append( ca );
|
||||
|
||||
newBundle->setCertificateChainAndKey( chain, key );
|
||||
newBundle->setName( "My New Key Bundle" );
|
||||
newBundle->setName( QStringLiteral("My New Key Bundle") );
|
||||
|
||||
QCOMPARE( newBundle->certificateChain(), chain );
|
||||
QCOMPARE( newBundle->privateKey(), key );
|
||||
QCOMPARE( newBundle->name(), QString( "My New Key Bundle" ) );
|
||||
QCOMPARE( newBundle->name(), QStringLiteral( "My New Key Bundle" ) );
|
||||
|
||||
// Try round tripping the bundle
|
||||
foreach( const QCA::Provider *thisProvider, QCA::providers() ) {
|
||||
@ -173,7 +173,7 @@ void KeyBundleTest::createBundle()
|
||||
QCA::KeyBundle bundleFromArray = QCA::KeyBundle::fromArray( bundleArray, "reel secrut", &res, provider );
|
||||
QCOMPARE( res, QCA::ConvertGood );
|
||||
QCOMPARE( bundleFromArray.isNull(), false );
|
||||
QCOMPARE( bundleFromArray.name(), QString( "My New Key Bundle" ) );
|
||||
QCOMPARE( bundleFromArray.name(), QStringLiteral( "My New Key Bundle" ) );
|
||||
QCOMPARE( bundleFromArray.certificateChain(), chain );
|
||||
QCOMPARE( bundleFromArray.privateKey(), key );
|
||||
|
||||
@ -186,7 +186,7 @@ void KeyBundleTest::createBundle()
|
||||
QCA::KeyBundle bundleFromFile = QCA::KeyBundle::fromFile( tempFile.fileName(), "file passphrase", &res, provider );
|
||||
QCOMPARE( res, QCA::ConvertGood );
|
||||
QCOMPARE( bundleFromFile.isNull(), false );
|
||||
QCOMPARE( bundleFromFile.name(), QString( "My New Key Bundle" ) );
|
||||
QCOMPARE( bundleFromFile.name(), QStringLiteral( "My New Key Bundle" ) );
|
||||
QCOMPARE( bundleFromFile.certificateChain(), chain );
|
||||
QCOMPARE( bundleFromFile.privateKey(), key );
|
||||
}
|
||||
|
@ -57,14 +57,14 @@ void KeyStore::nullKeystore()
|
||||
{
|
||||
QCA::KeyStoreManager manager;
|
||||
if ( QCA::isSupported( "keystore" ) ) {
|
||||
QCA::KeyStore nullStore( QString( "null store" ), &manager );
|
||||
QCA::KeyStore nullStore( QStringLiteral( "null store" ), &manager );
|
||||
QVERIFY( nullStore.isValid() );
|
||||
|
||||
QVERIFY( nullStore.entryList().isEmpty() );
|
||||
|
||||
QCOMPARE( nullStore.type(), QCA::KeyStore::User);
|
||||
|
||||
QCOMPARE( nullStore.id(), QString( "null store" ) );
|
||||
QCOMPARE( nullStore.id(), QStringLiteral( "null store" ) );
|
||||
QCOMPARE( nullStore.holdsTrustedCertificates(), false );
|
||||
QCOMPARE( nullStore.holdsIdentities(), false );
|
||||
QCOMPARE( nullStore.holdsPGPPublicKeys(), false );
|
||||
|
@ -50,7 +50,7 @@ class NullLogger : public QCA::AbstractLogDevice
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
NullLogger() : QCA::AbstractLogDevice( "null logger" )
|
||||
NullLogger() : QCA::AbstractLogDevice( QStringLiteral( "null logger" ) )
|
||||
{}
|
||||
};
|
||||
|
||||
@ -58,7 +58,7 @@ class LastLogger : public QCA::AbstractLogDevice
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LastLogger() : QCA::AbstractLogDevice( "last logger" )
|
||||
LastLogger() : QCA::AbstractLogDevice( QStringLiteral( "last logger" ) )
|
||||
{}
|
||||
|
||||
void logTextMessage( const QString &message, enum QCA::Logger::Severity severity ) override
|
||||
@ -124,8 +124,8 @@ void LoggerUnitTest::basicSetup()
|
||||
|
||||
logSystem->registerLogDevice( nullLogger );
|
||||
QCOMPARE( logSystem->currentLogDevices().count(), 1 );
|
||||
QVERIFY( logSystem->currentLogDevices().contains( "null logger" ) );
|
||||
logSystem->unregisterLogDevice( "null logger" );
|
||||
QVERIFY( logSystem->currentLogDevices().contains( QStringLiteral("null logger") ) );
|
||||
logSystem->unregisterLogDevice( QStringLiteral("null logger") );
|
||||
QCOMPARE( logSystem->currentLogDevices().count(), 0 );
|
||||
|
||||
delete nullLogger;
|
||||
@ -135,37 +135,37 @@ void LoggerUnitTest::logText1()
|
||||
{
|
||||
QCA::Logger *logSystem = QCA::logger();
|
||||
|
||||
logSystem->logTextMessage( "Sending with no recipients" );
|
||||
logSystem->logTextMessage( QStringLiteral("Sending with no recipients") );
|
||||
|
||||
LastLogger *lastlogger = new LastLogger;
|
||||
logSystem->registerLogDevice( lastlogger );
|
||||
QCOMPARE( logSystem->currentLogDevices().count(), 1 );
|
||||
QVERIFY( logSystem->currentLogDevices().contains( "last logger" ) );
|
||||
QVERIFY( logSystem->currentLogDevices().contains( QStringLiteral("last logger" ) ) );
|
||||
|
||||
logSystem->logTextMessage( "Sending to system, checking for log device" );
|
||||
logSystem->logTextMessage( QStringLiteral("Sending to system, checking for log device") );
|
||||
QCOMPARE( lastlogger->lastMessage(),
|
||||
QString( "Sending to system, checking for log device" ) );
|
||||
QStringLiteral( "Sending to system, checking for log device" ) );
|
||||
QCOMPARE( lastlogger->lastMessageSeverity(), QCA::Logger::Information );
|
||||
|
||||
logSystem->logTextMessage( "Sending at Error severity", QCA::Logger::Error );
|
||||
logSystem->logTextMessage( QStringLiteral("Sending at Error severity"), QCA::Logger::Error );
|
||||
QCOMPARE( lastlogger->lastMessage(),
|
||||
QString( "Sending at Error severity" ) );
|
||||
QStringLiteral( "Sending at Error severity" ) );
|
||||
QCOMPARE( lastlogger->lastMessageSeverity(), QCA::Logger::Error );
|
||||
|
||||
LastLogger *lastlogger2 = new LastLogger;
|
||||
logSystem->registerLogDevice( lastlogger2 );
|
||||
QCOMPARE( logSystem->currentLogDevices().count(), 2 );
|
||||
QVERIFY( logSystem->currentLogDevices().contains( "last logger" ) );
|
||||
QVERIFY( logSystem->currentLogDevices().contains( QStringLiteral("last logger" ) ) );
|
||||
|
||||
logSystem->logTextMessage( "Sending to system, checking for two log devices" );
|
||||
logSystem->logTextMessage( QStringLiteral("Sending to system, checking for two log devices") );
|
||||
QCOMPARE( lastlogger->lastMessage(),
|
||||
QString( "Sending to system, checking for two log devices" ) );
|
||||
QStringLiteral( "Sending to system, checking for two log devices" ) );
|
||||
QCOMPARE( lastlogger->lastMessageSeverity(), QCA::Logger::Information );
|
||||
QCOMPARE( lastlogger2->lastMessage(),
|
||||
QString( "Sending to system, checking for two log devices" ) );
|
||||
QStringLiteral( "Sending to system, checking for two log devices" ) );
|
||||
QCOMPARE( lastlogger2->lastMessageSeverity(), QCA::Logger::Information );
|
||||
|
||||
logSystem->unregisterLogDevice( "last logger" ); // this will remove them both
|
||||
logSystem->unregisterLogDevice( QStringLiteral("last logger") ); // this will remove them both
|
||||
|
||||
QCOMPARE( logSystem->currentLogDevices().count(), 0 );
|
||||
|
||||
@ -177,39 +177,39 @@ void LoggerUnitTest::logText1()
|
||||
// same as above, but use convenience routine.
|
||||
void LoggerUnitTest::logText2()
|
||||
{
|
||||
QCA_logTextMessage ( "Sending with no recipients", QCA::Logger::Notice );
|
||||
QCA_logTextMessage ( QStringLiteral("Sending with no recipients"), QCA::Logger::Notice );
|
||||
|
||||
LastLogger *lastlogger = new LastLogger;
|
||||
|
||||
QCA::Logger *logSystem = QCA::logger();
|
||||
logSystem->registerLogDevice( lastlogger );
|
||||
QCOMPARE( logSystem->currentLogDevices().count(), 1 );
|
||||
QVERIFY( logSystem->currentLogDevices().contains( "last logger" ) );
|
||||
QVERIFY( logSystem->currentLogDevices().contains( QStringLiteral("last logger" ) ) );
|
||||
|
||||
QCA_logTextMessage ( "Sending to system, checking for log device", QCA::Logger::Information );
|
||||
QCA_logTextMessage ( QStringLiteral("Sending to system, checking for log device"), QCA::Logger::Information );
|
||||
QCOMPARE( lastlogger->lastMessage(),
|
||||
QString( "Sending to system, checking for log device" ) );
|
||||
QStringLiteral( "Sending to system, checking for log device" ) );
|
||||
QCOMPARE( lastlogger->lastMessageSeverity(), QCA::Logger::Information );
|
||||
|
||||
QCA_logTextMessage ( "Sending at Error severity", QCA::Logger::Error );
|
||||
QCA_logTextMessage ( QStringLiteral("Sending at Error severity"), QCA::Logger::Error );
|
||||
QCOMPARE( lastlogger->lastMessage(),
|
||||
QString( "Sending at Error severity" ) );
|
||||
QStringLiteral( "Sending at Error severity" ) );
|
||||
QCOMPARE( lastlogger->lastMessageSeverity(), QCA::Logger::Error );
|
||||
|
||||
LastLogger *lastlogger2 = new LastLogger;
|
||||
logSystem->registerLogDevice( lastlogger2 );
|
||||
QCOMPARE( logSystem->currentLogDevices().count(), 2 );
|
||||
QVERIFY( logSystem->currentLogDevices().contains( "last logger" ) );
|
||||
QVERIFY( logSystem->currentLogDevices().contains( QStringLiteral("last logger" ) ) );
|
||||
|
||||
QCA_logTextMessage ( "Sending to system, checking for two log devices", QCA::Logger::Information );
|
||||
QCA_logTextMessage ( QStringLiteral("Sending to system, checking for two log devices"), QCA::Logger::Information );
|
||||
QCOMPARE( lastlogger->lastMessage(),
|
||||
QString( "Sending to system, checking for two log devices" ) );
|
||||
QStringLiteral( "Sending to system, checking for two log devices" ) );
|
||||
QCOMPARE( lastlogger->lastMessageSeverity(), QCA::Logger::Information );
|
||||
QCOMPARE( lastlogger2->lastMessage(),
|
||||
QString( "Sending to system, checking for two log devices" ) );
|
||||
QStringLiteral( "Sending to system, checking for two log devices" ) );
|
||||
QCOMPARE( lastlogger2->lastMessageSeverity(), QCA::Logger::Information );
|
||||
|
||||
logSystem->unregisterLogDevice( "last logger" ); // this will remove them both
|
||||
logSystem->unregisterLogDevice( QStringLiteral("last logger") ); // this will remove them both
|
||||
|
||||
QCOMPARE( logSystem->currentLogDevices().count(), 0 );
|
||||
|
||||
@ -229,7 +229,7 @@ void LoggerUnitTest::logBlob()
|
||||
LastLogger *lastlogger = new LastLogger;
|
||||
logSystem->registerLogDevice( lastlogger );
|
||||
QCOMPARE( logSystem->currentLogDevices().count(), 1 );
|
||||
QVERIFY( logSystem->currentLogDevices().contains( "last logger" ) );
|
||||
QVERIFY( logSystem->currentLogDevices().contains( QStringLiteral("last logger" ) ) );
|
||||
|
||||
logSystem->logBinaryMessage( test );
|
||||
QCOMPARE( lastlogger->lastBlob(), test );
|
||||
@ -242,7 +242,7 @@ void LoggerUnitTest::logBlob()
|
||||
LastLogger *lastlogger2 = new LastLogger;
|
||||
logSystem->registerLogDevice( lastlogger2 );
|
||||
QCOMPARE( logSystem->currentLogDevices().count(), 2 );
|
||||
QVERIFY( logSystem->currentLogDevices().contains( "last logger" ) );
|
||||
QVERIFY( logSystem->currentLogDevices().contains( QStringLiteral("last logger" ) ) );
|
||||
|
||||
test += test;
|
||||
logSystem->logBinaryMessage( test );
|
||||
@ -251,7 +251,7 @@ void LoggerUnitTest::logBlob()
|
||||
QCOMPARE( lastlogger2->lastBlob(), test );
|
||||
QCOMPARE( lastlogger2->lastBlobSeverity(), QCA::Logger::Information );
|
||||
|
||||
logSystem->unregisterLogDevice( "last logger" ); // this will remove them both
|
||||
logSystem->unregisterLogDevice( QStringLiteral("last logger") ); // this will remove them both
|
||||
|
||||
QCOMPARE( logSystem->currentLogDevices().count(), 0 );
|
||||
delete lastlogger;
|
||||
@ -269,14 +269,14 @@ void LoggerUnitTest::logLevel()
|
||||
logSystem->setLevel (QCA::Logger::Error);
|
||||
QCOMPARE( logSystem->level (), QCA::Logger::Error );
|
||||
|
||||
QCA_logTextMessage ( "Sending to system, checking that it is filtered out", QCA::Logger::Information );
|
||||
QCA_logTextMessage ( QStringLiteral("Sending to system, checking that it is filtered out"), QCA::Logger::Information );
|
||||
QEXPECT_FAIL("", "Should fail", Continue);
|
||||
QCOMPARE( lastlogger->lastMessage(),
|
||||
QString( "Sending to system, checking that it is filtered out" ) );
|
||||
QStringLiteral( "Sending to system, checking that it is filtered out" ) );
|
||||
|
||||
QCA_logTextMessage ( "Sending to system, checking that it is not filtered out", QCA::Logger::Error );
|
||||
QCA_logTextMessage ( QStringLiteral("Sending to system, checking that it is not filtered out"), QCA::Logger::Error );
|
||||
QCOMPARE( lastlogger->lastMessage(),
|
||||
QString( "Sending to system, checking that it is not filtered out" ) );
|
||||
QStringLiteral( "Sending to system, checking that it is not filtered out" ) );
|
||||
|
||||
logSystem->setLevel (QCA::Logger::Debug);
|
||||
|
||||
|
@ -62,16 +62,16 @@ void MACUnitTest::cleanupTestCase()
|
||||
void MACUnitTest::HMACMD5()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append("qca-gcrypt");
|
||||
providersToTest.append("qca-botan");
|
||||
providersToTest.append("qca-nss");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
providersToTest.append(QStringLiteral("qca-gcrypt"));
|
||||
providersToTest.append(QStringLiteral("qca-botan"));
|
||||
providersToTest.append(QStringLiteral("qca-nss"));
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
if( !QCA::isSupported( "hmac(md5)", provider ) )
|
||||
QWARN( QString( "HMAC(MD5) not supported for "+provider).toLocal8Bit().constData() );
|
||||
QWARN( (QStringLiteral( "HMAC(MD5) not supported for ")+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QCA::MessageAuthenticationCode md5hmacLenTest( "hmac(md5)", QCA::SymmetricKey(), provider );
|
||||
QCA::MessageAuthenticationCode md5hmacLenTest( QStringLiteral("hmac(md5)"), QCA::SymmetricKey(), provider );
|
||||
QCOMPARE( md5hmacLenTest.validKeyLength( 0 ), true );
|
||||
QCOMPARE( md5hmacLenTest.validKeyLength( 1 ), true );
|
||||
QCOMPARE( md5hmacLenTest.validKeyLength( 848888 ), true );
|
||||
@ -82,58 +82,58 @@ 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::MessageAuthenticationCode md5hmac1( QStringLiteral("hmac(md5)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key1( QCA::SecureArray( "Jefe" ) );
|
||||
md5hmac1.setup( key1 );
|
||||
QCA::SecureArray data1( "what do ya want for nothing?" );
|
||||
md5hmac1.update( data1 );
|
||||
QCOMPARE( QCA::arrayToHex( md5hmac1.final().toByteArray() ), QString( "750c783e6ab0b503eaa86e310a5db738" ) );
|
||||
QCOMPARE( QCA::arrayToHex( md5hmac1.final().toByteArray() ), QStringLiteral( "750c783e6ab0b503eaa86e310a5db738" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode md5hmac2( "hmac(md5)", QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key2( QCA::hexToArray( "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b" ) );
|
||||
QCA::MessageAuthenticationCode md5hmac2( QStringLiteral("hmac(md5)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key2( QCA::hexToArray( QStringLiteral("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b") ) );
|
||||
md5hmac2.setup( key2 );
|
||||
QCA::SecureArray data2 = QCA::SecureArray( "Hi There" );
|
||||
md5hmac2.update( data2 );
|
||||
QCOMPARE( QCA::arrayToHex( md5hmac2.final().toByteArray() ), QString( "9294727a3638bb1c13f48ef8158bfc9d" ) );
|
||||
QCOMPARE( QCA::arrayToHex( md5hmac2.final().toByteArray() ), QStringLiteral( "9294727a3638bb1c13f48ef8158bfc9d" ) );
|
||||
|
||||
// test reuse
|
||||
md5hmac2.clear();
|
||||
QCA::SymmetricKey key3( QCA::hexToArray( "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" ) );
|
||||
QCA::SymmetricKey key3( QCA::hexToArray( QStringLiteral("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA") ) );
|
||||
md5hmac2.setup ( key3 );
|
||||
QCA::SecureArray data3( 50 );
|
||||
for ( int i = 0; i < data3.size(); i++ )
|
||||
data3[ i ] = (char)0xDD;
|
||||
md5hmac2.update( data3 );
|
||||
QCOMPARE( QCA::arrayToHex( md5hmac2.final().toByteArray() ), QString( "56be34521d144c88dbb8c733f0e8b3f6" ) );
|
||||
QCOMPARE( QCA::arrayToHex( md5hmac2.final().toByteArray() ), QStringLiteral( "56be34521d144c88dbb8c733f0e8b3f6" ) );
|
||||
|
||||
QCA::SymmetricKey key4( QCA::hexToArray( "0102030405060708090a0b0c0d0e0f10111213141516171819") );
|
||||
QCA::MessageAuthenticationCode md5hmac4( "hmac(md5)", key4, provider );
|
||||
QCA::SymmetricKey key4( QCA::hexToArray( QStringLiteral("0102030405060708090a0b0c0d0e0f10111213141516171819")) );
|
||||
QCA::MessageAuthenticationCode md5hmac4( QStringLiteral("hmac(md5)"), key4, provider );
|
||||
QCA::SecureArray data4( 50 );
|
||||
for (int i = 0; i < data4.size(); i++ )
|
||||
data4[ i ] = (char)0xcd;
|
||||
md5hmac4.update( data4 );
|
||||
QCOMPARE( QCA::arrayToHex( md5hmac4.final().toByteArray() ), QString( "697eaf0aca3a3aea3a75164746ffaa79" ) );
|
||||
QCOMPARE( QCA::arrayToHex( md5hmac4.final().toByteArray() ), QStringLiteral( "697eaf0aca3a3aea3a75164746ffaa79" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode md5hmac5( "hmac(md5)", QCA::SecureArray() );
|
||||
QCA::SymmetricKey key5( QCA::hexToArray( "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c" ) );
|
||||
QCA::MessageAuthenticationCode md5hmac5( QStringLiteral("hmac(md5)"), QCA::SecureArray() );
|
||||
QCA::SymmetricKey key5( QCA::hexToArray( QStringLiteral("0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c") ) );
|
||||
md5hmac5.setup( key5 );
|
||||
QCA::SecureArray data5( "Test With Truncation" );
|
||||
md5hmac5.update( data5 );
|
||||
QCOMPARE( QCA::arrayToHex( md5hmac5.final().toByteArray() ), QString( "56461ef2342edc00f9bab995690efd4c" ) );
|
||||
QCOMPARE( QCA::arrayToHex( md5hmac5.final().toByteArray() ), QStringLiteral( "56461ef2342edc00f9bab995690efd4c" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode md5hmac6( "hmac(md5)", QCA::SymmetricKey(), provider );
|
||||
QCA::MessageAuthenticationCode md5hmac6( QStringLiteral("hmac(md5)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key6( 80 );
|
||||
for (int i = 0; i < key6.size(); i++)
|
||||
key6[ i ] = (char)0xaa;
|
||||
md5hmac6.setup( key6 );
|
||||
QCA::SecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
|
||||
md5hmac6.update( data6 );
|
||||
QCOMPARE( QCA::arrayToHex( md5hmac6.final().toByteArray() ), QString( "6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd" ) );
|
||||
QCOMPARE( QCA::arrayToHex( md5hmac6.final().toByteArray() ), QStringLiteral( "6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd" ) );
|
||||
|
||||
md5hmac6.clear(); // reuse the same key
|
||||
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().toByteArray() ), QString( "6f630fad67cda0ee1fb1f562db3aa53e" ) );
|
||||
QCOMPARE( QCA::arrayToHex( md5hmac6.final().toByteArray() ), QStringLiteral( "6f630fad67cda0ee1fb1f562db3aa53e" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -142,16 +142,16 @@ void MACUnitTest::HMACMD5()
|
||||
void MACUnitTest::HMACSHA256()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append("qca-gcrypt");
|
||||
providersToTest.append("qca-botan");
|
||||
providersToTest.append("qca-nss");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
providersToTest.append(QStringLiteral("qca-gcrypt"));
|
||||
providersToTest.append(QStringLiteral("qca-botan"));
|
||||
providersToTest.append(QStringLiteral("qca-nss"));
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
if( !QCA::isSupported( "hmac(sha256)", provider ) )
|
||||
QWARN( QString( "HMAC(SHA256) not supported for "+provider).toLocal8Bit().constData() );
|
||||
QWARN( (QStringLiteral( "HMAC(SHA256) not supported for ")+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QCA::MessageAuthenticationCode hmacLenTest( "hmac(sha256)", QCA::SymmetricKey(), provider );
|
||||
QCA::MessageAuthenticationCode hmacLenTest( QStringLiteral("hmac(sha256)"), QCA::SymmetricKey(), provider );
|
||||
QCOMPARE( hmacLenTest.validKeyLength( 0 ), true );
|
||||
QCOMPARE( hmacLenTest.validKeyLength( 1 ), true );
|
||||
QCOMPARE( hmacLenTest.validKeyLength( 848888 ), true );
|
||||
@ -160,52 +160,52 @@ void MACUnitTest::HMACSHA256()
|
||||
QCA::MessageAuthenticationCode copy = hmacLenTest;
|
||||
copy.context(); // detach
|
||||
|
||||
QCA::MessageAuthenticationCode hmac1( "hmac(sha256)", QCA::SymmetricKey(), provider );
|
||||
QCA::MessageAuthenticationCode hmac1( QStringLiteral("hmac(sha256)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key1( QCA::SecureArray( "Jefe" ) );
|
||||
hmac1.setup( key1 );
|
||||
QCA::SecureArray data1( "what do ya want for nothing?" );
|
||||
hmac1.update( data1 );
|
||||
QCOMPARE( QCA::arrayToHex( hmac1.final().toByteArray() ),
|
||||
QString( "5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843" ) );
|
||||
QStringLiteral( "5bdcc146bf60754e6a042426089575c75a003f089d2739839dec58b964ec3843" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode hmac2( "hmac(sha256)", QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key2( QCA::hexToArray( "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b" ) );
|
||||
QCA::MessageAuthenticationCode hmac2( QStringLiteral("hmac(sha256)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key2( QCA::hexToArray( QStringLiteral("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b") ) );
|
||||
hmac2.setup( key2 );
|
||||
QCA::SecureArray data2 = QCA::SecureArray( "Hi There" );
|
||||
hmac2.update( data2 );
|
||||
QCOMPARE( QCA::arrayToHex( hmac2.final().toByteArray() ),
|
||||
QString( "b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7" ) );
|
||||
QStringLiteral( "b0344c61d8db38535ca8afceaf0bf12b881dc200c9833da726e9376c2e32cff7" ) );
|
||||
|
||||
// test reuse
|
||||
hmac2.clear();
|
||||
QCA::SymmetricKey key3( QCA::hexToArray( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ) );
|
||||
QCA::SymmetricKey key3( QCA::hexToArray( QStringLiteral("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") ) );
|
||||
hmac2.setup ( key3 );
|
||||
QCA::SecureArray data3( 50 );
|
||||
for ( int i = 0; i < data3.size(); i++ )
|
||||
data3[ i ] = (char)0xDD;
|
||||
hmac2.update( data3 );
|
||||
QCOMPARE( QCA::arrayToHex( hmac2.final().toByteArray() ),
|
||||
QString( "773ea91e36800e46854db8ebd09181a72959098b3ef8c122d9635514ced565fe" ) );
|
||||
QStringLiteral( "773ea91e36800e46854db8ebd09181a72959098b3ef8c122d9635514ced565fe" ) );
|
||||
|
||||
QCA::SymmetricKey key4( QCA::hexToArray( "0102030405060708090a0b0c0d0e0f10111213141516171819") );
|
||||
QCA::MessageAuthenticationCode hmac4( "hmac(sha256)", key4, provider );
|
||||
QCA::SymmetricKey key4( QCA::hexToArray( QStringLiteral("0102030405060708090a0b0c0d0e0f10111213141516171819")) );
|
||||
QCA::MessageAuthenticationCode hmac4( QStringLiteral("hmac(sha256)"), key4, provider );
|
||||
QCA::SecureArray data4( 50 );
|
||||
for (int i = 0; i < data4.size(); i++ )
|
||||
data4[ i ] = (char)0xcd;
|
||||
hmac4.update( data4 );
|
||||
QCOMPARE( QCA::arrayToHex( hmac4.final().toByteArray() ),
|
||||
QString( "82558a389a443c0ea4cc819899f2083a85f0faa3e578f8077a2e3ff46729665b" ) );
|
||||
QStringLiteral( "82558a389a443c0ea4cc819899f2083a85f0faa3e578f8077a2e3ff46729665b" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode hmac5( "hmac(sha256)", QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key5( QCA::hexToArray( "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c" ) );
|
||||
QCA::MessageAuthenticationCode hmac5( QStringLiteral("hmac(sha256)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key5( QCA::hexToArray( QStringLiteral("0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c") ) );
|
||||
hmac5.setup( key5 );
|
||||
QCA::SecureArray data5( "Test With Truncation" );
|
||||
hmac5.update( data5 );
|
||||
QString resultWithTrunc = QCA::arrayToHex( hmac5.final().toByteArray() );
|
||||
resultWithTrunc.resize(32);
|
||||
QCOMPARE( resultWithTrunc, QString( "a3b6167473100ee06e0c796c2955552b" ) );
|
||||
QCOMPARE( resultWithTrunc, QStringLiteral( "a3b6167473100ee06e0c796c2955552b" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode hmac6( "hmac(sha256)", QCA::SymmetricKey(), provider );
|
||||
QCA::MessageAuthenticationCode hmac6( QStringLiteral("hmac(sha256)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key6( 131 );
|
||||
for (int i = 0; i < key6.size(); i++)
|
||||
key6[ i ] = (char)0xaa;
|
||||
@ -213,13 +213,13 @@ void MACUnitTest::HMACSHA256()
|
||||
QCA::SecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
|
||||
hmac6.update( data6 );
|
||||
QCOMPARE( QCA::arrayToHex( hmac6.final().toByteArray() ),
|
||||
QString( "60e431591ee0b67f0d8a26aacbf5b77f8e0bc6213728c5140546040f0ee37f54" ) );
|
||||
QStringLiteral( "60e431591ee0b67f0d8a26aacbf5b77f8e0bc6213728c5140546040f0ee37f54" ) );
|
||||
|
||||
hmac6.clear(); // reuse the same key
|
||||
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().toByteArray() ),
|
||||
QString( "9b09ffa71b942fcb27635fbcd5b0e944bfdc63644f0713938a7f51535c3a35e2" ) );
|
||||
QStringLiteral( "9b09ffa71b942fcb27635fbcd5b0e944bfdc63644f0713938a7f51535c3a35e2" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -227,15 +227,15 @@ void MACUnitTest::HMACSHA256()
|
||||
void MACUnitTest::HMACSHA224()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append("qca-gcrypt");
|
||||
providersToTest.append("qca-botan");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
providersToTest.append(QStringLiteral("qca-gcrypt"));
|
||||
providersToTest.append(QStringLiteral("qca-botan"));
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
if( !QCA::isSupported( "hmac(sha224)", provider ) )
|
||||
QWARN( QString( "HMAC(SHA224) not supported for "+provider).toLocal8Bit().constData() );
|
||||
QWARN( (QStringLiteral( "HMAC(SHA224) not supported for ")+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QCA::MessageAuthenticationCode hmacLenTest( "hmac(sha224)", QCA::SymmetricKey(), provider );
|
||||
QCA::MessageAuthenticationCode hmacLenTest( QStringLiteral("hmac(sha224)"), QCA::SymmetricKey(), provider );
|
||||
QCOMPARE( hmacLenTest.validKeyLength( 0 ), true );
|
||||
QCOMPARE( hmacLenTest.validKeyLength( 1 ), true );
|
||||
QCOMPARE( hmacLenTest.validKeyLength( 848888 ), true );
|
||||
@ -244,52 +244,52 @@ void MACUnitTest::HMACSHA224()
|
||||
QCA::MessageAuthenticationCode copy = hmacLenTest;
|
||||
copy.context(); // detach
|
||||
|
||||
QCA::MessageAuthenticationCode hmac1( "hmac(sha224)", QCA::SymmetricKey(), provider );
|
||||
QCA::MessageAuthenticationCode hmac1( QStringLiteral("hmac(sha224)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key1( QCA::SecureArray( "Jefe" ) );
|
||||
hmac1.setup( key1 );
|
||||
QCA::SecureArray data1( "what do ya want for nothing?" );
|
||||
hmac1.update( data1 );
|
||||
QCOMPARE( QCA::arrayToHex( hmac1.final().toByteArray() ),
|
||||
QString( "a30e01098bc6dbbf45690f3a7e9e6d0f8bbea2a39e6148008fd05e44" ) );
|
||||
QStringLiteral( "a30e01098bc6dbbf45690f3a7e9e6d0f8bbea2a39e6148008fd05e44" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode hmac2( "hmac(sha224)", QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key2( QCA::hexToArray( "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b" ) );
|
||||
QCA::MessageAuthenticationCode hmac2( QStringLiteral("hmac(sha224)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key2( QCA::hexToArray( QStringLiteral("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b") ) );
|
||||
hmac2.setup( key2 );
|
||||
QCA::SecureArray data2 = QCA::SecureArray( "Hi There" );
|
||||
hmac2.update( data2 );
|
||||
QCOMPARE( QCA::arrayToHex( hmac2.final().toByteArray() ),
|
||||
QString( "896fb1128abbdf196832107cd49df33f47b4b1169912ba4f53684b22" ) );
|
||||
QStringLiteral( "896fb1128abbdf196832107cd49df33f47b4b1169912ba4f53684b22" ) );
|
||||
|
||||
// test reuse
|
||||
hmac2.clear();
|
||||
QCA::SymmetricKey key3( QCA::hexToArray( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ) );
|
||||
QCA::SymmetricKey key3( QCA::hexToArray( QStringLiteral("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") ) );
|
||||
hmac2.setup ( key3 );
|
||||
QCA::SecureArray data3( 50 );
|
||||
for ( int i = 0; i < data3.size(); i++ )
|
||||
data3[ i ] = (char)0xDD;
|
||||
hmac2.update( data3 );
|
||||
QCOMPARE( QCA::arrayToHex( hmac2.final().toByteArray() ),
|
||||
QString( "7fb3cb3588c6c1f6ffa9694d7d6ad2649365b0c1f65d69d1ec8333ea" ) );
|
||||
QStringLiteral( "7fb3cb3588c6c1f6ffa9694d7d6ad2649365b0c1f65d69d1ec8333ea" ) );
|
||||
|
||||
QCA::SymmetricKey key4( QCA::hexToArray( "0102030405060708090a0b0c0d0e0f10111213141516171819") );
|
||||
QCA::MessageAuthenticationCode hmac4( "hmac(sha224)", key4, provider );
|
||||
QCA::SymmetricKey key4( QCA::hexToArray( QStringLiteral("0102030405060708090a0b0c0d0e0f10111213141516171819")) );
|
||||
QCA::MessageAuthenticationCode hmac4( QStringLiteral("hmac(sha224)"), key4, provider );
|
||||
QCA::SecureArray data4( 50 );
|
||||
for (int i = 0; i < data4.size(); i++ )
|
||||
data4[ i ] = (char)0xcd;
|
||||
hmac4.update( data4 );
|
||||
QCOMPARE( QCA::arrayToHex( hmac4.final().toByteArray() ),
|
||||
QString( "6c11506874013cac6a2abc1bb382627cec6a90d86efc012de7afec5a" ) );
|
||||
QStringLiteral( "6c11506874013cac6a2abc1bb382627cec6a90d86efc012de7afec5a" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode hmac5( "hmac(sha224)", QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key5( QCA::hexToArray( "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c" ) );
|
||||
QCA::MessageAuthenticationCode hmac5( QStringLiteral("hmac(sha224)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key5( QCA::hexToArray( QStringLiteral("0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c") ) );
|
||||
hmac5.setup( key5 );
|
||||
QCA::SecureArray data5( "Test With Truncation" );
|
||||
hmac5.update( data5 );
|
||||
QString resultWithTrunc = QCA::arrayToHex( hmac5.final().toByteArray() );
|
||||
resultWithTrunc.resize(32);
|
||||
QCOMPARE( resultWithTrunc, QString( "0e2aea68a90c8d37c988bcdb9fca6fa8" ) );
|
||||
QCOMPARE( resultWithTrunc, QStringLiteral( "0e2aea68a90c8d37c988bcdb9fca6fa8" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode hmac6( "hmac(sha224)", QCA::SymmetricKey(), provider );
|
||||
QCA::MessageAuthenticationCode hmac6( QStringLiteral("hmac(sha224)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key6( 131 );
|
||||
for (int i = 0; i < key6.size(); i++)
|
||||
key6[ i ] = (char)0xaa;
|
||||
@ -297,13 +297,13 @@ void MACUnitTest::HMACSHA224()
|
||||
QCA::SecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
|
||||
hmac6.update( data6 );
|
||||
QCOMPARE( QCA::arrayToHex( hmac6.final().toByteArray() ),
|
||||
QString( "95e9a0db962095adaebe9b2d6f0dbce2d499f112f2d2b7273fa6870e" ) );
|
||||
QStringLiteral( "95e9a0db962095adaebe9b2d6f0dbce2d499f112f2d2b7273fa6870e" ) );
|
||||
|
||||
hmac6.clear(); // reuse the same key
|
||||
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().toByteArray() ),
|
||||
QString( "3a854166ac5d9f023f54d517d0b39dbd946770db9c2b95c9f6f565d1" ) );
|
||||
QStringLiteral( "3a854166ac5d9f023f54d517d0b39dbd946770db9c2b95c9f6f565d1" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -311,16 +311,16 @@ void MACUnitTest::HMACSHA224()
|
||||
void MACUnitTest::HMACSHA384()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append("qca-gcrypt");
|
||||
providersToTest.append("qca-botan");
|
||||
providersToTest.append("qca-nss");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
providersToTest.append(QStringLiteral("qca-gcrypt"));
|
||||
providersToTest.append(QStringLiteral("qca-botan"));
|
||||
providersToTest.append(QStringLiteral("qca-nss"));
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
if( !QCA::isSupported( "hmac(sha384)", provider ) )
|
||||
QWARN( QString( "HMAC(SHA384) not supported for "+provider).toLocal8Bit().constData() );
|
||||
QWARN( (QStringLiteral( "HMAC(SHA384) not supported for ")+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QCA::MessageAuthenticationCode hmacLenTest( "hmac(sha384)", QCA::SymmetricKey(), provider );
|
||||
QCA::MessageAuthenticationCode hmacLenTest( QStringLiteral("hmac(sha384)"), QCA::SymmetricKey(), provider );
|
||||
QCOMPARE( hmacLenTest.validKeyLength( 0 ), true );
|
||||
QCOMPARE( hmacLenTest.validKeyLength( 1 ), true );
|
||||
QCOMPARE( hmacLenTest.validKeyLength( 848888 ), true );
|
||||
@ -329,52 +329,52 @@ void MACUnitTest::HMACSHA384()
|
||||
QCA::MessageAuthenticationCode copy = hmacLenTest;
|
||||
copy.context(); // detach
|
||||
|
||||
QCA::MessageAuthenticationCode hmac1( "hmac(sha384)", QCA::SymmetricKey(), provider );
|
||||
QCA::MessageAuthenticationCode hmac1( QStringLiteral("hmac(sha384)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key1( QCA::SecureArray( "Jefe" ) );
|
||||
hmac1.setup( key1 );
|
||||
QCA::SecureArray data1( "what do ya want for nothing?" );
|
||||
hmac1.update( data1 );
|
||||
QCOMPARE( QCA::arrayToHex( hmac1.final().toByteArray() ),
|
||||
QString( "af45d2e376484031617f78d2b58a6b1b9c7ef464f5a01b47e42ec3736322445e8e2240ca5e69e2c78b3239ecfab21649" ) );
|
||||
QStringLiteral( "af45d2e376484031617f78d2b58a6b1b9c7ef464f5a01b47e42ec3736322445e8e2240ca5e69e2c78b3239ecfab21649" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode hmac2( "hmac(sha384)", QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key2( QCA::hexToArray( "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b" ) );
|
||||
QCA::MessageAuthenticationCode hmac2( QStringLiteral("hmac(sha384)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key2( QCA::hexToArray( QStringLiteral("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b") ) );
|
||||
hmac2.setup( key2 );
|
||||
QCA::SecureArray data2 = QCA::SecureArray( "Hi There" );
|
||||
hmac2.update( data2 );
|
||||
QCOMPARE( QCA::arrayToHex( hmac2.final().toByteArray() ),
|
||||
QString( "afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6" ) );
|
||||
QStringLiteral( "afd03944d84895626b0825f4ab46907f15f9dadbe4101ec682aa034c7cebc59cfaea9ea9076ede7f4af152e8b2fa9cb6" ) );
|
||||
|
||||
// test reuse
|
||||
hmac2.clear();
|
||||
QCA::SymmetricKey key3( QCA::hexToArray( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ) );
|
||||
QCA::SymmetricKey key3( QCA::hexToArray( QStringLiteral("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") ) );
|
||||
hmac2.setup ( key3 );
|
||||
QCA::SecureArray data3( 50 );
|
||||
for ( int i = 0; i < data3.size(); i++ )
|
||||
data3[ i ] = (char)0xDD;
|
||||
hmac2.update( data3 );
|
||||
QCOMPARE( QCA::arrayToHex( hmac2.final().toByteArray() ),
|
||||
QString( "88062608d3e6ad8a0aa2ace014c8a86f0aa635d947ac9febe83ef4e55966144b2a5ab39dc13814b94e3ab6e101a34f27" ) );
|
||||
QStringLiteral( "88062608d3e6ad8a0aa2ace014c8a86f0aa635d947ac9febe83ef4e55966144b2a5ab39dc13814b94e3ab6e101a34f27" ) );
|
||||
|
||||
QCA::SymmetricKey key4( QCA::hexToArray( "0102030405060708090a0b0c0d0e0f10111213141516171819") );
|
||||
QCA::MessageAuthenticationCode hmac4( "hmac(sha384)", key4, provider );
|
||||
QCA::SymmetricKey key4( QCA::hexToArray( QStringLiteral("0102030405060708090a0b0c0d0e0f10111213141516171819")) );
|
||||
QCA::MessageAuthenticationCode hmac4( QStringLiteral("hmac(sha384)"), key4, provider );
|
||||
QCA::SecureArray data4( 50 );
|
||||
for (int i = 0; i < data4.size(); i++ )
|
||||
data4[ i ] = (char)0xcd;
|
||||
hmac4.update( data4 );
|
||||
QCOMPARE( QCA::arrayToHex( hmac4.final().toByteArray() ),
|
||||
QString( "3e8a69b7783c25851933ab6290af6ca77a9981480850009cc5577c6e1f573b4e6801dd23c4a7d679ccf8a386c674cffb" ) );
|
||||
QStringLiteral( "3e8a69b7783c25851933ab6290af6ca77a9981480850009cc5577c6e1f573b4e6801dd23c4a7d679ccf8a386c674cffb" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode hmac5( "hmac(sha384)", QCA::SecureArray(), provider );
|
||||
QCA::SymmetricKey key5( QCA::hexToArray( "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c" ) );
|
||||
QCA::MessageAuthenticationCode hmac5( QStringLiteral("hmac(sha384)"), QCA::SecureArray(), provider );
|
||||
QCA::SymmetricKey key5( QCA::hexToArray( QStringLiteral("0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c") ) );
|
||||
hmac5.setup( key5 );
|
||||
QCA::SecureArray data5( "Test With Truncation" );
|
||||
hmac5.update( data5 );
|
||||
QString resultWithTrunc = QCA::arrayToHex( hmac5.final().toByteArray() );
|
||||
resultWithTrunc.resize(32);
|
||||
QCOMPARE( resultWithTrunc, QString( "3abf34c3503b2a23a46efc619baef897" ) );
|
||||
QCOMPARE( resultWithTrunc, QStringLiteral( "3abf34c3503b2a23a46efc619baef897" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode hmac6( "hmac(sha384)", QCA::SymmetricKey(), provider );
|
||||
QCA::MessageAuthenticationCode hmac6( QStringLiteral("hmac(sha384)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key6( 131 );
|
||||
for (int i = 0; i < key6.size(); i++)
|
||||
key6[ i ] = (char)0xaa;
|
||||
@ -382,13 +382,13 @@ void MACUnitTest::HMACSHA384()
|
||||
QCA::SecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
|
||||
hmac6.update( data6 );
|
||||
QCOMPARE( QCA::arrayToHex( hmac6.final().toByteArray() ),
|
||||
QString( "4ece084485813e9088d2c63a041bc5b44f9ef1012a2b588f3cd11f05033ac4c60c2ef6ab4030fe8296248df163f44952" ) );
|
||||
QStringLiteral( "4ece084485813e9088d2c63a041bc5b44f9ef1012a2b588f3cd11f05033ac4c60c2ef6ab4030fe8296248df163f44952" ) );
|
||||
|
||||
hmac6.clear(); // reuse the same key
|
||||
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().toByteArray() ),
|
||||
QString( "6617178e941f020d351e2f254e8fd32c602420feb0b8fb9adccebb82461e99c5a678cc31e799176d3860e6110c46523e" ) );
|
||||
QStringLiteral( "6617178e941f020d351e2f254e8fd32c602420feb0b8fb9adccebb82461e99c5a678cc31e799176d3860e6110c46523e" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -396,16 +396,16 @@ void MACUnitTest::HMACSHA384()
|
||||
void MACUnitTest::HMACSHA512()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append("qca-gcrypt");
|
||||
providersToTest.append("qca-botan");
|
||||
providersToTest.append("qca-nss");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
providersToTest.append(QStringLiteral("qca-gcrypt"));
|
||||
providersToTest.append(QStringLiteral("qca-botan"));
|
||||
providersToTest.append(QStringLiteral("qca-nss"));
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
if( !QCA::isSupported( "hmac(sha512)", provider ) )
|
||||
QWARN( QString( "HMAC(SHA512) not supported for "+provider).toLocal8Bit().constData() );
|
||||
QWARN( (QStringLiteral( "HMAC(SHA512) not supported for ")+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QCA::MessageAuthenticationCode hmacLenTest( "hmac(sha512)", QCA::SymmetricKey(), provider );
|
||||
QCA::MessageAuthenticationCode hmacLenTest( QStringLiteral("hmac(sha512)"), QCA::SymmetricKey(), provider );
|
||||
QCOMPARE( hmacLenTest.validKeyLength( 0 ), true );
|
||||
QCOMPARE( hmacLenTest.validKeyLength( 1 ), true );
|
||||
QCOMPARE( hmacLenTest.validKeyLength( 848888 ), true );
|
||||
@ -414,52 +414,52 @@ void MACUnitTest::HMACSHA512()
|
||||
QCA::MessageAuthenticationCode copy = hmacLenTest;
|
||||
copy.context(); // detach
|
||||
|
||||
QCA::MessageAuthenticationCode hmac1( "hmac(sha512)", QCA::SymmetricKey(), provider );
|
||||
QCA::MessageAuthenticationCode hmac1( QStringLiteral("hmac(sha512)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key1( QCA::SecureArray( "Jefe" ) );
|
||||
hmac1.setup( key1 );
|
||||
QCA::SecureArray data1( "what do ya want for nothing?" );
|
||||
hmac1.update( data1 );
|
||||
QCOMPARE( QCA::arrayToHex( hmac1.final().toByteArray() ),
|
||||
QString( "164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737" ) );
|
||||
QStringLiteral( "164b7a7bfcf819e2e395fbe73b56e0a387bd64222e831fd610270cd7ea2505549758bf75c05a994a6d034f65f8f0e6fdcaeab1a34d4a6b4b636e070a38bce737" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode hmac2( "hmac(sha512)", QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key2( QCA::hexToArray( "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b" ) );
|
||||
QCA::MessageAuthenticationCode hmac2( QStringLiteral("hmac(sha512)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key2( QCA::hexToArray( QStringLiteral("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b") ) );
|
||||
hmac2.setup( key2 );
|
||||
QCA::SecureArray data2 = QCA::SecureArray( "Hi There" );
|
||||
hmac2.update( data2 );
|
||||
QCOMPARE( QCA::arrayToHex( hmac2.final().toByteArray() ),
|
||||
QString( "87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b30545e17cdedaa833b7d6b8a702038b274eaea3f4e4be9d914eeb61f1702e696c203a126854" ) );
|
||||
QStringLiteral( "87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b30545e17cdedaa833b7d6b8a702038b274eaea3f4e4be9d914eeb61f1702e696c203a126854" ) );
|
||||
|
||||
// test reuse
|
||||
hmac2.clear();
|
||||
QCA::SymmetricKey key3( QCA::hexToArray( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ) );
|
||||
QCA::SymmetricKey key3( QCA::hexToArray( QStringLiteral("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") ) );
|
||||
hmac2.setup ( key3 );
|
||||
QCA::SecureArray data3( 50 );
|
||||
for ( int i = 0; i < data3.size(); i++ )
|
||||
data3[ i ] = (char)0xDD;
|
||||
hmac2.update( data3 );
|
||||
QCOMPARE( QCA::arrayToHex( hmac2.final().toByteArray() ),
|
||||
QString( "fa73b0089d56a284efb0f0756c890be9b1b5dbdd8ee81a3655f83e33b2279d39bf3e848279a722c806b485a47e67c807b946a337bee8942674278859e13292fb" ) );
|
||||
QStringLiteral( "fa73b0089d56a284efb0f0756c890be9b1b5dbdd8ee81a3655f83e33b2279d39bf3e848279a722c806b485a47e67c807b946a337bee8942674278859e13292fb" ) );
|
||||
|
||||
QCA::SymmetricKey key4( QCA::hexToArray( "0102030405060708090a0b0c0d0e0f10111213141516171819") );
|
||||
QCA::MessageAuthenticationCode hmac4( "hmac(sha512)", key4, provider );
|
||||
QCA::SymmetricKey key4( QCA::hexToArray( QStringLiteral("0102030405060708090a0b0c0d0e0f10111213141516171819")) );
|
||||
QCA::MessageAuthenticationCode hmac4( QStringLiteral("hmac(sha512)"), key4, provider );
|
||||
QCA::SecureArray data4( 50 );
|
||||
for (int i = 0; i < data4.size(); i++ )
|
||||
data4[ i ] = (char)0xcd;
|
||||
hmac4.update( data4 );
|
||||
QCOMPARE( QCA::arrayToHex( hmac4.final().toByteArray() ),
|
||||
QString( "b0ba465637458c6990e5a8c5f61d4af7e576d97ff94b872de76f8050361ee3dba91ca5c11aa25eb4d679275cc5788063a5f19741120c4f2de2adebeb10a298dd" ) );
|
||||
QStringLiteral( "b0ba465637458c6990e5a8c5f61d4af7e576d97ff94b872de76f8050361ee3dba91ca5c11aa25eb4d679275cc5788063a5f19741120c4f2de2adebeb10a298dd" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode hmac5( "hmac(sha512)", QCA::SecureArray(), provider );
|
||||
QCA::SymmetricKey key5( QCA::hexToArray( "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c" ) );
|
||||
QCA::MessageAuthenticationCode hmac5( QStringLiteral("hmac(sha512)"), QCA::SecureArray(), provider );
|
||||
QCA::SymmetricKey key5( QCA::hexToArray( QStringLiteral("0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c") ) );
|
||||
hmac5.setup( key5 );
|
||||
QCA::SecureArray data5( "Test With Truncation" );
|
||||
hmac5.update( data5 );
|
||||
QString resultWithTrunc = QCA::arrayToHex( hmac5.final().toByteArray() );
|
||||
resultWithTrunc.resize(32);
|
||||
QCOMPARE( resultWithTrunc, QString( "415fad6271580a531d4179bc891d87a6" ) );
|
||||
QCOMPARE( resultWithTrunc, QStringLiteral( "415fad6271580a531d4179bc891d87a6" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode hmac6( "hmac(sha512)", QCA::SymmetricKey(), provider );
|
||||
QCA::MessageAuthenticationCode hmac6( QStringLiteral("hmac(sha512)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key6( 131 );
|
||||
for (int i = 0; i < key6.size(); i++)
|
||||
key6[ i ] = (char)0xaa;
|
||||
@ -467,13 +467,13 @@ void MACUnitTest::HMACSHA512()
|
||||
QCA::SecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
|
||||
hmac6.update( data6 );
|
||||
QCOMPARE( QCA::arrayToHex( hmac6.final().toByteArray() ),
|
||||
QString( "80b24263c7c1a3ebb71493c1dd7be8b49b46d1f41b4aeec1121b013783f8f3526b56d037e05f2598bd0fd2215d6a1e5295e64f73f63f0aec8b915a985d786598" ) );
|
||||
QStringLiteral( "80b24263c7c1a3ebb71493c1dd7be8b49b46d1f41b4aeec1121b013783f8f3526b56d037e05f2598bd0fd2215d6a1e5295e64f73f63f0aec8b915a985d786598" ) );
|
||||
|
||||
hmac6.clear(); // reuse the same key
|
||||
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().toByteArray() ),
|
||||
QString( "e37b6a775dc87dbaa4dfa9f96e5e3ffddebd71f8867289865df5a32d20cdc944b6022cac3c4982b10d5eeb55c3e4de15134676fb6de0446065c97440fa8c6a58" ) );
|
||||
QStringLiteral( "e37b6a775dc87dbaa4dfa9f96e5e3ffddebd71f8867289865df5a32d20cdc944b6022cac3c4982b10d5eeb55c3e4de15134676fb6de0446065c97440fa8c6a58" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -481,16 +481,16 @@ void MACUnitTest::HMACSHA512()
|
||||
void MACUnitTest::HMACSHA1()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append("qca-gcrypt");
|
||||
providersToTest.append("qca-botan");
|
||||
providersToTest.append("qca-nss");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
providersToTest.append(QStringLiteral("qca-gcrypt"));
|
||||
providersToTest.append(QStringLiteral("qca-botan"));
|
||||
providersToTest.append(QStringLiteral("qca-nss"));
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
if( !QCA::isSupported( "hmac(sha1)", provider ) )
|
||||
QWARN( QString( "HMAC(SHA1) not supported for "+provider).toLocal8Bit().constData() );
|
||||
QWARN( (QStringLiteral( "HMAC(SHA1) not supported for ")+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QCA::MessageAuthenticationCode sha1hmacLenTest( "hmac(sha1)", QCA::SymmetricKey(), provider );
|
||||
QCA::MessageAuthenticationCode sha1hmacLenTest( QStringLiteral("hmac(sha1)"), QCA::SymmetricKey(), provider );
|
||||
QCOMPARE( sha1hmacLenTest.validKeyLength( 0 ), true );
|
||||
QCOMPARE( sha1hmacLenTest.validKeyLength( 1 ), true );
|
||||
QCOMPARE( sha1hmacLenTest.validKeyLength( 848888 ), true );
|
||||
@ -500,58 +500,58 @@ void MACUnitTest::HMACSHA1()
|
||||
copy.context(); // detach
|
||||
|
||||
// These tests are from RFC2202, Section 3.
|
||||
QCA::MessageAuthenticationCode test1( "hmac(sha1)", QCA::SecureArray() );
|
||||
QCA::SymmetricKey key1( QCA::hexToArray( "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b" ) );
|
||||
QCA::MessageAuthenticationCode test1( QStringLiteral("hmac(sha1)"), QCA::SecureArray() );
|
||||
QCA::SymmetricKey key1( QCA::hexToArray( QStringLiteral("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b") ) );
|
||||
test1.setup( key1 );
|
||||
QCA::SecureArray data1( "Hi There" );
|
||||
test1.update( data1 );
|
||||
QCOMPARE( QCA::arrayToHex( test1.final().toByteArray() ), QString( "b617318655057264e28bc0b6fb378c8ef146be00" ) );
|
||||
QCOMPARE( QCA::arrayToHex( test1.final().toByteArray() ), QStringLiteral( "b617318655057264e28bc0b6fb378c8ef146be00" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode test2( "hmac(sha1)", QCA::SymmetricKey(), provider);
|
||||
QCA::MessageAuthenticationCode test2( QStringLiteral("hmac(sha1)"), QCA::SymmetricKey(), provider);
|
||||
QCA::SymmetricKey key2( QCA::SecureArray( "Jefe" ) );
|
||||
test2.setup( key2 );
|
||||
QCA::SecureArray data2( "what do ya want for nothing?" );
|
||||
test2.update( data2 );
|
||||
QCOMPARE( QCA::arrayToHex( test2.final().toByteArray() ), QString( "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79" ) );
|
||||
QCOMPARE( QCA::arrayToHex( test2.final().toByteArray() ), QStringLiteral( "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode test3( "hmac(sha1)", QCA::SymmetricKey(), provider);
|
||||
QCA::SymmetricKey key3( QCA::hexToArray( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ) );
|
||||
QCA::MessageAuthenticationCode test3( QStringLiteral("hmac(sha1)"), QCA::SymmetricKey(), provider);
|
||||
QCA::SymmetricKey key3( QCA::hexToArray( QStringLiteral("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") ) );
|
||||
test3.setup( key3 );
|
||||
QCA::SecureArray data3( 50 );
|
||||
for ( int i = 0; i < data3.size(); i++ )
|
||||
data3[ i ] = (char)0xDD;
|
||||
test3.update( data3 );
|
||||
QCOMPARE( QCA::arrayToHex( test3.final().toByteArray() ), QString( "125d7342b9ac11cd91a39af48aa17b4f63f175d3" ) );
|
||||
QCOMPARE( QCA::arrayToHex( test3.final().toByteArray() ), QStringLiteral( "125d7342b9ac11cd91a39af48aa17b4f63f175d3" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode test4( "hmac(sha1)", QCA::SymmetricKey(), provider);
|
||||
QCA::SymmetricKey key4( QCA::hexToArray( "0102030405060708090a0b0c0d0e0f10111213141516171819" ) );
|
||||
QCA::MessageAuthenticationCode test4( QStringLiteral("hmac(sha1)"), QCA::SymmetricKey(), provider);
|
||||
QCA::SymmetricKey key4( QCA::hexToArray( QStringLiteral("0102030405060708090a0b0c0d0e0f10111213141516171819") ) );
|
||||
test4.setup( key4 );
|
||||
QCA::SecureArray data4( 50 );
|
||||
for ( int i = 0; i < data4.size(); i++ )
|
||||
data4[ i ] = (char)0xcd;
|
||||
test4.update( data4 );
|
||||
QCOMPARE( QCA::arrayToHex( test4.final().toByteArray() ), QString( "4c9007f4026250c6bc8414f9bf50c86c2d7235da" ) );
|
||||
QCOMPARE( QCA::arrayToHex( test4.final().toByteArray() ), QStringLiteral( "4c9007f4026250c6bc8414f9bf50c86c2d7235da" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode test5( "hmac(sha1)", QCA::SymmetricKey(), provider);
|
||||
QCA::SymmetricKey key5 ( QCA::hexToArray( "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c" ) );
|
||||
QCA::MessageAuthenticationCode test5( QStringLiteral("hmac(sha1)"), QCA::SymmetricKey(), provider);
|
||||
QCA::SymmetricKey key5 ( QCA::hexToArray( QStringLiteral("0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c") ) );
|
||||
test5.setup( key5 );
|
||||
QCA::SecureArray data5( "Test With Truncation" );
|
||||
test5.update( data5 );
|
||||
QCOMPARE( QCA::arrayToHex( test5.final().toByteArray() ), QString( "4c1a03424b55e07fe7f27be1d58bb9324a9a5a04" ) );
|
||||
QCOMPARE( QCA::arrayToHex( test5.final().toByteArray() ), QStringLiteral( "4c1a03424b55e07fe7f27be1d58bb9324a9a5a04" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode test6( "hmac(sha1)", QCA::SymmetricKey(), provider);
|
||||
QCA::MessageAuthenticationCode test6( QStringLiteral("hmac(sha1)"), QCA::SymmetricKey(), provider);
|
||||
QCA::SymmetricKey key6( 80 );
|
||||
for ( int i = 0; i < key6.size(); i++ )
|
||||
key6[i] = (char)0xAA;
|
||||
test6.setup( key6 );
|
||||
QCA::SecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
|
||||
test6.update( data6 );
|
||||
QCOMPARE( QCA::arrayToHex( test6.final().toByteArray() ), QString( "aa4ae5e15272d00e95705637ce8a3b55ed402112" ) );
|
||||
QCOMPARE( QCA::arrayToHex( test6.final().toByteArray() ), QStringLiteral( "aa4ae5e15272d00e95705637ce8a3b55ed402112" ) );
|
||||
|
||||
test6.clear(); // this should reuse the same key
|
||||
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().toByteArray() ), QString( "e8e99d0f45237d786d6bbaa7965c7808bbff1a91" ) );
|
||||
QCOMPARE( QCA::arrayToHex( test6.final().toByteArray() ), QStringLiteral( "e8e99d0f45237d786d6bbaa7965c7808bbff1a91" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -559,16 +559,16 @@ void MACUnitTest::HMACSHA1()
|
||||
void MACUnitTest::HMACRMD160()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append("qca-gcrypt");
|
||||
providersToTest.append("qca-botan");
|
||||
providersToTest.append("qca-nss");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
providersToTest.append(QStringLiteral("qca-gcrypt"));
|
||||
providersToTest.append(QStringLiteral("qca-botan"));
|
||||
providersToTest.append(QStringLiteral("qca-nss"));
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
if( !QCA::isSupported( "hmac(ripemd160)", provider ) )
|
||||
QWARN( QString( "HMAC(RIPEMD160) not supported for "+provider).toLocal8Bit().constData() );
|
||||
QWARN( (QStringLiteral( "HMAC(RIPEMD160) not supported for ")+provider).toLocal8Bit().constData() );
|
||||
else {
|
||||
QCA::MessageAuthenticationCode ripemd160hmacLenTest( "hmac(ripemd160)", QCA::SymmetricKey(), provider );
|
||||
QCA::MessageAuthenticationCode ripemd160hmacLenTest( QStringLiteral("hmac(ripemd160)"), QCA::SymmetricKey(), provider );
|
||||
QCOMPARE( ripemd160hmacLenTest.validKeyLength( 0 ), true );
|
||||
QCOMPARE( ripemd160hmacLenTest.validKeyLength( 1 ), true );
|
||||
QCOMPARE( ripemd160hmacLenTest.validKeyLength( 848888 ), true );
|
||||
@ -578,57 +578,57 @@ void MACUnitTest::HMACRMD160()
|
||||
copy.context(); // detach
|
||||
|
||||
// These tests are from RFC2286, Section 2.
|
||||
QCA::MessageAuthenticationCode test1( "hmac(ripemd160)", QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key1 ( QCA::hexToArray( "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b" ) );
|
||||
QCA::MessageAuthenticationCode test1( QStringLiteral("hmac(ripemd160)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key1 ( QCA::hexToArray( QStringLiteral("0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b") ) );
|
||||
test1.setup( key1 );
|
||||
QCA::SecureArray data1( "Hi There" );
|
||||
test1.update( data1 );
|
||||
QCOMPARE( QCA::arrayToHex( test1.final().toByteArray() ), QString( "24cb4bd67d20fc1a5d2ed7732dcc39377f0a5668" ) );
|
||||
QCOMPARE( QCA::arrayToHex( test1.final().toByteArray() ), QStringLiteral( "24cb4bd67d20fc1a5d2ed7732dcc39377f0a5668" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode test2( "hmac(ripemd160)", QCA::SymmetricKey(), provider );
|
||||
QCA::MessageAuthenticationCode test2( QStringLiteral("hmac(ripemd160)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key2( QCA::SecureArray( "Jefe" ) );
|
||||
test2.setup( key2 );
|
||||
QCA::SecureArray data2( "what do ya want for nothing?" );
|
||||
test2.update( data2 );
|
||||
QCOMPARE( QCA::arrayToHex( test2.final().toByteArray() ), QString( "dda6c0213a485a9e24f4742064a7f033b43c4069" ) );
|
||||
QCOMPARE( QCA::arrayToHex( test2.final().toByteArray() ), QStringLiteral( "dda6c0213a485a9e24f4742064a7f033b43c4069" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode test3( "hmac(ripemd160)", QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key3( QCA::hexToArray( "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ) );
|
||||
QCA::MessageAuthenticationCode test3( QStringLiteral("hmac(ripemd160)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key3( QCA::hexToArray( QStringLiteral("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") ) );
|
||||
test3.setup( key3 );
|
||||
QCA::SecureArray data3( 50 );
|
||||
for ( int i = 0; i < data3.size(); i++ )
|
||||
data3[ i ] = (char)0xDD;
|
||||
test3.update( data3 );
|
||||
QCOMPARE( QCA::arrayToHex( test3.final().toByteArray() ), QString( "b0b105360de759960ab4f35298e116e295d8e7c1" ) );
|
||||
QCOMPARE( QCA::arrayToHex( test3.final().toByteArray() ), QStringLiteral( "b0b105360de759960ab4f35298e116e295d8e7c1" ) );
|
||||
|
||||
QCA::SymmetricKey key4( QCA::hexToArray( "0102030405060708090a0b0c0d0e0f10111213141516171819" ) );
|
||||
QCA::MessageAuthenticationCode test4( "hmac(ripemd160)", key4, provider );
|
||||
QCA::SymmetricKey key4( QCA::hexToArray( QStringLiteral("0102030405060708090a0b0c0d0e0f10111213141516171819") ) );
|
||||
QCA::MessageAuthenticationCode test4( QStringLiteral("hmac(ripemd160)"), key4, provider );
|
||||
QCA::SecureArray data4( 50 );
|
||||
for ( int i = 0; i < data4.size(); i++ )
|
||||
data4[ i ] = (char)0xcd;
|
||||
test4.update( data4 );
|
||||
QCOMPARE( QCA::arrayToHex( test4.final().toByteArray() ), QString( "d5ca862f4d21d5e610e18b4cf1beb97a4365ecf4" ) );
|
||||
QCOMPARE( QCA::arrayToHex( test4.final().toByteArray() ), QStringLiteral( "d5ca862f4d21d5e610e18b4cf1beb97a4365ecf4" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode test5( "hmac(ripemd160)", QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key5 ( QCA::hexToArray( "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c" ) );
|
||||
QCA::MessageAuthenticationCode test5( QStringLiteral("hmac(ripemd160)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key5 ( QCA::hexToArray( QStringLiteral("0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c") ) );
|
||||
test5.setup( key5 );
|
||||
QCA::SecureArray data5( "Test With Truncation" );
|
||||
test5.update( data5 );
|
||||
QCOMPARE( QCA::arrayToHex( test5.final().toByteArray() ), QString( "7619693978f91d90539ae786500ff3d8e0518e39" ) );
|
||||
QCOMPARE( QCA::arrayToHex( test5.final().toByteArray() ), QStringLiteral( "7619693978f91d90539ae786500ff3d8e0518e39" ) );
|
||||
|
||||
QCA::MessageAuthenticationCode test6( "hmac(ripemd160)", QCA::SymmetricKey(), provider );
|
||||
QCA::MessageAuthenticationCode test6( QStringLiteral("hmac(ripemd160)"), QCA::SymmetricKey(), provider );
|
||||
QCA::SymmetricKey key6( 80 );
|
||||
for ( int i = 0; i < key6.size(); i++ )
|
||||
key6[i] = (char)0xAA;
|
||||
test6.setup( key6 );
|
||||
QCA::SecureArray data6( "Test Using Larger Than Block-Size Key - Hash Key First" );
|
||||
test6.update( data6 );
|
||||
QCOMPARE( QCA::arrayToHex( test6.final().toByteArray() ), QString( "6466ca07ac5eac29e1bd523e5ada7605b791fd8b" ) );
|
||||
QCOMPARE( QCA::arrayToHex( test6.final().toByteArray() ), QStringLiteral( "6466ca07ac5eac29e1bd523e5ada7605b791fd8b" ) );
|
||||
|
||||
test6.clear(); // reuse the key
|
||||
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().toByteArray() ), QString( "69ea60798d71616cce5fd0871e23754cd75d5a0a" ) );
|
||||
QCOMPARE( QCA::arrayToHex( test6.final().toByteArray() ), QStringLiteral( "69ea60798d71616cce5fd0871e23754cd75d5a0a" ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ void MetaTypeUnitTest::invokeMethodTest()
|
||||
|
||||
result = QString();
|
||||
args.clear();
|
||||
QString myString( "test words" );
|
||||
QString myString = QStringLiteral( "test words" );
|
||||
args << myString;
|
||||
ret = QCA::invokeMethodWithVariants( testClass1, QByteArray( "returnArg" ), args, &result );
|
||||
QVERIFY( ret );
|
||||
@ -162,11 +162,11 @@ void MetaTypeUnitTest::invokeMethodTest()
|
||||
QCOMPARE( result.toString(), QString( myString + myString ) );
|
||||
|
||||
// 9 arguments - no matching method
|
||||
result = QString( "unchanged" );
|
||||
result = QStringLiteral( "unchanged" );
|
||||
args << 0 << 0 << 0 << 0 << 0 << 0 << 0 << 0;
|
||||
ret = QCA::invokeMethodWithVariants( testClass1, QByteArray( "tenArgs" ), args, &result );
|
||||
QVERIFY( ret == false );
|
||||
QCOMPARE( result.toString(), QString( "unchanged" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "unchanged" ) );
|
||||
|
||||
// 10 args
|
||||
args << 0;
|
||||
@ -175,11 +175,11 @@ void MetaTypeUnitTest::invokeMethodTest()
|
||||
QCOMPARE( result.toString(), myString );
|
||||
|
||||
// 11 args
|
||||
result = QString( "unchanged" );
|
||||
result = QStringLiteral( "unchanged" );
|
||||
args << 0;
|
||||
ret = QCA::invokeMethodWithVariants( testClass1, QByteArray( "elevenArgs" ), args, &result );
|
||||
QVERIFY( ret == false );
|
||||
QCOMPARE( result.toString(), QString( "unchanged" ) );
|
||||
QCOMPARE( result.toString(), QStringLiteral( "unchanged" ) );
|
||||
|
||||
delete testClass1;
|
||||
}
|
||||
|
@ -164,19 +164,19 @@ void PgpUnitTest::testKeyRing()
|
||||
// activate the KeyStoreManager
|
||||
QCA::KeyStoreManager::start();
|
||||
|
||||
if ( QCA::isSupported( QStringList( QString( "keystorelist" ) ),
|
||||
QString( "qca-gnupg" ) ) )
|
||||
if ( QCA::isSupported( QStringList( QStringLiteral( "keystorelist" ) ),
|
||||
QStringLiteral( "qca-gnupg" ) ) )
|
||||
{
|
||||
QCA::KeyStoreManager keyManager(this);
|
||||
keyManager.waitForBusyFinished();
|
||||
QStringList storeIds = keyManager.keyStores();
|
||||
QVERIFY( storeIds.contains( "qca-gnupg" ) );
|
||||
QVERIFY( storeIds.contains( QStringLiteral("qca-gnupg") ) );
|
||||
|
||||
QCA::KeyStore pgpStore( QString("qca-gnupg"), &keyManager );
|
||||
QCA::KeyStore pgpStore( QStringLiteral("qca-gnupg"), &keyManager );
|
||||
QVERIFY( pgpStore.isValid() );
|
||||
QCOMPARE( pgpStore.name(), QString( "GnuPG Keyring" ) );
|
||||
QCOMPARE( pgpStore.name(), QStringLiteral( "GnuPG Keyring" ) );
|
||||
QCOMPARE( pgpStore.type(), QCA::KeyStore::PGPKeyring );
|
||||
QCOMPARE( pgpStore.id(), QString( "qca-gnupg" ) );
|
||||
QCOMPARE( pgpStore.id(), QStringLiteral( "qca-gnupg" ) );
|
||||
QCOMPARE( pgpStore.isReadOnly(), false );
|
||||
QCOMPARE( pgpStore.holdsTrustedCertificates(), false );
|
||||
QCOMPARE( pgpStore.holdsIdentities(), true );
|
||||
@ -198,12 +198,12 @@ void PgpUnitTest::testKeyRing()
|
||||
// We accumulate the names, and check them next
|
||||
nameList << key.name();
|
||||
}
|
||||
QVERIFY( nameList.contains( "Steven Bakker <steven.bakker@ams-ix.net>" ) );
|
||||
QVERIFY( nameList.contains( "Romeo Zwart <rz@ams-ix.net>" ) );
|
||||
QVERIFY( nameList.contains( "Arien Vijn <arien.vijn@ams-ix.net>" ) );
|
||||
QVERIFY( nameList.contains( "Niels Bakker <niels.bakker@ams-ix.net>" ) );
|
||||
QVERIFY( nameList.contains( "Henk Steenman <Henk.Steenman@ams-ix.net>" ) );
|
||||
QVERIFY( nameList.contains( "Geert Nijpels <geert.nijpels@ams-ix.net>" ) );
|
||||
QVERIFY( nameList.contains( QStringLiteral("Steven Bakker <steven.bakker@ams-ix.net>") ) );
|
||||
QVERIFY( nameList.contains( QStringLiteral("Romeo Zwart <rz@ams-ix.net>") ) );
|
||||
QVERIFY( nameList.contains( QStringLiteral("Arien Vijn <arien.vijn@ams-ix.net>") ) );
|
||||
QVERIFY( nameList.contains( QStringLiteral("Niels Bakker <niels.bakker@ams-ix.net>") ) );
|
||||
QVERIFY( nameList.contains( QStringLiteral("Henk Steenman <Henk.Steenman@ams-ix.net>") ) );
|
||||
QVERIFY( nameList.contains( QStringLiteral("Geert Nijpels <geert.nijpels@ams-ix.net>") ) );
|
||||
|
||||
// TODO: We should test removeEntry() and writeEntry() here.
|
||||
}
|
||||
@ -219,15 +219,15 @@ void PgpUnitTest::testKeyRing()
|
||||
|
||||
QCA::KeyStoreManager::start();
|
||||
|
||||
if ( QCA::isSupported( QStringList( QString( "keystorelist" ) ),
|
||||
QString( "qca-gnupg" ) ) )
|
||||
if ( QCA::isSupported( QStringList( QStringLiteral( "keystorelist" ) ),
|
||||
QStringLiteral( "qca-gnupg" ) ) )
|
||||
{
|
||||
QCA::KeyStoreManager keyManager(this);
|
||||
keyManager.waitForBusyFinished();
|
||||
QStringList storeIds = keyManager.keyStores();
|
||||
QVERIFY( storeIds.contains( "qca-gnupg" ) );
|
||||
QVERIFY( storeIds.contains( QStringLiteral("qca-gnupg") ) );
|
||||
|
||||
QCA::KeyStore pgpStore( QString("qca-gnupg"), &keyManager );
|
||||
QCA::KeyStore pgpStore( QStringLiteral("qca-gnupg"), &keyManager );
|
||||
|
||||
QList<QCA::KeyStoreEntry> keylist = pgpStore.entryList();
|
||||
QCOMPARE( keylist.count(), 0 );
|
||||
@ -264,13 +264,13 @@ void PgpUnitTest::testMessageSign()
|
||||
QCA::KeyStoreManager keyManager(this);
|
||||
keyManager.waitForBusyFinished();
|
||||
|
||||
if ( QCA::isSupported( QStringList( QString( "openpgp" ) ), QString( "qca-gnupg" ) ) ||
|
||||
QCA::isSupported( QStringList( QString( "keystorelist" ) ), QString( "qca-gnupg" ) ) ) {
|
||||
if ( QCA::isSupported( QStringList( QStringLiteral( "openpgp" ) ), QStringLiteral( "qca-gnupg" ) ) ||
|
||||
QCA::isSupported( QStringList( QStringLiteral( "keystorelist" ) ), QStringLiteral( "qca-gnupg" ) ) ) {
|
||||
|
||||
QStringList storeIds = keyManager.keyStores();
|
||||
QVERIFY( storeIds.contains( "qca-gnupg" ) );
|
||||
QVERIFY( storeIds.contains( QStringLiteral("qca-gnupg") ) );
|
||||
|
||||
QCA::KeyStore pgpStore( QString("qca-gnupg"), &keyManager );
|
||||
QCA::KeyStore pgpStore( QStringLiteral("qca-gnupg"), &keyManager );
|
||||
QVERIFY( pgpStore.isValid() );
|
||||
|
||||
QList<QCA::KeyStoreEntry> keylist = pgpStore.entryList();
|
||||
@ -278,9 +278,9 @@ void PgpUnitTest::testMessageSign()
|
||||
|
||||
const QCA::KeyStoreEntry &myPGPKey = keylist.at(0);
|
||||
QCOMPARE( myPGPKey.isNull(), false );
|
||||
QCOMPARE( myPGPKey.name(), QString("Qca Test Key (This key is only for QCA unit tests) <qca@example.com>") );
|
||||
QCOMPARE( myPGPKey.name(), QStringLiteral("Qca Test Key (This key is only for QCA unit tests) <qca@example.com>") );
|
||||
QCOMPARE( myPGPKey.type(), QCA::KeyStoreEntry::TypePGPSecretKey );
|
||||
QCOMPARE( myPGPKey.id(), QString("9E946237DAFCCFF4") );
|
||||
QCOMPARE( myPGPKey.id(), QStringLiteral("9E946237DAFCCFF4") );
|
||||
QVERIFY( myPGPKey.keyBundle().isNull() );
|
||||
QVERIFY( myPGPKey.certificate().isNull() );
|
||||
QVERIFY( myPGPKey.crl().isNull() );
|
||||
@ -394,13 +394,13 @@ void PgpUnitTest::testClearsign()
|
||||
QCA::KeyStoreManager keyManager(this);
|
||||
keyManager.waitForBusyFinished();
|
||||
|
||||
if ( QCA::isSupported( QStringList( QString( "openpgp" ) ), QString( "qca-gnupg" ) ) ||
|
||||
QCA::isSupported( QStringList( QString( "keystorelist" ) ), QString( "qca-gnupg" ) ) ) {
|
||||
if ( QCA::isSupported( QStringList( QStringLiteral( "openpgp" ) ), QStringLiteral( "qca-gnupg" ) ) ||
|
||||
QCA::isSupported( QStringList( QStringLiteral( "keystorelist" ) ), QStringLiteral( "qca-gnupg" ) ) ) {
|
||||
|
||||
QStringList storeIds = keyManager.keyStores();
|
||||
QVERIFY( storeIds.contains( "qca-gnupg" ) );
|
||||
QVERIFY( storeIds.contains( QStringLiteral("qca-gnupg") ) );
|
||||
|
||||
QCA::KeyStore pgpStore( QString("qca-gnupg"), &keyManager );
|
||||
QCA::KeyStore pgpStore( QStringLiteral("qca-gnupg"), &keyManager );
|
||||
QVERIFY( pgpStore.isValid() );
|
||||
|
||||
QList<QCA::KeyStoreEntry> keylist = pgpStore.entryList();
|
||||
@ -408,9 +408,9 @@ void PgpUnitTest::testClearsign()
|
||||
|
||||
const QCA::KeyStoreEntry &myPGPKey = keylist.at(0);
|
||||
QCOMPARE( myPGPKey.isNull(), false );
|
||||
QCOMPARE( myPGPKey.name(), QString("Qca Test Key (This key is only for QCA unit tests) <qca@example.com>") );
|
||||
QCOMPARE( myPGPKey.name(), QStringLiteral("Qca Test Key (This key is only for QCA unit tests) <qca@example.com>") );
|
||||
QCOMPARE( myPGPKey.type(), QCA::KeyStoreEntry::TypePGPSecretKey );
|
||||
QCOMPARE( myPGPKey.id(), QString("9E946237DAFCCFF4") );
|
||||
QCOMPARE( myPGPKey.id(), QStringLiteral("9E946237DAFCCFF4") );
|
||||
QVERIFY( myPGPKey.keyBundle().isNull() );
|
||||
QVERIFY( myPGPKey.certificate().isNull() );
|
||||
QVERIFY( myPGPKey.crl().isNull() );
|
||||
@ -506,13 +506,13 @@ void PgpUnitTest::testDetachedSign()
|
||||
QCA::KeyStoreManager keyManager(this);
|
||||
keyManager.waitForBusyFinished();
|
||||
|
||||
if ( QCA::isSupported( QStringList( QString( "openpgp" ) ), QString( "qca-gnupg" ) ) ||
|
||||
QCA::isSupported( QStringList( QString( "keystorelist" ) ), QString( "qca-gnupg" ) ) ) {
|
||||
if ( QCA::isSupported( QStringList( QStringLiteral( "openpgp" ) ), QStringLiteral( "qca-gnupg" ) ) ||
|
||||
QCA::isSupported( QStringList( QStringLiteral( "keystorelist" ) ), QStringLiteral( "qca-gnupg" ) ) ) {
|
||||
|
||||
QStringList storeIds = keyManager.keyStores();
|
||||
QVERIFY( storeIds.contains( "qca-gnupg" ) );
|
||||
QVERIFY( storeIds.contains( QStringLiteral("qca-gnupg") ) );
|
||||
|
||||
QCA::KeyStore pgpStore( QString("qca-gnupg"), &keyManager );
|
||||
QCA::KeyStore pgpStore( QStringLiteral("qca-gnupg"), &keyManager );
|
||||
QVERIFY( pgpStore.isValid() );
|
||||
|
||||
QList<QCA::KeyStoreEntry> keylist = pgpStore.entryList();
|
||||
@ -520,9 +520,9 @@ void PgpUnitTest::testDetachedSign()
|
||||
|
||||
const QCA::KeyStoreEntry &myPGPKey = keylist.at(0);
|
||||
QCOMPARE( myPGPKey.isNull(), false );
|
||||
QCOMPARE( myPGPKey.name(), QString("Qca Test Key (This key is only for QCA unit tests) <qca@example.com>") );
|
||||
QCOMPARE( myPGPKey.name(), QStringLiteral("Qca Test Key (This key is only for QCA unit tests) <qca@example.com>") );
|
||||
QCOMPARE( myPGPKey.type(), QCA::KeyStoreEntry::TypePGPSecretKey );
|
||||
QCOMPARE( myPGPKey.id(), QString("9E946237DAFCCFF4") );
|
||||
QCOMPARE( myPGPKey.id(), QStringLiteral("9E946237DAFCCFF4") );
|
||||
QVERIFY( myPGPKey.keyBundle().isNull() );
|
||||
QVERIFY( myPGPKey.certificate().isNull() );
|
||||
QVERIFY( myPGPKey.crl().isNull() );
|
||||
@ -625,28 +625,28 @@ void PgpUnitTest::testSignaturesWithExpiredSubkeys()
|
||||
QCA::KeyStoreManager keyManager(this);
|
||||
keyManager.waitForBusyFinished();
|
||||
|
||||
if (QCA::isSupported(QStringList(QString("openpgp")), QString("qca-gnupg")) ||
|
||||
QCA::isSupported(QStringList(QString("keystorelist")), QString( "qca-gnupg"))) {
|
||||
if (QCA::isSupported(QStringList(QStringLiteral("openpgp")), QStringLiteral("qca-gnupg")) ||
|
||||
QCA::isSupported(QStringList(QStringLiteral("keystorelist")), QStringLiteral( "qca-gnupg"))) {
|
||||
|
||||
QStringList storeIds = keyManager.keyStores();
|
||||
QVERIFY(storeIds.contains("qca-gnupg"));
|
||||
QVERIFY(storeIds.contains(QStringLiteral("qca-gnupg")));
|
||||
|
||||
QCA::KeyStore pgpStore(QString("qca-gnupg"), &keyManager);
|
||||
QCA::KeyStore pgpStore(QStringLiteral("qca-gnupg"), &keyManager);
|
||||
QVERIFY(pgpStore.isValid());
|
||||
|
||||
QList<QCA::KeyStoreEntry> keylist = pgpStore.entryList();
|
||||
|
||||
QCA::KeyStoreEntry validKey;
|
||||
foreach(const QCA::KeyStoreEntry key, keylist) {
|
||||
if (key.id() == "DD773CA7E4E22769") {
|
||||
if (key.id() == QLatin1String("DD773CA7E4E22769")) {
|
||||
validKey = key;
|
||||
}
|
||||
}
|
||||
|
||||
QCOMPARE(validKey.isNull(), false);
|
||||
QCOMPARE(validKey.name(), QString("QCA Test Key (Unit test key for expired subkeys) <qca@example.com>"));
|
||||
QCOMPARE(validKey.name(), QStringLiteral("QCA Test Key (Unit test key for expired subkeys) <qca@example.com>"));
|
||||
QCOMPARE(validKey.type(), QCA::KeyStoreEntry::TypePGPSecretKey);
|
||||
QCOMPARE(validKey.id(), QString("DD773CA7E4E22769"));
|
||||
QCOMPARE(validKey.id(), QStringLiteral("DD773CA7E4E22769"));
|
||||
QCOMPARE(validKey.pgpSecretKey().isNull(), false);
|
||||
QCOMPARE(validKey.pgpPublicKey().isNull(), false);
|
||||
|
||||
@ -796,13 +796,13 @@ void PgpUnitTest::testEncryptionWithExpiredSubkeys()
|
||||
QCA::KeyStoreManager keyManager(this);
|
||||
keyManager.waitForBusyFinished();
|
||||
|
||||
if (QCA::isSupported(QStringList(QString("openpgp")), QString("qca-gnupg")) ||
|
||||
QCA::isSupported(QStringList(QString("keystorelist")), QString("qca-gnupg"))) {
|
||||
if (QCA::isSupported(QStringList(QStringLiteral("openpgp")), QStringLiteral("qca-gnupg")) ||
|
||||
QCA::isSupported(QStringList(QStringLiteral("keystorelist")), QStringLiteral("qca-gnupg"))) {
|
||||
|
||||
QStringList storeIds = keyManager.keyStores();
|
||||
QVERIFY(storeIds.contains("qca-gnupg"));
|
||||
QVERIFY(storeIds.contains(QStringLiteral("qca-gnupg")));
|
||||
|
||||
QCA::KeyStore pgpStore(QString("qca-gnupg"), &keyManager);
|
||||
QCA::KeyStore pgpStore(QStringLiteral("qca-gnupg"), &keyManager);
|
||||
QVERIFY(pgpStore.isValid());
|
||||
|
||||
QList<QCA::KeyStoreEntry> keylist = pgpStore.entryList();
|
||||
@ -811,33 +811,33 @@ void PgpUnitTest::testEncryptionWithExpiredSubkeys()
|
||||
QCA::KeyStoreEntry expiredKey;
|
||||
QCA::KeyStoreEntry revokedKey;
|
||||
foreach(const QCA::KeyStoreEntry key, keylist) {
|
||||
if (key.id() == "FEF97E4C4C870810") {
|
||||
if (key.id() == QLatin1String("FEF97E4C4C870810")) {
|
||||
validKey = key;
|
||||
} else if (key.id() == "DD773CA7E4E22769") {
|
||||
} else if (key.id() == QLatin1String("DD773CA7E4E22769")) {
|
||||
expiredKey = key;
|
||||
} else if (key.id() == "1D6A028CC4F444A9") {
|
||||
} else if (key.id() == QLatin1String("1D6A028CC4F444A9")) {
|
||||
revokedKey = key;
|
||||
}
|
||||
}
|
||||
|
||||
QCOMPARE(validKey.isNull(), false);
|
||||
QCOMPARE(validKey.name(), QString("QCA Test Key 2 (Non-expired encryption key with expired encryption subkey) <qca@example.com>"));
|
||||
QCOMPARE(validKey.name(), QStringLiteral("QCA Test Key 2 (Non-expired encryption key with expired encryption subkey) <qca@example.com>"));
|
||||
QCOMPARE(validKey.type(), QCA::KeyStoreEntry::TypePGPSecretKey);
|
||||
QCOMPARE(validKey.id(), QString("FEF97E4C4C870810"));
|
||||
QCOMPARE(validKey.id(), QStringLiteral("FEF97E4C4C870810"));
|
||||
QCOMPARE(validKey.pgpSecretKey().isNull(), false);
|
||||
QCOMPARE(validKey.pgpPublicKey().isNull(), false);
|
||||
|
||||
QCOMPARE(expiredKey.isNull(), false);
|
||||
QCOMPARE(expiredKey.name(), QString("QCA Test Key (Unit test key for expired subkeys) <qca@example.com>"));
|
||||
QCOMPARE(expiredKey.name(), QStringLiteral("QCA Test Key (Unit test key for expired subkeys) <qca@example.com>"));
|
||||
QCOMPARE(expiredKey.type(), QCA::KeyStoreEntry::TypePGPSecretKey);
|
||||
QCOMPARE(expiredKey.id(), QString("DD773CA7E4E22769"));
|
||||
QCOMPARE(expiredKey.id(), QStringLiteral("DD773CA7E4E22769"));
|
||||
QCOMPARE(expiredKey.pgpSecretKey().isNull(), false);
|
||||
QCOMPARE(expiredKey.pgpPublicKey().isNull(), false);
|
||||
|
||||
QCOMPARE(revokedKey.isNull(), false);
|
||||
QCOMPARE(revokedKey.name(), QString("QCA Test Key (Revoked unit test key) <qca@example.com>"));
|
||||
QCOMPARE(revokedKey.name(), QStringLiteral("QCA Test Key (Revoked unit test key) <qca@example.com>"));
|
||||
QCOMPARE(revokedKey.type(), QCA::KeyStoreEntry::TypePGPSecretKey);
|
||||
QCOMPARE(revokedKey.id(), QString("1D6A028CC4F444A9"));
|
||||
QCOMPARE(revokedKey.id(), QStringLiteral("1D6A028CC4F444A9"));
|
||||
QCOMPARE(revokedKey.pgpSecretKey().isNull(), false);
|
||||
QCOMPARE(revokedKey.pgpPublicKey().isNull(), false);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -57,7 +57,7 @@ void RSAUnitTest::cleanupTestCase()
|
||||
void RSAUnitTest::testrsa()
|
||||
{
|
||||
QStringList providersToTest;
|
||||
providersToTest.append("qca-ossl");
|
||||
providersToTest.append(QStringLiteral("qca-ossl"));
|
||||
// providersToTest.append("qca-gcrypt");
|
||||
|
||||
foreach(const QString provider, providersToTest) {
|
||||
@ -151,16 +151,16 @@ void RSAUnitTest::testrsa()
|
||||
|
||||
void RSAUnitTest::testAsymmetricEncryption()
|
||||
{
|
||||
if(!QCA::isSupported("pkey", "qca-ossl") ||
|
||||
!QCA::PKey::supportedTypes("qca-ossl").contains(QCA::PKey::RSA) ||
|
||||
!QCA::PKey::supportedIOTypes("qca-ossl").contains(QCA::PKey::RSA)) {
|
||||
if(!QCA::isSupported("pkey", QStringLiteral("qca-ossl")) ||
|
||||
!QCA::PKey::supportedTypes(QStringLiteral("qca-ossl")).contains(QCA::PKey::RSA) ||
|
||||
!QCA::PKey::supportedIOTypes(QStringLiteral("qca-ossl")).contains(QCA::PKey::RSA)) {
|
||||
QWARN("RSA not supported");
|
||||
QSKIP("RSA not supported. skipping");
|
||||
}
|
||||
QCA::RSAPrivateKey rsaPrivKey1 = QCA::KeyGenerator().createRSA(512, 65537, "qca-ossl").toRSA();
|
||||
QCA::RSAPrivateKey rsaPrivKey1 = QCA::KeyGenerator().createRSA(512, 65537, QStringLiteral("qca-ossl")).toRSA();
|
||||
QCA::RSAPublicKey rsaPubKey1 = rsaPrivKey1.toPublicKey().toRSA();
|
||||
|
||||
QCA::RSAPrivateKey rsaPrivKey2 = QCA::KeyGenerator().createRSA(512, 65537, "qca-ossl").toRSA();
|
||||
QCA::RSAPrivateKey rsaPrivKey2 = QCA::KeyGenerator().createRSA(512, 65537, QStringLiteral("qca-ossl")).toRSA();
|
||||
// QCA::RSAPublicKey rsaPubKey2 = rsaPrivKey2.toPublicKey().toRSA();
|
||||
|
||||
const QCA::SecureArray clearText = "Hello World !";
|
||||
|
@ -73,51 +73,51 @@ void SecureArrayUnitTest::testAll()
|
||||
for (int i = 0; i < testArray.size(); i++) {
|
||||
testArray[ i ] = 0x61;
|
||||
}
|
||||
QCOMPARE( QCA::arrayToHex( testArray.toByteArray() ), QString( "61616161616161616161" ) );
|
||||
QCOMPARE( QCA::arrayToHex( testArray.toByteArray() ), QStringLiteral( "61616161616161616161" ) );
|
||||
|
||||
testArray.fill( 'b' );
|
||||
testArray[7] = 0x00;
|
||||
QCOMPARE( QCA::arrayToHex( testArray.toByteArray() ), QString( "62626262626262006262" ) );
|
||||
QCOMPARE( QCA::arrayToHex( testArray.toByteArray() ), QStringLiteral( "62626262626262006262" ) );
|
||||
|
||||
QByteArray byteArray(10, 'c');
|
||||
QCA::SecureArray secureArray( byteArray );
|
||||
QCOMPARE( secureArray.size(), 10 );
|
||||
QCOMPARE( QCA::arrayToHex ( secureArray.toByteArray() ), QString( "63636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( secureArray.toByteArray() ), QStringLiteral( "63636363636363636363" ) );
|
||||
byteArray.fill( 'd' );
|
||||
// it should be a copy, so no effect
|
||||
QCOMPARE( QCA::arrayToHex ( secureArray.toByteArray() ), QString( "63636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( secureArray.toByteArray() ), QStringLiteral( "63636363636363636363" ) );
|
||||
|
||||
QCA::SecureArray copyArray( secureArray );
|
||||
QCOMPARE( QCA::arrayToHex ( copyArray.toByteArray() ), QString( "63636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( copyArray.toByteArray() ), QStringLiteral( "63636363636363636363" ) );
|
||||
copyArray.fill(0x64);
|
||||
QCOMPARE( QCA::arrayToHex ( copyArray.toByteArray() ), QString( "64646464646464646464" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( secureArray.toByteArray() ), QString( "63636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( copyArray.toByteArray() ), QStringLiteral( "64646464646464646464" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( secureArray.toByteArray() ), QStringLiteral( "63636363636363636363" ) );
|
||||
|
||||
// test for detaching
|
||||
QCA::SecureArray detachArray1 = secureArray; // currently the same
|
||||
QCOMPARE( QCA::arrayToHex ( detachArray1.toByteArray() ), QString( "63636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( detachArray1.toByteArray() ), QStringLiteral( "63636363636363636363" ) );
|
||||
for (int i = 0; i < detachArray1.size(); i++) {
|
||||
detachArray1[i] = 0x66; // implicit detach
|
||||
}
|
||||
QCOMPARE( QCA::arrayToHex ( secureArray.toByteArray() ), QString( "63636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( detachArray1.toByteArray() ), QString( "66666666666666666666" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( secureArray.toByteArray() ), QStringLiteral( "63636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( detachArray1.toByteArray() ), QStringLiteral( "66666666666666666666" ) );
|
||||
|
||||
QCA::SecureArray detachArray2 = secureArray; // currently the same
|
||||
QCOMPARE( QCA::arrayToHex ( detachArray2.toByteArray() ), QString( "63636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( detachArray2.toByteArray() ), QStringLiteral( "63636363636363636363" ) );
|
||||
//implicit detach
|
||||
for (int i = 0; i < detachArray2.size(); i++) {
|
||||
detachArray2.data()[i] = 0x67;
|
||||
}
|
||||
QCOMPARE( QCA::arrayToHex ( secureArray.toByteArray() ), QString( "63636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( detachArray2.toByteArray() ), QString( "67676767676767676767" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( secureArray.toByteArray() ), QStringLiteral( "63636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( detachArray2.toByteArray() ), QStringLiteral( "67676767676767676767" ) );
|
||||
|
||||
QCA::SecureArray detachArray3 = secureArray; // implicitly shared copy
|
||||
QCOMPARE( QCA::arrayToHex ( detachArray3.toByteArray() ), QString( "63636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( detachArray3.toByteArray() ), QStringLiteral( "63636363636363636363" ) );
|
||||
for (int i = 0; i < detachArray3.size(); i++) {
|
||||
detachArray3.data()[i] = 0x68;
|
||||
}
|
||||
QCOMPARE( QCA::arrayToHex ( secureArray.toByteArray() ), QString( "63636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( detachArray3.toByteArray() ), QString( "68686868686868686868" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( secureArray.toByteArray() ), QStringLiteral( "63636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( detachArray3.toByteArray() ), QStringLiteral( "68686868686868686868" ) );
|
||||
|
||||
|
||||
// test for resizing
|
||||
@ -136,10 +136,10 @@ void SecureArrayUnitTest::testAll()
|
||||
appendArray.append( QCA::SecureArray() );
|
||||
QCOMPARE( QCA::arrayToHex( secureArray.toByteArray() ), QCA::arrayToHex( appendArray.toByteArray() ) );
|
||||
appendArray.append( secureArray );
|
||||
QCOMPARE( QCA::arrayToHex ( secureArray.toByteArray() ), QString( "63636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( appendArray.toByteArray() ), QString( "6363636363636363636363636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( secureArray.toByteArray() ), QStringLiteral( "63636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( appendArray.toByteArray() ), QStringLiteral( "6363636363636363636363636363636363636363" ) );
|
||||
QCA::SecureArray appendArray2 = secureArray;
|
||||
QCOMPARE( QCA::arrayToHex ( appendArray2.append(secureArray).toByteArray() ), QString( "6363636363636363636363636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( appendArray2.append(secureArray).toByteArray() ), QStringLiteral( "6363636363636363636363636363636363636363" ) );
|
||||
|
||||
// test for a possible problem with operator[]
|
||||
QVERIFY( (secureArray[0] == (char)0x63) );
|
||||
|
@ -58,25 +58,25 @@ void StaticUnitTest::hexConversions()
|
||||
{
|
||||
QByteArray test(10, 'a');
|
||||
|
||||
QCOMPARE( QCA::arrayToHex(test), QString("61616161616161616161") );
|
||||
QCOMPARE( QCA::arrayToHex(test), QStringLiteral("61616161616161616161") );
|
||||
|
||||
test.fill('b');
|
||||
test[7] = 0x00;
|
||||
|
||||
QCOMPARE( test == QCA::hexToArray(QString("62626262626262006262")), true );
|
||||
QCOMPARE( test == QCA::hexToArray(QStringLiteral("62626262626262006262")), true );
|
||||
|
||||
QCA::SecureArray testArray(10);
|
||||
//testArray.fill( 'a' );
|
||||
for (int i = 0; i < testArray.size(); i++) {
|
||||
testArray[ i ] = 0x61;
|
||||
}
|
||||
QCOMPARE( QCA::arrayToHex( testArray.toByteArray() ), QString( "61616161616161616161" ) );
|
||||
QCOMPARE( QCA::arrayToHex( testArray.toByteArray() ), QStringLiteral( "61616161616161616161" ) );
|
||||
//testArray.fill( 'b' );
|
||||
for (int i = 0; i < testArray.size(); i++) {
|
||||
testArray[ i ] = 0x62;
|
||||
}
|
||||
testArray[6] = 0x00;
|
||||
QCOMPARE( testArray == QCA::hexToArray(QString("62626262626200626262")), true );
|
||||
QCOMPARE( testArray == QCA::hexToArray(QStringLiteral("62626262626200626262")), true );
|
||||
|
||||
QCOMPARE( testArray == QCA::hexToArray( QCA::arrayToHex( testArray.toByteArray() ) ), true );
|
||||
|
||||
@ -91,17 +91,17 @@ void StaticUnitTest::capabilities()
|
||||
// doing a direct comparison, since they change
|
||||
// We try to work around that using contains()
|
||||
QStringList defaultCapabilities = QCA::defaultFeatures();
|
||||
QVERIFY( defaultCapabilities.contains("random") );
|
||||
QVERIFY( defaultCapabilities.contains("sha1") );
|
||||
QVERIFY( defaultCapabilities.contains("md5") );
|
||||
QVERIFY( defaultCapabilities.contains(QStringLiteral("random")) );
|
||||
QVERIFY( defaultCapabilities.contains(QStringLiteral("sha1")) );
|
||||
QVERIFY( defaultCapabilities.contains(QStringLiteral("md5")) );
|
||||
|
||||
QStringList capList;
|
||||
capList << "random" << "sha1";
|
||||
capList << QStringLiteral("random") << QStringLiteral("sha1");
|
||||
QCOMPARE( QCA::isSupported(capList), true );
|
||||
capList.append("noSuch");
|
||||
capList.append(QStringLiteral("noSuch"));
|
||||
QCOMPARE( QCA::isSupported(capList), false );
|
||||
capList.clear();
|
||||
capList.append("noSuch");
|
||||
capList.append(QStringLiteral("noSuch"));
|
||||
QCOMPARE( QCA::isSupported(capList), false );
|
||||
}
|
||||
|
||||
|
@ -67,20 +67,20 @@ void SymmetricKeyUnitTest::test1()
|
||||
QCA::SymmetricKey keyArray = secureArray;
|
||||
QCOMPARE( secureArray.size(), 10 );
|
||||
QCOMPARE( keyArray.size(), secureArray.size() );
|
||||
QCOMPARE( QCA::arrayToHex ( keyArray.toByteArray() ), QString( "63636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( secureArray.toByteArray() ), QString( "63636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( keyArray.toByteArray() ), QStringLiteral( "63636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( secureArray.toByteArray() ), QStringLiteral( "63636363636363636363" ) );
|
||||
keyArray[3] = 0x00; // test keyArray detaches OK
|
||||
QCOMPARE( QCA::arrayToHex ( keyArray.toByteArray() ), QString( "63636300636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( secureArray.toByteArray() ), QString( "63636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( keyArray.toByteArray() ), QStringLiteral( "63636300636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( secureArray.toByteArray() ), QStringLiteral( "63636363636363636363" ) );
|
||||
|
||||
QCA::SymmetricKey anotherKey;
|
||||
anotherKey = keyArray;
|
||||
QCOMPARE( QCA::arrayToHex ( anotherKey.toByteArray() ), QString( "63636300636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( anotherKey.toByteArray() ), QStringLiteral( "63636300636363636363" ) );
|
||||
QCA::SymmetricKey bigKey( 100 );
|
||||
anotherKey = bigKey;
|
||||
QCOMPARE( anotherKey.size(), 100 );
|
||||
anotherKey = secureArray;
|
||||
QCOMPARE( QCA::arrayToHex ( secureArray.toByteArray() ), QString( "63636363636363636363" ) );
|
||||
QCOMPARE( QCA::arrayToHex ( secureArray.toByteArray() ), QStringLiteral( "63636363636363636363" ) );
|
||||
QCOMPARE( anotherKey.size(), 10 );
|
||||
anotherKey = emptyKey;
|
||||
QCOMPARE( anotherKey.size(), 0 );
|
||||
|
@ -54,14 +54,14 @@ void TLSUnitTest::cleanupTestCase()
|
||||
|
||||
void TLSUnitTest::testCipherList()
|
||||
{
|
||||
if(!QCA::isSupported("tls", "qca-ossl"))
|
||||
if(!QCA::isSupported("tls", QStringLiteral("qca-ossl")))
|
||||
QWARN("TLS not supported for qca-ossl");
|
||||
else {
|
||||
QCA::TLS *tls = new QCA::TLS(QCA::TLS::Stream, nullptr, "qca-ossl");
|
||||
QCA::TLS *tls = new QCA::TLS(QCA::TLS::Stream, nullptr, QStringLiteral("qca-ossl"));
|
||||
QStringList cipherList = tls->supportedCipherSuites(QCA::TLS::TLS_v1);
|
||||
QVERIFY( cipherList.contains("TLS_DHE_RSA_WITH_AES_256_CBC_SHA") );
|
||||
QVERIFY( cipherList.contains("TLS_RSA_WITH_AES_256_CBC_SHA") );
|
||||
QVERIFY( cipherList.contains("TLS_DHE_RSA_WITH_AES_128_CBC_SHA") );
|
||||
QVERIFY( cipherList.contains(QStringLiteral("TLS_DHE_RSA_WITH_AES_256_CBC_SHA")) );
|
||||
QVERIFY( cipherList.contains(QStringLiteral("TLS_RSA_WITH_AES_256_CBC_SHA")) );
|
||||
QVERIFY( cipherList.contains(QStringLiteral("TLS_DHE_RSA_WITH_AES_128_CBC_SHA")) );
|
||||
|
||||
// openSUSE TW OpenSSL 1.1 does not have this
|
||||
// QVERIFY( cipherList.contains("TLS_DHE_DSS_WITH_AES_256_CBC_SHA") );
|
||||
|
@ -75,7 +75,7 @@ private Q_SLOTS:
|
||||
{
|
||||
QCA::CertificateCollection rootCerts;
|
||||
QCA::ConvertResult resultRootCert;
|
||||
QCA::Certificate rootCert = QCA::Certificate::fromPEMFile( "root.crt", &resultRootCert);
|
||||
QCA::Certificate rootCert = QCA::Certificate::fromPEMFile( QStringLiteral("root.crt"), &resultRootCert);
|
||||
QCOMPARE( resultRootCert, QCA::ConvertGood );
|
||||
rootCerts.addCertificate( rootCert );
|
||||
|
||||
@ -142,11 +142,11 @@ void VeloxUnitTest::cleanupTestCase()
|
||||
|
||||
void VeloxUnitTest::sniAlice()
|
||||
{
|
||||
if(!QCA::isSupported("tls", "qca-ossl"))
|
||||
if(!QCA::isSupported("tls", QStringLiteral("qca-ossl")))
|
||||
QWARN("TLS not supported for qca-ossl");
|
||||
else {
|
||||
TlsTest *s = new TlsTest;
|
||||
s->start( "alice.sni.velox.ch", 443 );
|
||||
s->start( QStringLiteral("alice.sni.velox.ch"), 443 );
|
||||
s->waitForHandshake();
|
||||
QVERIFY( s->isHandshaken() );
|
||||
}
|
||||
@ -154,11 +154,11 @@ void VeloxUnitTest::sniAlice()
|
||||
|
||||
void VeloxUnitTest::sniBob()
|
||||
{
|
||||
if(!QCA::isSupported("tls", "qca-ossl"))
|
||||
if(!QCA::isSupported("tls", QStringLiteral("qca-ossl")))
|
||||
QWARN("TLS not supported for qca-ossl");
|
||||
else {
|
||||
TlsTest *s = new TlsTest;
|
||||
s->start( "bob.sni.velox.ch", 443 );
|
||||
s->start( QStringLiteral("bob.sni.velox.ch"), 443 );
|
||||
s->waitForHandshake();
|
||||
QVERIFY( s->isHandshaken() );
|
||||
}
|
||||
@ -166,11 +166,11 @@ void VeloxUnitTest::sniBob()
|
||||
|
||||
void VeloxUnitTest::sniCarol()
|
||||
{
|
||||
if(!QCA::isSupported("tls", "qca-ossl"))
|
||||
if(!QCA::isSupported("tls", QStringLiteral("qca-ossl")))
|
||||
QWARN("TLS not supported for qca-ossl");
|
||||
else {
|
||||
TlsTest *s = new TlsTest;
|
||||
s->start( "carol.sni.velox.ch", 443 );
|
||||
s->start( QStringLiteral("carol.sni.velox.ch"), 443 );
|
||||
s->waitForHandshake();
|
||||
QVERIFY( s->isHandshaken() );
|
||||
}
|
||||
@ -178,11 +178,11 @@ void VeloxUnitTest::sniCarol()
|
||||
|
||||
void VeloxUnitTest::sniDave()
|
||||
{
|
||||
if(!QCA::isSupported("tls", "qca-ossl"))
|
||||
if(!QCA::isSupported("tls", QStringLiteral("qca-ossl")))
|
||||
QWARN("TLS not supported for qca-ossl");
|
||||
else {
|
||||
TlsTest *s = new TlsTest;
|
||||
s->start( "dave.sni.velox.ch", 443 );
|
||||
s->start( QStringLiteral("dave.sni.velox.ch"), 443 );
|
||||
s->waitForHandshake();
|
||||
QVERIFY( s->isHandshaken() );
|
||||
}
|
||||
@ -190,11 +190,11 @@ void VeloxUnitTest::sniDave()
|
||||
|
||||
void VeloxUnitTest::sniMallory()
|
||||
{
|
||||
if(!QCA::isSupported("tls", "qca-ossl"))
|
||||
if(!QCA::isSupported("tls", QStringLiteral("qca-ossl")))
|
||||
QWARN("TLS not supported for qca-ossl");
|
||||
else {
|
||||
TlsTest *s = new TlsTest;
|
||||
s->start( "mallory.sni.velox.ch", 443 );
|
||||
s->start( QStringLiteral("mallory.sni.velox.ch"), 443 );
|
||||
s->waitForHandshake();
|
||||
QVERIFY( s->isHandshaken() );
|
||||
}
|
||||
@ -203,11 +203,11 @@ void VeloxUnitTest::sniMallory()
|
||||
|
||||
void VeloxUnitTest::sniIvan()
|
||||
{
|
||||
if(!QCA::isSupported("tls", "qca-ossl"))
|
||||
if(!QCA::isSupported("tls", QStringLiteral("qca-ossl")))
|
||||
QWARN("TLS not supported for qca-ossl");
|
||||
else {
|
||||
TlsTest *s = new TlsTest;
|
||||
s->start( "ivan.sni.velox.ch", 443 );
|
||||
s->start( QStringLiteral("ivan.sni.velox.ch"), 443 );
|
||||
s->waitForHandshake();
|
||||
QVERIFY( s->isHandshaken() );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user