BigInteger q = ((DERInteger) seq.getObjectAt(2)).getValue();
BigInteger g = ((DERInteger) seq.getObjectAt(3)).getValue();
BigInteger y = ((DERInteger) seq.getObjectAt(4)).getValue();
BigInteger x = ((DERInteger) seq.getObjectAt(5)).getValue();
PrivateKey priv = fact.generatePrivate(new DSAPrivateKeySpec(x, p, q, g));
PublicKey pub = fact.generatePublic(new DSAPublicKeySpec(y, p, q, g));
return new KeyPair(pub, priv);
} else {
return null;
}
}