public void setPubKey(byte[] y, byte[] p, byte[] q, byte[] g) throws Exception { DSAPublicKeySpec dsaPubKeySpec = new DSAPublicKeySpec( new BigInteger(y), new BigInteger(p), new BigInteger(q), new BigInteger(g)); PublicKey pubKey = keyFactory.generatePublic(dsaPubKeySpec); signature.initVerify(pubKey); }
public void setPubKey(byte[] e, byte[] n) throws Exception { RSAPublicKeySpec rsaPubKeySpec = new RSAPublicKeySpec(new BigInteger(n), new BigInteger(e)); PublicKey pubKey = keyFactory.generatePublic(rsaPubKeySpec); signature.initVerify(pubKey); }