mirror of https://github.com/apache/lucene.git
SOLR-14223 Fix tests for windows
This commit is contained in:
parent
46bda6bea0
commit
dd9b9f2f7f
|
@ -363,10 +363,9 @@ public final class CryptoKeys {
|
||||||
public RSAKeyPair(URL privateKeyResourceName, URL publicKeyResourceName) throws IOException, InvalidKeySpecException {
|
public RSAKeyPair(URL privateKeyResourceName, URL publicKeyResourceName) throws IOException, InvalidKeySpecException {
|
||||||
try (InputStream inPrivate = privateKeyResourceName.openStream()) {
|
try (InputStream inPrivate = privateKeyResourceName.openStream()) {
|
||||||
String privateString = new String(inPrivate.readAllBytes(), StandardCharsets.UTF_8)
|
String privateString = new String(inPrivate.readAllBytes(), StandardCharsets.UTF_8)
|
||||||
.replaceAll("-----[A-Z ]*-----", "")
|
.replaceAll("-----(BEGIN|END) PRIVATE KEY-----", "");
|
||||||
.replaceAll("\\n", "");
|
|
||||||
|
|
||||||
PKCS8EncodedKeySpec privateSpec = new PKCS8EncodedKeySpec(Base64.base64ToByteArray(privateString));
|
PKCS8EncodedKeySpec privateSpec = new PKCS8EncodedKeySpec(java.util.Base64.getMimeDecoder().decode(privateString));
|
||||||
KeyFactory rsaFactory = KeyFactory.getInstance("RSA");
|
KeyFactory rsaFactory = KeyFactory.getInstance("RSA");
|
||||||
privateKey = rsaFactory.generatePrivate(privateSpec);
|
privateKey = rsaFactory.generatePrivate(privateSpec);
|
||||||
} catch (NoSuchAlgorithmException e) {
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
|
Loading…
Reference in New Issue