use of org.gudy.bouncycastle.jce.interfaces.ECKey in project BiglyBT by BiglySoftware.
the class JDKDSASigner method engineInitVerify.
@Override
protected void engineInitVerify(PublicKey publicKey) throws InvalidKeyException {
CipherParameters param = null;
if (publicKey instanceof ECKey) {
param = ECUtil.generatePublicKeyParameter(publicKey);
} else if (publicKey instanceof DSAKey) {
param = DSAUtil.generatePublicKeyParameter(publicKey);
} else {
try {
/*
byte[] bytes = publicKey.getEncoded();
publicKey = JDKKeyFactory.createPublicKeyFromDERStream(
new ByteArrayInputStream(bytes));
if (publicKey instanceof ECKey)
{
param = ECUtil.generatePublicKeyParameter(publicKey);
}
else if (publicKey instanceof DSAKey)
{
param = DSAUtil.generatePublicKeyParameter(publicKey);
}
else
{
*/
throw new InvalidKeyException("can't recognise key type in DSA based signer");
// }
} catch (Exception e) {
throw new InvalidKeyException("can't recognise key type in DSA based signer");
}
}
digest.reset();
signer.init(false, param);
}
use of org.gudy.bouncycastle.jce.interfaces.ECKey in project BiglyBT by BiglySoftware.
the class JDKDSASigner method engineInitSign.
@Override
protected void engineInitSign(PrivateKey privateKey) throws InvalidKeyException {
CipherParameters param = null;
if (privateKey instanceof ECKey) {
param = ECUtil.generatePrivateKeyParameter(privateKey);
} else {
param = DSAUtil.generatePrivateKeyParameter(privateKey);
}
digest.reset();
if (random != null) {
signer.init(true, new ParametersWithRandom(param, random));
} else {
signer.init(true, param);
}
}
Aggregations