forked from pool/ed25519-java
38 lines
1.7 KiB
Diff
38 lines
1.7 KiB
Diff
From c5629faa3e1880cc71da506263f224bc818fe827 Mon Sep 17 00:00:00 2001
|
|
From: Jack Grigg <thestr4d@gmail.com>
|
|
Date: Sun, 27 Jan 2019 23:27:00 +0000
|
|
Subject: [PATCH 1/2] EdDSAEngine.initVerify(): Handle any non-EdDSAPublicKey
|
|
X.509-encoded pubkey
|
|
|
|
sun.security.x509.X509Key is a JDK-internal API, and should not be used
|
|
directly. Instead of looking for an instance of that class, we check the
|
|
primary encoding format of the PublicKey, and proceed if it is "X.509".
|
|
---
|
|
src/net/i2p/crypto/eddsa/EdDSAEngine.java | 3 +--
|
|
1 file changed, 1 insertion(+), 2 deletions(-)
|
|
|
|
diff --git a/src/net/i2p/crypto/eddsa/EdDSAEngine.java b/src/net/i2p/crypto/eddsa/EdDSAEngine.java
|
|
index 1f0ba6d..6b25410 100644
|
|
--- a/src/net/i2p/crypto/eddsa/EdDSAEngine.java
|
|
+++ b/src/net/i2p/crypto/eddsa/EdDSAEngine.java
|
|
@@ -29,7 +29,6 @@ import java.util.Arrays;
|
|
import net.i2p.crypto.eddsa.math.Curve;
|
|
import net.i2p.crypto.eddsa.math.GroupElement;
|
|
import net.i2p.crypto.eddsa.math.ScalarOps;
|
|
-import sun.security.x509.X509Key;
|
|
|
|
/**
|
|
* Signing and verification for EdDSA.
|
|
@@ -157,7 +156,7 @@ public final class EdDSAEngine extends Signature {
|
|
}
|
|
} else if (!key.getParams().getHashAlgorithm().equals(digest.getAlgorithm()))
|
|
throw new InvalidKeyException("Key hash algorithm does not match chosen digest");
|
|
- } else if (publicKey instanceof X509Key) {
|
|
+ } else if (publicKey.getFormat().equals("X.509")) {
|
|
// X509Certificate will sometimes contain an X509Key rather than the EdDSAPublicKey itself; the contained
|
|
// key is valid but needs to be instanced as an EdDSAPublicKey before it can be used.
|
|
EdDSAPublicKey parsedPublicKey;
|
|
--
|
|
2.33.1
|
|
|