Skip to content

Commit

Permalink
core: remove DSA check in CertificateUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhenLian authored Oct 19, 2021
1 parent 1f90e0e commit d2b9151
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions core/src/main/java/io/grpc/util/CertificateUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ public static X509Certificate[] getX509Certificates(InputStream inputStream)

/**
* Generates a {@link PrivateKey} from a PEM file.
* The key should be PKCS #8 formatted. The key algorithm should be "RSA", "DiffieHellman",
* "DSA", or "EC".
* The key should be PKCS #8 formatted. The key algorithm should be "RSA" or "EC".
* The PEM file should contain one item in Base64 encoding, with plain-text headers and footers
* (e.g. -----BEGIN PRIVATE KEY----- and -----END PRIVATE KEY-----).
*
Expand Down Expand Up @@ -86,13 +85,9 @@ public static PrivateKey getPrivateKey(InputStream inputStream)
return KeyFactory.getInstance("RSA").generatePrivate(keySpec);
} catch (InvalidKeySpecException ignore) {
try {
return KeyFactory.getInstance("DSA").generatePrivate(keySpec);
} catch (InvalidKeySpecException ignore2) {
try {
return KeyFactory.getInstance("EC").generatePrivate(keySpec);
} catch (InvalidKeySpecException e) {
throw new InvalidKeySpecException("Neither RSA, DSA nor EC worked", e);
}
return KeyFactory.getInstance("EC").generatePrivate(keySpec);
} catch (InvalidKeySpecException e) {
throw new InvalidKeySpecException("Neither RSA nor EC worked", e);
}
}
}
Expand Down

0 comments on commit d2b9151

Please sign in to comment.