1.1 --- a/MYCryptoTest.m Sat Jun 06 15:01:28 2009 -0700
1.2 +++ b/MYCryptoTest.m Tue Jun 09 23:58:03 2009 -0700
1.3 @@ -43,23 +43,44 @@
1.4 }
1.5
1.6
1.7 -TestCase(EnumerateKeys) {
1.8 +TestCase(Enumerate) {
1.9 + RequireTestCase(EnumeratePublicKeys);
1.10 + RequireTestCase(EnumeratePrivateKeys);
1.11 + RequireTestCase(EnumerateSymmetricKeys);
1.12 + RequireTestCase(EnumerateCerts);
1.13 + RequireTestCase(EnumerateIdentities);
1.14 +}
1.15 +
1.16 +
1.17 +TestCase(EnumeratePublicKeys) {
1.18 RequireTestCase(MYKeychain);
1.19 NSEnumerator *e = [[MYKeychain allKeychains] enumeratePublicKeys];
1.20 Log(@"Public Key Enumerator = %@", e);
1.21 CAssert(e);
1.22 for (MYPublicKey *key in e) {
1.23 - Log(@"Found %@ -- name=%@", key, key.name);
1.24 + Log(@"Trying public key %@", key.keyRef);
1.25 + @try{
1.26 + Log(@"Found %@ -- name=%@", key, key.name);
1.27 + }@catch (NSException *x) {
1.28 + Warn(@"Caught %@",x); //TEMP
1.29 + }
1.30 }
1.31 -
1.32 - e = [[MYKeychain allKeychains] enumeratePrivateKeys];
1.33 +}
1.34 +
1.35 +TestCase(EnumeratePrivateKeys) {
1.36 + RequireTestCase(MYKeychain);
1.37 + NSEnumerator *e = [[MYKeychain allKeychains] enumeratePrivateKeys];
1.38 Log(@"Key-Pair Enumerator = %@", e);
1.39 CAssert(e);
1.40 for (MYPrivateKey *key in e) {
1.41 - Log(@"Found %@ -- name=%@", key, key.name);
1.42 + Log(@"Found %@ -- name=%@ --> %@", key, key.name, key.publicKey);
1.43 + CAssert(key.publicKey);
1.44 }
1.45 -
1.46 - e = [[MYKeychain allKeychains] enumerateSymmetricKeys];
1.47 +}
1.48 +
1.49 +TestCase(EnumerateSymmetricKeys) {
1.50 + RequireTestCase(MYKeychain);
1.51 + NSEnumerator *e = [[MYKeychain allKeychains] enumerateSymmetricKeys];
1.52 Log(@"Symmetric Key Enumerator = %@", e);
1.53 CAssert(e);
1.54 for (MYSymmetricKey *key in e) {
1.55 @@ -74,7 +95,8 @@
1.56 Log(@"Enumerator = %@", e);
1.57 CAssert(e);
1.58 for (MYCertificate *cert in e) {
1.59 - //Log(@"Found %@ -- name=%@, email=%@", cert, cert.commonName, cert.emailAddresses);
1.60 + Log(@"Found %@ -- name=%@, email=%@", cert, cert.commonName, cert.emailAddresses);
1.61 + CAssert(cert.publicKey);
1.62 }
1.63 }
1.64
1.65 @@ -112,7 +134,7 @@
1.66 else
1.67 key = [MYSymmetricKey generateSymmetricKeyOfSize: sizeInBits algorithm: algorithm];
1.68 Log(@"Created %@", key);
1.69 - CAssert(key);
1.70 + CAssert(key);
1.71 CAssertEq(key.algorithm, algorithm);
1.72 CAssertEq(key.keySizeInBits, sizeInBits);
1.73 #if !TARGET_OS_IPHONE