allow other curves than NIST on security tokens
This commit is contained in:
@@ -30,7 +30,7 @@ import android.support.annotation.VisibleForTesting;
|
|||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
import javax.crypto.NoSuchPaddingException;
|
import javax.crypto.NoSuchPaddingException;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
import org.bouncycastle.asn1.nist.NISTNamedCurves;
|
import org.bouncycastle.asn1.x9.ECNamedCurveTable;
|
||||||
import org.bouncycastle.asn1.x9.X9ECParameters;
|
import org.bouncycastle.asn1.x9.X9ECParameters;
|
||||||
import org.bouncycastle.crypto.ec.CustomNamedCurves;
|
import org.bouncycastle.crypto.ec.CustomNamedCurves;
|
||||||
import org.bouncycastle.jcajce.util.MessageDigestUtils;
|
import org.bouncycastle.jcajce.util.MessageDigestUtils;
|
||||||
@@ -197,7 +197,7 @@ public class PsoDecryptTokenOp {
|
|||||||
if (CustomNamedCurves.CV25519.equals(eckf.getCurveOID())) {
|
if (CustomNamedCurves.CV25519.equals(eckf.getCurveOID())) {
|
||||||
return Arrays.copyOfRange(encryptedPoint, 1, 33);
|
return Arrays.copyOfRange(encryptedPoint, 1, 33);
|
||||||
} else {
|
} else {
|
||||||
X9ECParameters x9Params = NISTNamedCurves.getByOID(eckf.getCurveOID());
|
X9ECParameters x9Params = ECNamedCurveTable.getByOID(eckf.getCurveOID());
|
||||||
ECPoint p = x9Params.getCurve().decodePoint(encryptedPoint);
|
ECPoint p = x9Params.getCurve().decodePoint(encryptedPoint);
|
||||||
if (!p.isValid()) {
|
if (!p.isValid()) {
|
||||||
throw new CardException("Invalid EC point!");
|
throw new CardException("Invalid EC point!");
|
||||||
|
|||||||
Reference in New Issue
Block a user