mirror of https://github.com/grpc/grpc-java.git
xds: not to use insecure DSA crypto
Although DSA is only used in tests so it's totally no security concern, it's annoying we need some workaround for internal checks to import. So removing the usage.
This commit is contained in:
parent
f8bd84c755
commit
b8fe968c88
|
|
@ -38,7 +38,6 @@ import java.security.KeyFactory;
|
||||||
import java.security.PrivateKey;
|
import java.security.PrivateKey;
|
||||||
import java.security.cert.CertificateException;
|
import java.security.cert.CertificateException;
|
||||||
import java.security.cert.X509Certificate;
|
import java.security.cert.X509Certificate;
|
||||||
import java.security.spec.InvalidKeySpecException;
|
|
||||||
import java.security.spec.PKCS8EncodedKeySpec;
|
import java.security.spec.PKCS8EncodedKeySpec;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
@ -103,19 +102,7 @@ public class CommonCertProviderTestUtils {
|
||||||
byte[] encodedKey = new byte[encodedKeyBuf.readableBytes()];
|
byte[] encodedKey = new byte[encodedKeyBuf.readableBytes()];
|
||||||
encodedKeyBuf.readBytes(encodedKey).release();
|
encodedKeyBuf.readBytes(encodedKey).release();
|
||||||
PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(encodedKey);
|
PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(encodedKey);
|
||||||
try {
|
return KeyFactory.getInstance("RSA").generatePrivate(spec);
|
||||||
return KeyFactory.getInstance("RSA").generatePrivate(spec);
|
|
||||||
} catch (InvalidKeySpecException ignore) {
|
|
||||||
try {
|
|
||||||
return KeyFactory.getInstance("DSA").generatePrivate(spec);
|
|
||||||
} catch (InvalidKeySpecException ignore2) {
|
|
||||||
try {
|
|
||||||
return KeyFactory.getInstance("EC").generatePrivate(spec);
|
|
||||||
} catch (InvalidKeySpecException e) {
|
|
||||||
throw new InvalidKeySpecException("Neither RSA, DSA nor EC worked", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ByteBuf readPrivateKey(InputStream in) throws KeyException {
|
static ByteBuf readPrivateKey(InputStream in) throws KeyException {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue