use of org.openecard.bouncycastle.math.ec.ECCurve in project open-ecard by ecsec.
the class ExplicitDomainParameters method loadECDHParameter.
private void loadECDHParameter(ASN1Sequence seq) {
// ASN1Integer version = (ASN1Integer) seq.getObjectAt(0);
// ASN1Sequence modulus = (ASN1Sequence) seq.getObjectAt(1);
// ASN1Sequence coefficient = (ASN1Sequence) seq.getObjectAt(2);
// ASN1OctetString basepoint = (ASN1OctetString) seq.getObjectAt(3);
ASN1Integer order = (ASN1Integer) seq.getObjectAt(4);
ASN1Integer cofactor = (ASN1Integer) seq.getObjectAt(5);
try {
// BigInteger p = new BigInteger(modulus.getObjectAt(1).toASN1Primitive().getEncoded());
// BigInteger a = new BigInteger(coefficient.getObjectAt(0).toASN1Primitive().getEncoded());
// BigInteger b = new BigInteger(coefficient.getObjectAt(1).toASN1Primitive().getEncoded());
BigInteger r = order.getValue();
BigInteger f = cofactor.getValue();
X9ECParameters ECParameters = X9ECParameters.getInstance(seq);
ECCurve curve = ECParameters.getCurve();
domainParameter = new ECParameterSpec(curve, ECParameters.getG(), r, f);
} catch (Exception e) {
_logger.error("Failed to load proprietary domain parameters", e);
}
}
Aggregations