DsaPrivateKey key = new DsaPrivateKey();
KeyPairGenerator kpg;
try {
kpg = KeyPairGenerator.getInstance(KEY_GEN_ALGORITHM);
} catch (GeneralSecurityException e) {
throw new KeyczarException(e);
}
key.size = keySize;
kpg.initialize(key.size());
KeyPair pair = kpg.generateKeyPair();
key.jcePrivateKey = (DSAPrivateKey) pair.getPrivate();