Skip navigation.
KDE Developer's Journals

Qt Cryptographic Architecture - approaching final API

brad hards's picture

Justin Karneges recently released the "test1" version of QCA. Read the announcement here. There will be a "test2" release soon, and the final release is scheduled for 4 September 2007.

If you have an interest in crypto, or Qt APIs, or (ideally) both, note that we are providing Binary Compatibility and source compatibility from QCA 2.0.0 release for the duration of Qt4. If the API doesn't do what you need, now is the time to tell us. After 2.0.0 we will do additions, but nothing that will break BC.

The plugins aren't finished, but they are getting closer. In particular, the pkcs11 smartcard provider is looking pretty good. Justin recently blogged about smartcard support, showing an application that does CMS signing using smartcards with QCA.

You can read the API documentation at api.kde.org, and we also provide build documentation with QCA tarballs. The tarball API docs (or the output if you run doxygen(1) in the kdesupport/qca directory yourself) also include links to the example code.

Remember: now is the time to let us know of any last minute changes!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ita_'s picture

hashing

Just a few comments from the announcement:

From the gpg/pgp keyring support i suppose the cast5 algorithm is also supported ?

Why are md2, md4 and sha-0 still included ?

Having the Whirlpool hash function would be a big plus (not of the same family as md5, sha).

There are no much details on the random function(s) provided (Mersenne twister, ..?)

More details on the compression algorithms in use would be nice too.

Another useful encoding besides base64 is Ascii85, it might be shared with the ps/pdf processing apps.

brad hards's picture

A few clarifications

GPG support only provides OpenPGP ops - signing, verification, encryption and decryption. It doesn't give you the raw primitives. So Cast5 isn't supported as a cipher primitive. It might not be too hard to provide though, if you can explain what you need it for. Can you elaborate?

MD2, MD4 and SHA0 are provided because they are still potentially valuable (just like MD5). Even though there are potential collision attacks for some algorithms, collision-resistance isn't the only useful property for a hash. For example, MD4 is used for its non-reverse characteristic in NTLM, and is a reasonable choice.

Whirlpool might not be too hard either. Do you know if OpenSSL supports it? Would you like to propose a patch?

The random function is a product of the plugin that provides it. We do have an internal provider for random (also MD5 and SHA-1), and it just calls the qrand() function. What algorithm is used to implement that depends on the platform. However other plugins also provide random functions.

QCA doesn't do compression separate to the encryption ops (e.g. in TLS). Can you tell me what led you to think that it might? I probably need to reword it.

Ascii85 isn't a common crypto operation, and I don't see how it could be shared with PDF (since I think that is built into poppler, rather than okular).

ita_'s picture

A few clarifications

Cast 5 is needed for reading Gnupg keyrings (private keys).

For the hashing functions, they must be only provided if there is a real need, you cited NTLM for md4 which is a good reason.

For whirlpool i see it has been implemented already (awesome!) which makes the library now really interesting. Whirlpool is different from the md5 and sha hashing functions, and is suitable as a (hot) replacement for sha if that one is found broken too fast.

The random functions and the compression functions (gzip, bzip2 ..) do matter. It is easier to break data with lots of redundancies, just like the passwords in /etc/password are hashed with a salt and not hashed directly. An incorrect compression or random function however can also make the data much more suitable for cryptanalysis.

As for Ascii85, it is no more a crypto operation than base64, but its use in pdf and its encoding ratio (25% loss instead of 33%) make it a rather relevant feature.

rich's picture

List the hashes

A method to list the supported hashes would be useful.

brad hards's picture

What for? Display to the user?

Rich,

Can you explain what you plan to do with this list? I'm trying to make sure we actually provide something useful.

Do you want to show it to the user? If so, do you want a pretty name ("SHA256"), or do you want the name of the provider feature ("sha256")? Or do we need to provide a pair?

Brad

rich's picture

Yes, I'm thinking in terms

Yes, I'm thinking in terms of providing a list to users. I think the type of users to whom this information would make sense would be able to handle sha256 or SHA256 so I doubt you'd need a 'friendly name'.

brad hards's picture

Your wish....

...has been implemented.

We could always give you a list of hashes - it just wasn't only the hashes - you got every feature.

Now you can get a list of available hashes. This is from qca_basic.h, as part of the Hash class:
/**
Returns a list of all of the hash types available
*/
static QStringList supportedTypes(const QString &provider = QString());

[The reason why it is static is so you can get the list without creating a Hash first].

By default, you get all the hashes for all the providers, but the provider argument allows you to choose a particular provider.

We also extended this to ciphers and MAC algorithms too.

rich's picture

Thanks!

Sounds great. Smiling

cartman's picture

Unit tests failing

Unit tests fails for me for some time now (KDE SVN) :

[~/KDE4/kdesupport/qca]> make test
Running tests...
Start processing tests
Test project /home/cartman/KDE4/kdesupport/qca
1/ 24 Testing Base64 Passed
2/ 24 Testing BigInteger Passed
3/ 24 Testing Certificate Passed
4/ 24 Testing SymmetricCipher Passed
5/ 24 Testing ClientSidePlugin Passed
6/ 24 Testing CryptographicMessageSyntax Passed
7/ 24 Testing DigitalSignatureAlgorithm Passed
8/ 24 Testing Hashing Passed
9/ 24 Testing HexadecimalConversion Passed
10/ 24 Testing KeyDerivationFunction Passed
11/ 24 Testing KeyBundle Passed
12/ 24 Testing KeyGeneration Passed
13/ 24 Testing KeyLength Passed
14/ 24 Testing KeyStore Passed
15/ 24 Testing MessageAuthenticationCode Passed
16/ 24 Testing MetaTypeUnittest Passed
17/ 24 Testing PGP ***Failed
18/ 24 Testing PublicKeyInfrastructure Passed
19/ 24 Testing RandomNumberGeneration ***Failed
20/ 24 Testing RSA Passed
21/ 24 Testing SecureArray Passed
22/ 24 Testing StaticFunctions Passed
23/ 24 Testing SymmetricKey Passed
24/ 24 Testing TransportLayerSecurity ***Failed

88% tests passed, 3 tests failed out of 24

The following tests FAILED:
17 - PGP (Failed)
19 - RandomNumberGeneration (Failed)
24 - TransportLayerSecurity (Failed)
Errors while running CTest
make: *** [test] Error 8

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.