Remove the default arguments on MessageAuthenticationCode,

as discussed with Justin.

It basically made sense to have a default of SHA1 for HMAC, but
when we went away from having all the specific classes, defaulting
all MAC to be HMAC(SHA1) was a bit of a stretch.

svn path=/trunk/kdesupport/qca/; revision=605322
This commit is contained in:
Brad Hards 2006-11-16 10:58:43 +00:00
parent e6fff0cecb
commit 6ad4fb500e
4 changed files with 12 additions and 12 deletions

1
TODO
View File

@ -19,7 +19,6 @@
reports true, but then when the object is created, it doesn't actually
support the feature (because the wrong provider was used).
why is Random returning unsigned?
why does the MessageAuthenticationCode constructor have default args?
code:
don't create qobjects during init (that means you, keystoremanager)
functions that don't trip a scan should do so on the first try

View File

@ -47,9 +47,9 @@ int main(int argc, char **argv)
if( !QCA::isSupported("hmac(sha1)") ) {
printf("HMAC(SHA1) not supported!\n");
} else {
// create the required object. This is equivalent
// to QCA::MessageAuthenticationCode hmacObject("hmac(sha1)").
QCA::MessageAuthenticationCode hmacObject;
// create the required object using HMAC with SHA-1, and an
// empty key.
QCA::MessageAuthenticationCode hmacObject( "hmac(sha1)", QSecureArray() );
// create the key
QCA::SymmetricKey keyObject(key);

View File

@ -641,7 +641,8 @@ namespace QCA
MessageAuthenticationCode is a class for accessing the various
message authentication code algorithms within %QCA.
HMAC using SHA1 ("hmac(sha1)")is recommended for new applications.
HMAC using SHA1 ("hmac(sha1)") or HMAC using SHA256 ("hmac(sha256)")
is recommended for new applications.
Note that if your application is potentially susceptable to "replay attacks"
where the message is sent more than once, you should include a counter in
@ -661,8 +662,8 @@ namespace QCA
\param key the shared key
\param provider the provider to use, if a particular provider is required
*/
MessageAuthenticationCode(const QString &type = "hmac(sha1)",
const SymmetricKey &key = SymmetricKey(),
MessageAuthenticationCode(const QString &type,
const SymmetricKey &key,
const QString &provider = QString());
/**

View File

@ -108,7 +108,7 @@ void MACUnitTest::HMACMD5()
md5hmac4.update( data4 );
QCOMPARE( QCA::arrayToHex( md5hmac4.final() ), QString( "697eaf0aca3a3aea3a75164746ffaa79" ) );
QCA::MessageAuthenticationCode md5hmac5( "hmac(md5)" );
QCA::MessageAuthenticationCode md5hmac5( "hmac(md5)", QSecureArray() );
QCA::SymmetricKey key5( QCA::hexToArray( "0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c" ) );
md5hmac5.setup( key5 );
QSecureArray data5( "Test With Truncation" );
@ -479,7 +479,7 @@ void MACUnitTest::HMACSHA1()
QCOMPARE( sha1hmacLenTest.validKeyLength( -2 ), false );
// These tests are from RFC2202, Section 3.
QCA::MessageAuthenticationCode test1; // should be default
QCA::MessageAuthenticationCode test1( "hmac(sha1)", QSecureArray() );
QCA::SymmetricKey key1( QCA::hexToArray( "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b" ) );
test1.setup( key1 );
QSecureArray data1( "Hi There" );