SelfSignedGenerator: improve previous fix

This commit is contained in:
zzz
2019-03-27 12:26:05 +00:00
parent 64039ee3c2
commit 7bb7677604

View File

@ -249,7 +249,8 @@ public final class SelfSignedGenerator {
cert.verify(cpub); cert.verify(cpub);
if (!cpub.equals(jpub)) { if (!cpub.equals(jpub)) {
boolean ok = false; boolean ok = false;
if (cpub.getClass().getName().equals("sun.security.x509.X509Key")) { if ((jpub instanceof EdDSAPublicKey) &&
cpub.getClass().getName().equals("sun.security.x509.X509Key")) {
// X509Certificate will sometimes contain an X509Key rather than the EdDSAPublicKey itself; the contained // 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. // key is valid but needs to be instanced as an EdDSAPublicKey before it can be used.
try { try {