Iterator it = pgpPub.getPublicKeys();
while (it.hasNext())
{
keyCount++;
PGPPublicKey pubKey = (PGPPublicKey)it.next();
Iterator sIt = pubKey.getSignatures();
while (sIt.hasNext())
{
((PGPSignature)sIt.next()).getSignatureType();
}
}
if (keyCount != 2)
{
fail("wrong number of public keys");
}
}
if (count != 1)
{
fail("wrong number of public keyrings");
}
//
// exact match
//
rIt = pubRings.getKeyRings("test (Test key) <test@ubicall.com>");
count = 0;
while (rIt.hasNext())
{
count++;
rIt.next();
}
if (count != 1)
{
fail("wrong number of public keyrings on exact match");
}
//
// partial match 1 expected
//
rIt = pubRings.getKeyRings("test", true);
count = 0;
while (rIt.hasNext())
{
count++;
rIt.next();
}
if (count != 1)
{
fail("wrong number of public keyrings on partial match 1");
}
//
// partial match 0 expected
//
rIt = pubRings.getKeyRings("XXX", true);
count = 0;
while (rIt.hasNext())
{
count++;
rIt.next();
}
if (count != 0)
{
fail("wrong number of public keyrings on partial match 0");
}
//
// case-insensitive partial match
//
rIt = pubRings.getKeyRings("TEST@ubicall.com", true, true);
count = 0;
while (rIt.hasNext())
{
count++;
rIt.next();
}
if (count != 1)
{
fail("wrong number of public keyrings on case-insensitive partial match");
}
PGPSecretKeyRingCollection secretRings = new PGPSecretKeyRingCollection(sec1);
rIt = secretRings.getKeyRings();
count = 0;
while (rIt.hasNext())
{
PGPSecretKeyRing pgpSec = (PGPSecretKeyRing)rIt.next();
count++;
int keyCount = 0;
byte[] bytes = pgpSec.getEncoded();
pgpSec = new PGPSecretKeyRing(bytes);
Iterator it = pgpSec.getSecretKeys();
while (it.hasNext())
{
keyCount++;
PGPSecretKey k = (PGPSecretKey)it.next();
PGPPublicKey pk = k.getPublicKey();
pk.getSignatures();
byte[] pkBytes = pk.getEncoded();
PGPPublicKeyRing pkR = new PGPPublicKeyRing(pkBytes, new BcKeyFingerprintCalculator());
}
if (keyCount != 2)