use of com.github.zhenwei.provider.jce.interfaces.ECKey in project LinLong-Java by zhenwei1108.
the class SignatureSpi method engineInitSign.
protected void engineInitSign(PrivateKey privateKey) throws InvalidKeyException {
CipherParameters param;
if (privateKey instanceof ECKey) {
param = ECUtil.generatePrivateKeyParameter(privateKey);
} else {
param = GOST3410Util.generatePrivateKeyParameter(privateKey);
}
digest.reset();
if (appRandom != null) {
signer.init(true, new ParametersWithRandom(param, appRandom));
} else {
signer.init(true, param);
}
}
use of com.github.zhenwei.provider.jce.interfaces.ECKey in project LinLong-Java by zhenwei1108.
the class ECGOST2012SignatureSpi512 method engineInitSign.
protected void engineInitSign(PrivateKey privateKey) throws InvalidKeyException {
ECKeyParameters param;
if (privateKey instanceof ECKey) {
param = (ECKeyParameters) ECUtil.generatePrivateKeyParameter(privateKey);
} else {
throw new InvalidKeyException("cannot recognise key type in ECGOST-2012-512 signer");
}
if (param.getParameters().getN().bitLength() < 505) {
throw new InvalidKeyException("key too weak for ECGOST-2012-512");
}
digest.reset();
if (appRandom != null) {
signer.init(true, new ParametersWithRandom(param, appRandom));
} else {
signer.init(true, param);
}
}
use of com.github.zhenwei.provider.jce.interfaces.ECKey in project LinLong-Java by zhenwei1108.
the class ECGOST2012SignatureSpi256 method engineInitSign.
protected void engineInitSign(PrivateKey privateKey) throws InvalidKeyException {
ECKeyParameters param;
if (privateKey instanceof ECKey) {
param = (ECKeyParameters) ECUtil.generatePrivateKeyParameter(privateKey);
} else {
throw new InvalidKeyException("cannot recognise key type in ECGOST-2012-256 signer");
}
if (param.getParameters().getN().bitLength() > 256) {
throw new InvalidKeyException("key out of range for ECGOST-2012-256");
}
digest.reset();
if (appRandom != null) {
signer.init(true, new ParametersWithRandom(param, appRandom));
} else {
signer.init(true, param);
}
}
use of com.github.zhenwei.provider.jce.interfaces.ECKey in project LinLong-Java by zhenwei1108.
the class SignatureSpi method engineInitSign.
protected void engineInitSign(PrivateKey privateKey) throws InvalidKeyException {
CipherParameters param = null;
if (privateKey instanceof BCDSTU4145PrivateKey) {
// TODO: add parameters support.
param = ECUtil.generatePrivateKeyParameter(privateKey);
digest = new GOST3411Digest(expandSbox(DSTU4145Params.getDefaultDKE()));
} else if (privateKey instanceof ECKey) {
param = ECUtil.generatePrivateKeyParameter(privateKey);
digest = new GOST3411Digest(expandSbox(DSTU4145Params.getDefaultDKE()));
}
if (appRandom != null) {
signer.init(true, new ParametersWithRandom(param, appRandom));
} else {
signer.init(true, param);
}
}
use of com.github.zhenwei.provider.jce.interfaces.ECKey in project LinLong-Java by zhenwei1108.
the class SignatureSpi method engineInitSign.
protected void engineInitSign(PrivateKey privateKey) throws InvalidKeyException {
CipherParameters param;
if (privateKey instanceof ECKey) {
param = ECUtil.generatePrivateKeyParameter(privateKey);
} else {
param = GOST3410Util.generatePrivateKeyParameter(privateKey);
}
digest.reset();
if (random != null) {
signer.init(true, new ParametersWithRandom(param, random));
} else {
signer.init(true, param);
}
}
Aggregations