Random random = new MersenneTwister(1010101);
HashMap<ByteArrayWrapper, DSAPublicKey> map = new HashMap<ByteArrayWrapper, DSAPublicKey>();
for(int i=0;i<keys;i++) {
DSAPrivateKey privKey = new DSAPrivateKey(group, random);
DSAPublicKey key = new DSAPublicKey(group, privKey);
byte[] hash = key.asBytesHash();
ByteArrayWrapper w = new ByteArrayWrapper(hash);
map.put(w, key.cloneKey());
pubkeys.cacheKey(hash, key, false, false, false, false, false);
assertTrue(pubkeys.getKey(hash, false, false, null).equals(key));
}