From 408fb8ae9d8ad6bfbbfc0d968a4f80bec2edf20b Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Fri, 15 Sep 2023 12:18:40 +0200 Subject: [PATCH] Add support for EdDSA, XDH and RSA-PSS key parsing This works with Java 17 and up. Also refactor the test for more structure. Closes gh-37237 --- .../platform/docker/ssl/PrivateKeyParser.java | 43 +++-- .../boot/web/server/PrivateKeyParser.java | 43 +++-- .../web/server/PrivateKeyParserTests.java | 162 +++++++++++++++--- .../boot/web/server/pkcs1/dsa.key | 12 ++ .../boot/web/server/pkcs1/rsa.key | 51 ++++++ .../boot/web/server/pkcs8/brainpoolP256r1.key | 5 + .../boot/web/server/pkcs8/brainpoolP256t1.key | 5 + .../boot/web/server/pkcs8/brainpoolP320r1.key | 6 + .../boot/web/server/pkcs8/brainpoolP320t1.key | 6 + .../boot/web/server/pkcs8/brainpoolP384r1.key | 6 + .../boot/web/server/pkcs8/brainpoolP384t1.key | 6 + .../boot/web/server/pkcs8/brainpoolP512r1.key | 7 + .../boot/web/server/pkcs8/brainpoolP512t1.key | 7 + .../boot/web/server/pkcs8/dsa.key | 21 +++ .../boot/web/server/pkcs8/ed25519.key | 3 + .../boot/web/server/pkcs8/ed448.key | 4 + .../boot/web/server/pkcs8/prime256v1.key | 5 + .../boot/web/server/pkcs8/rsa-pss.key | 28 +++ .../boot/web/server/pkcs8/rsa.key | 52 ++++++ .../boot/web/server/pkcs8/secp224r1.key | 5 + .../boot/web/server/pkcs8/secp256k1.key | 5 + .../boot/web/server/pkcs8/secp256r1.key | 5 + .../boot/web/server/pkcs8/secp384r1.key | 6 + .../boot/web/server/pkcs8/secp521r1.key | 8 + .../boot/web/server/pkcs8/x25519.key | 3 + .../boot/web/server/pkcs8/x448.key | 4 + .../boot/web/server/sec1/brainpoolP256r1.key | 5 + .../boot/web/server/sec1/brainpoolP256t1.key | 5 + .../boot/web/server/sec1/brainpoolP320r1.key | 6 + .../boot/web/server/sec1/brainpoolP320t1.key | 6 + .../boot/web/server/sec1/brainpoolP384r1.key | 6 + .../boot/web/server/sec1/brainpoolP384t1.key | 6 + .../boot/web/server/sec1/brainpoolP512r1.key | 7 + .../boot/web/server/sec1/brainpoolP512t1.key | 7 + .../boot/web/server/sec1/prime256v1.key | 5 + .../boot/web/server/sec1/secp224r1.key | 5 + .../boot/web/server/sec1/secp256k1.key | 5 + .../boot/web/server/sec1/secp256r1.key | 5 + .../boot/web/server/sec1/secp384r1.key | 6 + .../boot/web/server/sec1/secp521r1.key | 7 + .../boot/web/server/sec1/to_pkcs8.sh | 14 ++ .../test/resources/test-ec-key-prime256v1.pem | 5 - .../src/test/resources/test-ec-key.pem | 6 - 43 files changed, 536 insertions(+), 78 deletions(-) create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs1/dsa.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs1/rsa.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP256r1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP256t1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP320r1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP320t1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP384r1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP384t1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP512r1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP512t1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/dsa.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/ed25519.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/ed448.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/prime256v1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/rsa-pss.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/rsa.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/secp224r1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/secp256k1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/secp256r1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/secp384r1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/secp521r1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/x25519.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/x448.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP256r1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP256t1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP320r1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP320t1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP384r1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP384t1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP512r1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP512t1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/prime256v1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/secp224r1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/secp256k1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/secp256r1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/secp384r1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/secp521r1.key create mode 100644 spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/to_pkcs8.sh delete mode 100644 spring-boot-project/spring-boot/src/test/resources/test-ec-key-prime256v1.pem delete mode 100644 spring-boot-project/spring-boot/src/test/resources/test-ec-key.pem diff --git a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/ssl/PrivateKeyParser.java b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/ssl/PrivateKeyParser.java index 5eb68ef9d90d..a527c6acb4b2 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/ssl/PrivateKeyParser.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/ssl/PrivateKeyParser.java @@ -22,8 +22,8 @@ import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; -import java.security.GeneralSecurityException; import java.security.KeyFactory; +import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; @@ -48,26 +48,28 @@ */ final class PrivateKeyParser { - private static final String PKCS1_HEADER = "-+BEGIN\\s+RSA\\s+PRIVATE\\s+KEY[^-]*-+(?:\\s|\\r|\\n)+"; + private static final String PKCS1_RSA_HEADER = "-+BEGIN\\s+RSA\\s+PRIVATE\\s+KEY[^-]*-+(?:\\s|\\r|\\n)+"; - private static final String PKCS1_FOOTER = "-+END\\s+RSA\\s+PRIVATE\\s+KEY[^-]*-+"; + private static final String PKCS1_RSA_FOOTER = "-+END\\s+RSA\\s+PRIVATE\\s+KEY[^-]*-+"; private static final String PKCS8_HEADER = "-+BEGIN\\s+PRIVATE\\s+KEY[^-]*-+(?:\\s|\\r|\\n)+"; private static final String PKCS8_FOOTER = "-+END\\s+PRIVATE\\s+KEY[^-]*-+"; - private static final String EC_HEADER = "-+BEGIN\\s+EC\\s+PRIVATE\\s+KEY[^-]*-+(?:\\s|\\r|\\n)+"; + private static final String SEC1_EC_HEADER = "-+BEGIN\\s+EC\\s+PRIVATE\\s+KEY[^-]*-+(?:\\s|\\r|\\n)+"; - private static final String EC_FOOTER = "-+END\\s+EC\\s+PRIVATE\\s+KEY[^-]*-+"; + private static final String SEC1_EC_FOOTER = "-+END\\s+EC\\s+PRIVATE\\s+KEY[^-]*-+"; private static final String BASE64_TEXT = "([a-z0-9+/=\\r\\n]+)"; private static final List PEM_PARSERS; static { List parsers = new ArrayList<>(); - parsers.add(new PemParser(PKCS1_HEADER, PKCS1_FOOTER, PrivateKeyParser::createKeySpecForPkcs1, "RSA")); - parsers.add(new PemParser(EC_HEADER, EC_FOOTER, PrivateKeyParser::createKeySpecForEc, "EC")); - parsers.add(new PemParser(PKCS8_HEADER, PKCS8_FOOTER, PKCS8EncodedKeySpec::new, "RSA", "EC", "DSA")); + parsers + .add(new PemParser(PKCS1_RSA_HEADER, PKCS1_RSA_FOOTER, PrivateKeyParser::createKeySpecForPkcs1Rsa, "RSA")); + parsers.add(new PemParser(SEC1_EC_HEADER, SEC1_EC_FOOTER, PrivateKeyParser::createKeySpecForSec1Ec, "EC")); + parsers.add(new PemParser(PKCS8_HEADER, PKCS8_FOOTER, PKCS8EncodedKeySpec::new, "RSA", "RSASSA-PSS", "EC", + "DSA", "EdDSA", "XDH")); PEM_PARSERS = Collections.unmodifiableList(parsers); } @@ -89,11 +91,11 @@ final class PrivateKeyParser { private PrivateKeyParser() { } - private static PKCS8EncodedKeySpec createKeySpecForPkcs1(byte[] bytes) { + private static PKCS8EncodedKeySpec createKeySpecForPkcs1Rsa(byte[] bytes) { return createKeySpecForAlgorithm(bytes, RSA_ALGORITHM, null); } - private static PKCS8EncodedKeySpec createKeySpecForEc(byte[] bytes) { + private static PKCS8EncodedKeySpec createKeySpecForSec1Ec(byte[] bytes) { DerElement ecPrivateKey = DerElement.of(bytes); Assert.state(ecPrivateKey.isType(ValueType.ENCODED, TagType.SEQUENCE), "Key spec should be an ASN.1 encoded sequence"); @@ -200,21 +202,16 @@ private static byte[] decodeBase64(String content) { } private PrivateKey parse(byte[] bytes) { - try { - PKCS8EncodedKeySpec keySpec = this.keySpecFactory.apply(bytes); - for (String algorithm : this.algorithms) { + PKCS8EncodedKeySpec keySpec = this.keySpecFactory.apply(bytes); + for (String algorithm : this.algorithms) { + try { KeyFactory keyFactory = KeyFactory.getInstance(algorithm); - try { - return keyFactory.generatePrivate(keySpec); - } - catch (InvalidKeySpecException ex) { - } + return keyFactory.generatePrivate(keySpec); + } + catch (InvalidKeySpecException | NoSuchAlgorithmException ex) { } - return null; - } - catch (GeneralSecurityException ex) { - throw new IllegalArgumentException("Unexpected key format", ex); } + return null; } } @@ -302,7 +299,7 @@ static final class DerElement { private final long tagType; - private ByteBuffer contents; + private final ByteBuffer contents; private DerElement(ByteBuffer bytes) { byte b = bytes.get(); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/PrivateKeyParser.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/PrivateKeyParser.java index 62c5c565b5c0..2fb09ad69332 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/PrivateKeyParser.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/web/server/PrivateKeyParser.java @@ -22,8 +22,8 @@ import java.io.Reader; import java.net.URL; import java.nio.ByteBuffer; -import java.security.GeneralSecurityException; import java.security.KeyFactory; +import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; @@ -50,26 +50,28 @@ */ final class PrivateKeyParser { - private static final String PKCS1_HEADER = "-+BEGIN\\s+RSA\\s+PRIVATE\\s+KEY[^-]*-+(?:\\s|\\r|\\n)+"; + private static final String PKCS1_RSA_HEADER = "-+BEGIN\\s+RSA\\s+PRIVATE\\s+KEY[^-]*-+(?:\\s|\\r|\\n)+"; - private static final String PKCS1_FOOTER = "-+END\\s+RSA\\s+PRIVATE\\s+KEY[^-]*-+"; + private static final String PKCS1_RSA_FOOTER = "-+END\\s+RSA\\s+PRIVATE\\s+KEY[^-]*-+"; private static final String PKCS8_HEADER = "-+BEGIN\\s+PRIVATE\\s+KEY[^-]*-+(?:\\s|\\r|\\n)+"; private static final String PKCS8_FOOTER = "-+END\\s+PRIVATE\\s+KEY[^-]*-+"; - private static final String EC_HEADER = "-+BEGIN\\s+EC\\s+PRIVATE\\s+KEY[^-]*-+(?:\\s|\\r|\\n)+"; + private static final String SEC1_EC_HEADER = "-+BEGIN\\s+EC\\s+PRIVATE\\s+KEY[^-]*-+(?:\\s|\\r|\\n)+"; - private static final String EC_FOOTER = "-+END\\s+EC\\s+PRIVATE\\s+KEY[^-]*-+"; + private static final String SEC1_EC_FOOTER = "-+END\\s+EC\\s+PRIVATE\\s+KEY[^-]*-+"; private static final String BASE64_TEXT = "([a-z0-9+/=\\r\\n]+)"; private static final List PEM_PARSERS; static { List parsers = new ArrayList<>(); - parsers.add(new PemParser(PKCS1_HEADER, PKCS1_FOOTER, PrivateKeyParser::createKeySpecForPkcs1, "RSA")); - parsers.add(new PemParser(EC_HEADER, EC_FOOTER, PrivateKeyParser::createKeySpecForEc, "EC")); - parsers.add(new PemParser(PKCS8_HEADER, PKCS8_FOOTER, PKCS8EncodedKeySpec::new, "RSA", "EC", "DSA")); + parsers + .add(new PemParser(PKCS1_RSA_HEADER, PKCS1_RSA_FOOTER, PrivateKeyParser::createKeySpecForPkcs1Rsa, "RSA")); + parsers.add(new PemParser(SEC1_EC_HEADER, SEC1_EC_FOOTER, PrivateKeyParser::createKeySpecForSec1Ec, "EC")); + parsers.add(new PemParser(PKCS8_HEADER, PKCS8_FOOTER, PKCS8EncodedKeySpec::new, "RSA", "RSASSA-PSS", "EC", + "DSA", "EdDSA", "XDH")); PEM_PARSERS = Collections.unmodifiableList(parsers); } @@ -91,11 +93,11 @@ final class PrivateKeyParser { private PrivateKeyParser() { } - private static PKCS8EncodedKeySpec createKeySpecForPkcs1(byte[] bytes) { + private static PKCS8EncodedKeySpec createKeySpecForPkcs1Rsa(byte[] bytes) { return createKeySpecForAlgorithm(bytes, RSA_ALGORITHM, null); } - private static PKCS8EncodedKeySpec createKeySpecForEc(byte[] bytes) { + private static PKCS8EncodedKeySpec createKeySpecForSec1Ec(byte[] bytes) { DerElement ecPrivateKey = DerElement.of(bytes); Assert.state(ecPrivateKey.isType(ValueType.ENCODED, TagType.SEQUENCE), "Key spec should be an ASN.1 encoded sequence"); @@ -203,21 +205,16 @@ private static byte[] decodeBase64(String content) { } private PrivateKey parse(byte[] bytes) { - try { - PKCS8EncodedKeySpec keySpec = this.keySpecFactory.apply(bytes); - for (String algorithm : this.algorithms) { + PKCS8EncodedKeySpec keySpec = this.keySpecFactory.apply(bytes); + for (String algorithm : this.algorithms) { + try { KeyFactory keyFactory = KeyFactory.getInstance(algorithm); - try { - return keyFactory.generatePrivate(keySpec); - } - catch (InvalidKeySpecException ex) { - } + return keyFactory.generatePrivate(keySpec); + } + catch (InvalidKeySpecException | NoSuchAlgorithmException ex) { } - return null; - } - catch (GeneralSecurityException ex) { - throw new IllegalArgumentException("Unexpected key format", ex); } + return null; } } @@ -305,7 +302,7 @@ static final class DerElement { private final long tagType; - private ByteBuffer contents; + private final ByteBuffer contents; private DerElement(ByteBuffer bytes) { byte b = bytes.get(); diff --git a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/PrivateKeyParserTests.java b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/PrivateKeyParserTests.java index 09d141d9216d..a01dec665e2f 100644 --- a/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/PrivateKeyParserTests.java +++ b/spring-boot-project/spring-boot/src/test/java/org/springframework/boot/web/server/PrivateKeyParserTests.java @@ -20,11 +20,15 @@ import java.security.interfaces.ECPrivateKey; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledForJreRange; +import org.junit.jupiter.api.condition.JRE; import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.CsvSource; import org.junit.jupiter.params.provider.ValueSource; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatIllegalStateException; +import static org.assertj.core.api.Assertions.assertThatThrownBy; /** * Tests for {@link PrivateKeyParser}. @@ -33,50 +37,166 @@ * @author Moritz Halbritter * @author Phillip Webb */ +// https://docs.oracle.com/en/java/javase/17/security/oracle-providers.html#GUID-091BF58C-82AB-4C9C-850F-1660824D5254 class PrivateKeyParserTests { - @Test - void parsePkcs8RsaKeyFile() { - PrivateKey privateKey = PrivateKeyParser.parse("classpath:ssl/pkcs8/key-rsa.pem"); + @ParameterizedTest + // @formatter:off + @CsvSource({ + "dsa.key, DSA", + "rsa.key, RSA", + "rsa-pss.key, RSASSA-PSS" + }) + // @formatter:on + void shouldParseTraditionalPkcs8(String file, String algorithm) { + PrivateKey privateKey = PrivateKeyParser.parse("classpath:org/springframework/boot/web/server/pkcs8/" + file); + assertThat(privateKey).isNotNull(); + assertThat(privateKey.getFormat()).isEqualTo("PKCS#8"); + assertThat(privateKey.getAlgorithm()).isEqualTo(algorithm); + } + + @ParameterizedTest + // @formatter:off + @CsvSource({ + "rsa.key, RSA" + }) + // @formatter:on + void shouldParseTraditionalPkcs1(String file, String algorithm) { + PrivateKey privateKey = PrivateKeyParser.parse("classpath:org/springframework/boot/web/server/pkcs1/" + file); assertThat(privateKey).isNotNull(); assertThat(privateKey.getFormat()).isEqualTo("PKCS#8"); - assertThat(privateKey.getAlgorithm()).isEqualTo("RSA"); + assertThat(privateKey.getAlgorithm()).isEqualTo(algorithm); + } + + @ParameterizedTest + // @formatter:off + @ValueSource(strings = { + "dsa.key" + }) + // @formatter:on + void shouldNotParseUnsupportedTraditionalPkcs1(String file) { + assertThatThrownBy(() -> PrivateKeyParser.parse("classpath:org/springframework/boot/web/server/pkcs1/" + file)) + .isInstanceOf(IllegalStateException.class) + .hasMessageContaining("Error loading private key file") + .hasCauseInstanceOf(IllegalStateException.class) + .getCause() + .hasMessageContaining("Unrecognized private key format"); } @ParameterizedTest - @ValueSource(strings = { "key-ec-nist-p256.pem", "key-ec-nist-p384.pem", "key-ec-prime256v1.pem", - "key-ec-secp256r1.pem" }) - void parsePkcs8EcKeyFile(String fileName) { - PrivateKey privateKey = PrivateKeyParser.parse("classpath:ssl/pkcs8/" + fileName); + // @formatter:off + @CsvSource({ + "brainpoolP256r1.key, brainpoolP256r1, 1.3.36.3.3.2.8.1.1.7", + "brainpoolP320r1.key, brainpoolP320r1, 1.3.36.3.3.2.8.1.1.9", + "brainpoolP384r1.key, brainpoolP384r1, 1.3.36.3.3.2.8.1.1.11", + "brainpoolP512r1.key, brainpoolP512r1, 1.3.36.3.3.2.8.1.1.13", + "prime256v1.key, secp256r1, 1.2.840.10045.3.1.7", + "secp224r1.key, secp224r1, 1.3.132.0.33", + "secp256k1.key, secp256k1, 1.3.132.0.10", + "secp256r1.key, secp256r1, 1.2.840.10045.3.1.7", + "secp384r1.key, secp384r1, 1.3.132.0.34", + "secp521r1.key, secp521r1, 1.3.132.0.35" + }) + // @formatter:on + void shouldParseEcPkcs8(String file, String curveName, String oid) { + PrivateKey privateKey = PrivateKeyParser.parse("classpath:org/springframework/boot/web/server/pkcs8/" + file); assertThat(privateKey).isNotNull(); assertThat(privateKey.getFormat()).isEqualTo("PKCS#8"); assertThat(privateKey.getAlgorithm()).isEqualTo("EC"); + assertThat(privateKey).isInstanceOf(ECPrivateKey.class); + ECPrivateKey ecPrivateKey = (ECPrivateKey) privateKey; + assertThat(ecPrivateKey.getParams().toString()).contains(curveName).contains(oid); } - @Test - void parsePkcs8DsaKeyFile() { - PrivateKey privateKey = PrivateKeyParser.parse("classpath:ssl/pkcs8/key-dsa.pem"); + @ParameterizedTest + // @formatter:off + @ValueSource(strings = { + "brainpoolP256t1.key", + "brainpoolP320t1.key", + "brainpoolP384t1.key", + "brainpoolP512t1.key" + }) + // @formatter:on + void shouldNotParseUnsupportedEcPkcs8(String file) { + assertThatThrownBy(() -> PrivateKeyParser.parse("classpath:org/springframework/boot/web/server/pkcs8/" + file)) + .isInstanceOf(IllegalStateException.class) + .hasMessageContaining("Error loading private key file") + .hasCauseInstanceOf(IllegalStateException.class) + .getCause() + .hasMessageContaining("Unrecognized private key format"); + } + + @EnabledForJreRange(min = JRE.JAVA_17, disabledReason = "EdDSA is only supported since Java 17") + @ParameterizedTest + // @formatter:off + @ValueSource(strings = { + "ed448.key", + "ed25519.key" + }) + // @formatter:on + void shouldParseEdDsaPkcs8(String file) { + PrivateKey privateKey = PrivateKeyParser.parse("classpath:org/springframework/boot/web/server/pkcs8/" + file); assertThat(privateKey).isNotNull(); assertThat(privateKey.getFormat()).isEqualTo("PKCS#8"); - assertThat(privateKey.getAlgorithm()).isEqualTo("DSA"); + assertThat(privateKey.getAlgorithm()).isEqualTo("EdDSA"); } - @Test - void parsePemKeyFileWithEcdsa() { - ECPrivateKey privateKey = (ECPrivateKey) PrivateKeyParser.parse("classpath:test-ec-key.pem"); + @EnabledForJreRange(min = JRE.JAVA_17, disabledReason = "XDH is only supported since Java 17") + @ParameterizedTest + // @formatter:off + @ValueSource(strings = { + "x448.key", + "x25519.key" + }) + // @formatter:on + void shouldParseXdhPkcs8(String file) { + PrivateKey privateKey = PrivateKeyParser.parse("classpath:org/springframework/boot/web/server/pkcs8/" + file); assertThat(privateKey).isNotNull(); assertThat(privateKey.getFormat()).isEqualTo("PKCS#8"); - assertThat(privateKey.getAlgorithm()).isEqualTo("EC"); - assertThat(privateKey.getParams().toString()).contains("1.3.132.0.34").doesNotContain("prime256v1"); + assertThat(privateKey.getAlgorithm()).isEqualTo("XDH"); } - @Test - void parsePemKeyFileWithEcdsaPrime256v1() { - ECPrivateKey privateKey = (ECPrivateKey) PrivateKeyParser.parse("classpath:test-ec-key-prime256v1.pem"); + @ParameterizedTest + // @formatter:off + @CsvSource({ + "brainpoolP256r1.key, brainpoolP256r1, 1.3.36.3.3.2.8.1.1.7", + "brainpoolP320r1.key, brainpoolP320r1, 1.3.36.3.3.2.8.1.1.9", + "brainpoolP384r1.key, brainpoolP384r1, 1.3.36.3.3.2.8.1.1.11", + "brainpoolP512r1.key, brainpoolP512r1, 1.3.36.3.3.2.8.1.1.13", + "prime256v1.key, secp256r1, 1.2.840.10045.3.1.7", + "secp224r1.key, secp224r1, 1.3.132.0.33", + "secp256k1.key, secp256k1, 1.3.132.0.10", + "secp256r1.key, secp256r1, 1.2.840.10045.3.1.7", + "secp384r1.key, secp384r1, 1.3.132.0.34", + "secp521r1.key, secp521r1, 1.3.132.0.35" + }) + // @formatter:on + void shouldParseEcSec1(String file, String curveName, String oid) { + PrivateKey privateKey = PrivateKeyParser.parse("classpath:org/springframework/boot/web/server/sec1/" + file); assertThat(privateKey).isNotNull(); assertThat(privateKey.getFormat()).isEqualTo("PKCS#8"); assertThat(privateKey.getAlgorithm()).isEqualTo("EC"); - assertThat(privateKey.getParams().toString()).contains("prime256v1").doesNotContain("1.3.132.0.34"); + assertThat(privateKey).isInstanceOf(ECPrivateKey.class); + ECPrivateKey ecPrivateKey = (ECPrivateKey) privateKey; + assertThat(ecPrivateKey.getParams().toString()).contains(curveName).contains(oid); + } + + @ParameterizedTest + // @formatter:off + @ValueSource(strings = { + "brainpoolP256t1.key", + "brainpoolP320t1.key", + "brainpoolP384t1.key", + "brainpoolP512t1.key" + }) + // @formatter:on + void shouldNotParseUnsupportedEcSec1(String file) { + assertThatThrownBy(() -> PrivateKeyParser.parse("classpath:org/springframework/boot/web/server/sec1/" + file)) + .isInstanceOf(IllegalStateException.class) + .hasMessageContaining("Error loading private key file") + .hasCauseInstanceOf(IllegalStateException.class) + .getCause() + .hasMessageContaining("Unrecognized private key format"); } @Test diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs1/dsa.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs1/dsa.key new file mode 100644 index 000000000000..a30fec06f820 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs1/dsa.key @@ -0,0 +1,12 @@ +-----BEGIN DSA PRIVATE KEY----- +MIIBuwIBAAKBgQCDX+Ux7y7dkfCnQgRIXzAlFrG8uPxwFdC8J4FJNrAurnjL//PV +8LEHBDVbyPjHaoNbH8Pfc2pJnOzndWZVf0nqBd4Q/Tz9w/pJ9g6E8HOh+rzU3eK5 +mF0rezcMbJsot2Vdx6XrTztDKi2GY0etKNV399DYtepIYA6v5ovuYAOjLwIVAPyb +9zR+UjyCkBwESDm9dpzKsGp1AoGAS2vtTiO7/MT8cJwo4mxYtiJnV5R2mk1JJOTe +4AFPgmnce/YbBzU2JwL9J9HGewDkmxudW0zoxZVeNw4dRua6oB5STV8XciW8vSo6 +mdDBJFoBW9/DUscRP4j2aRfkXGlYuiEF6ZT8g6pPHZG7pLviihMAWNRVLmBt38wa +8FA9aZECgYADbfwh7OhSE1J0WRaEk/4Usos5Oi6fhUyqr2u34Ereug9Gt4tkhePa +b3y31i2PQfsatpR+4VpBC6zpPgHQYpuqlqDRWJCd+Cxo9751nOiA3xYVxNoiwIn/ +WxoUkC8Jv8kYFAJRceXkF/auVh77MUoruAmoT2lGE6zP6ngP2q6jFwIVAJMF5kZ+ +AUZbUBUpZaPuZ15RL8GF +-----END DSA PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs1/rsa.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs1/rsa.key new file mode 100644 index 000000000000..cf847bcbac64 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs1/rsa.key @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKAIBAAKCAgEA1zZsVLbl+bOl2QlFZ5R5hbJrR5u+G3Ddd/f25JWwno9tfRik ++39KrIHJKwxq/TH1d0WjfOuvFBz5Ucnh86NOSnffz7kxLgP8QcjQkwuVTjDj4lTp +sJpi/U1npAZ6Eu1/KeC3R2u8qqvYG3U3G6cQYw5Y+0wHf5EYlIvKfx5oVEEf67pz +7q2TffqoOV7PQHyHt+/BKFJI1ehj8W/2uQJJ9UTmGvixAYLZ6gHLmtEUj1cBZUb1 +5X/lVbbsiL8B2prbuPoJWYcppH8L2cqSq4JP43Y2VR3CtrQH9MBbLxBfPVnzuD1j +X1J++xMMN7NCRpBNI/xoJNxvxO+3RgNbkhz4f8WhJbuCwaoNJStytq2fcqOfT3t7 +lW10Gj67joMJZtIsW7JPquFGW6RNq7YqMCJ9ML8Vv9B9UJcUEeE+a+IX6epJBQK6 +1KC6TIe4SB+xl1Vu1xosuAyvni2H7QDjbiZvE8WX2apKk7fv81Epi+9J5Dn4zMpk +Z5GG1/itA+rZSCWCs8c3lbGq0olZMsXNNhbNZOqiih3yeaMw/B/3v/XMn98rliMl +C8VOX92eKKBJTX/CjMuSU48mxNE8lQJaDcfld9JE6ndmiZWe7BpXEF8wYtL/NObI +xZXfcLDsEHopPpU9gaRDZmtL2aUweliF3WIIUmoo/C3kR7ZOSJ5fC66a+yECAwEA +AQKCAgAhLFxqen7cjJqF5+3w12wb9bKfqRwWssEQmwJNnd1Js6YW4FOeCLMEAEV4 +A0QCn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GLKvJArMw4IcF29JOkpuR3GiuigfYgQ0JgYw7fZwc24eesKwopDWutUexo0Tlc +ef2CmgR/+rymyEknpX8xT5ExYaNz8odguNjRqSohM63p2UXkdi5CLYpu0q28iY59 +0s+3LAwsLPeZirR8TZ0NgirMMAIrILsCYmP78OGV6stOEUj1oUPIu6Txa/Z20saA +b6z079eXrl1voiiRyJ0h7tHL9VEQA62dICHY9BY1I7H9ZL+Fi1Af5jfXGSs= +-----END RSA PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP256r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP256r1.key new file mode 100644 index 000000000000..d17b664d739e --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP256r1.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGIAgEAMBQGByqGSM49AgEGCSskAwMCCAEBBwRtMGsCAQEEIBfCkWEWyc2tHIvS +Ao6hhcj09dnh8NOmtZeqGmcXHnIqoUQDQgAElux3elmSzb/WqEZXb1vdXx/tcIpC +Yq2vewG8H1SikMoACeFVRcjuy31gJ4Q8M7UQmrR4+WXSptV/UQ6Gkt3XuQ== +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP256t1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP256t1.key new file mode 100644 index 000000000000..25bca43c321f --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP256t1.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGIAgEAMBQGByqGSM49AgEGCSskAwMCCAEBCARtMGsCAQEEIILhgc3joEZDWMDm +9TYgrENN7gbqtMpMw1e2MTLwlJhCoUQDQgAEiDN20JP8O9zSK46tP6MkXJPNAfyN +IQ0hOgcQ//Fw5V0yiSU+BPGeDoIDsW8LnElS1hIZWq0JVQNZge5ei2bshQ== +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP320r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP320r1.key new file mode 100644 index 000000000000..e1bd06c2793b --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP320r1.key @@ -0,0 +1,6 @@ +-----BEGIN PRIVATE KEY----- +MIGiAgEAMBQGByqGSM49AgEGCSskAwMCCAEBCQSBhjCBgwIBAQQoNifTnb4a5dOR +yr8QFVM7Zkw/f/AMm5T5PQ6iVTCzrnw/kZ8glwl+JKFUA1IABHSnWUC/tKXpNHGE +P89QVKEgvetwCQWFoOENAgXORniLiaLdAdsR80ouTsZiFgHG9su0l5ESEnFWQr5x +UMj/vPwwhSYm+YP5ucx5NezuBM4d +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP320t1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP320t1.key new file mode 100644 index 000000000000..5d89229f12f2 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP320t1.key @@ -0,0 +1,6 @@ +-----BEGIN PRIVATE KEY----- +MIGiAgEAMBQGByqGSM49AgEGCSskAwMCCAEBCgSBhjCBgwIBAQQotGnirBX69ezE +7a9yIBQcqeCMm7hc5YAG8D4396ytBa/2/O/lonDlOqFUA1IABDQHDepa3l/S8Gt9 +WrNCNpCPZNBXvmkGPnVXZchZI5BtUySwYxHX1tpatGs3jY7drVYm+NyxZE81pecY +TvXR8bu7e3BIp2SwZmXEDxdYp1fw +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP384r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP384r1.key new file mode 100644 index 000000000000..c248a0f0d448 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP384r1.key @@ -0,0 +1,6 @@ +-----BEGIN PRIVATE KEY----- +MIG6AgEAMBQGByqGSM49AgEGCSskAwMCCAEBCwSBnjCBmwIBAQQwK6y6NydLMTNm +LhDNPyTDKEemTWTUuMGfBQxEz+lQKAqz/So4uA+fQzor/t8to+uioWQDYgAEaK8X +3KCyRDMpbACw2xG4UUe9OxyuGWFaGKPxhKJDyW5Z56gT5P1Q2y4CblL/X9VcDIMX +dcQqRNBkPQfy1+fJXwKO0ClfD6MIE3bv6PTZ55J6H2H1dpg38a2soRchz0FN +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP384t1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP384t1.key new file mode 100644 index 000000000000..13a4e0c7b032 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP384t1.key @@ -0,0 +1,6 @@ +-----BEGIN PRIVATE KEY----- +MIG6AgEAMBQGByqGSM49AgEGCSskAwMCCAEBDASBnjCBmwIBAQQwBGUaEvTtnxm8 +fOWj2c2cX4991rvGmfGviuWWQRblSii/v9FG4nQ4Q2IrgBy+hgK9oWQDYgAEQL0d +QoOTArIx70V/XxipoxxBeKT7zmIe7id5pQiw4O4nA2S2BFxQF9eW9ipnm6DaN6ja +X/+2k+cC4qIfqzeLcLUFXxz0qdec8lNNtr9QmwoQlv11beeHmQu9C1GwHmvG +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP512r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP512r1.key new file mode 100644 index 000000000000..790b619c365c --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP512r1.key @@ -0,0 +1,7 @@ +-----BEGIN PRIVATE KEY----- +MIHsAgEAMBQGByqGSM49AgEGCSskAwMCCAEBDQSB0DCBzQIBAQRAmEQNFMGIDLoj +Ktdg8V71WdSs7FiBkE6Bft25+yY8ohugk/u8aKeIKNVtSirMgQhGFJy/BIBkvM6V +1JfnrglkjqGBhQOBggAEYbjTnA0x42NdM7jVv7jAoZq0iOYopbwejlOEsx8/MqRa +Yt4Ef83holIsgOHWSeW+kw1oMDmieoCrhnkM/3KgGzV+BxCeieAWGxABsj9YhAmb +ATorRJ4q/pMxRq8gIUv05/dGuUttl1gdbKKnGQjxDBM4v5H+/4z00nzzj4Gbfx8= +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP512t1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP512t1.key new file mode 100644 index 000000000000..e4343646b3fc --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/brainpoolP512t1.key @@ -0,0 +1,7 @@ +-----BEGIN PRIVATE KEY----- +MIHsAgEAMBQGByqGSM49AgEGCSskAwMCCAEBDgSB0DCBzQIBAQRATamyZ088BsIP +Scslwa0I1xfC0/6udycncr+i/QIFOXNr4OQiVb4KC/CS/2FPotVMFSHZfCS2bgi6 +Yvg3Mta5SKGBhQOBggAEm/uIqsytMZypsqCuL0jwZh8xCRVEkUd02YPXcOBhMzS9 +bhAao4CLAuXhWzplr5qk/7ttvczl7qFDOvBzNAIieZHwbFrouZ6Pew8pQXRcMDB+ +FnXwNgpljTNmz/f1ePjVKU1ZgbQ+xVf8Qt8OI9S0Pla8siTgbVweGMLtq0A8Wuo= +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/dsa.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/dsa.key new file mode 100644 index 000000000000..93a9ee56e4f2 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/dsa.key @@ -0,0 +1,21 @@ +-----BEGIN PRIVATE KEY----- +MIIDXQIBADCCAzYGByqGSM44BAEwggMpAoIBgQC1d6MOqEDLxjfjz1v7Vg44bBBX +VOoNdWhvJPl9NL2Js57UmYGrTqFit2VCLxbS5FVLyOZ25S0myQRsEtKyi4V9+ELI +0q3oQplm+l3tZqKjtO69ZlbzYSl9IG1254/FCwBnBTuN7Vl6A2vryIhY7cL4E053 +Yy0xqfP7swPgMYNBqjc9c53hNHKiseQJ8Q2wFKZqm13xgqnBqmWbm7yNmzKJbjMW +Zt3/WpJdjqfRnjSljFOkYPPBkGRUIKHcZ9fw4odVov2vblGzXwR+sFeE3lcF50WN +uppjszMXlqR4y937CUSFbCabatRHEcPTq/FxioERCrCdx3AKOfwAquahtvWb9V7A +47FlibDDeybh5jCH0j9HSjhjSiDZdadSgGKFynPNlVAlOETZKGqkeqAZZ+dsPkVO +n8tx+VXZJF00YSe1HLKJUWXaT1tEGF6vw/dXhhQVir4j63fN2tZdhTOW1ao/J/iT +VYEQQjYeMKKuZQveBKRBlpAjhmjOztbE8VL4O/cCHQCxPXlCpORbfOMEEGU0hbEE +HsxFHMXHCnURCJxVAoIBgQCBqsk+z57UndC1Ut6u19wILXs7UBgLo0ivId2QHtm5 +kY77P9/lNOyCIQkBnULbJ36lHm6yxLZ8imyC5Lc7wlFJpJ6PpiTJ3nPi3fzhbftB +2KCJVSwB3XfkjvyyS8bfwwqyrmce9el+AIFJuWPrFSkjNthq7U5vU5a+uNT9XZrs +EaDbjkjVJXRX1oDS3IfWXWpb9i/LOE9HU+NfDKfydasWASvwNX1F5BKXD0AH9adj +9Q7b0p4DVTh+UPWLBk9/e6gsA5HaRI1urAMNxs5Xnmd8UYF1I+AmjQ9Mi63Pa0YW +QjpdH2hoOQGLemQ/72woFVzLaHWBcTuSwjREilaAA5M8CWq4rpuA79MrcHgzSp2C +W1gtZa2/3SymcJ7Py2PHbncod8gR9dxHWVO07ccOXUG0iL9m4MzQ27uVvTh8Nrma +M+JET778E2FaAkAIT34eNMC6Yk2IDrxU9L66FFx3+3n0cOeWaJxIWrIQ6uWk+uIH +VzPsZAQU/V0/QBABlHuSj1cEHgIcYTbB5VrbIgust0jVvQCnlF4b1V0qz2iDJt6o +sA== +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/ed25519.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/ed25519.key new file mode 100644 index 000000000000..a9bf1bfb8f98 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/ed25519.key @@ -0,0 +1,3 @@ +-----BEGIN PRIVATE KEY----- +MC4CAQAwBQYDK2VwBCIEIJ55hBE+FwS4M3k/c45ZJKPHtsklKrb6qJlER0cMJ2rn +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/ed448.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/ed448.key new file mode 100644 index 000000000000..934617d4c1cd --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/ed448.key @@ -0,0 +1,4 @@ +-----BEGIN PRIVATE KEY----- +MEcCAQAwBQYDK2VxBDsEOSSF8O0uKk5pRrjUNV+QgonwO+WeDRb/i1U7vM+TLzh7 +jAV58E6oglA53konKxGv+GC38dCb72gSeQ== +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/prime256v1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/prime256v1.key new file mode 100644 index 000000000000..775a7a0fcacf --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/prime256v1.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQguc9upTMQn8b+loAx +6c8q20dHYBf3V9374I3kJIDmC1ShRANCAARnLuOxL7n7Gq12zd9vq2neAv6PYc1h +W6M2gJKSbfFYGhte382jOJ2TgwaTQL/J5IPSfuJKkmAPBIl8CdJKWlwA +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/rsa-pss.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/rsa-pss.key new file mode 100644 index 000000000000..a0ecda8b2c11 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/rsa-pss.key @@ -0,0 +1,28 @@ +-----BEGIN PRIVATE KEY----- +MIIEvAIBADALBgkqhkiG9w0BAQoEggSoMIIEpAIBAAKCAQEApfv1BYcLTl09aBmW +OnwUEKxByqBZeCXLp6Ck6/plp3GgC9gtFMfSk7mImkIt8BAFWK27A0/vOFDf7SDX +tFYtlL6ZukxSgaltyEjMVMX/oqB3vMsqzDX96So4UauDlQexWORT0LcUp3IcjA8L +JrrZS6j278y3ah/Xkex56IRpfFbdqPj/p4rJMw0WFtqvINV6C2xGxeoC1/LcHM/H +WQLpeRD5PgnIwUw/dqMYtV7nfUDU5wCJLe6I0ogdgmCGrAeogldFilakPs47yU03 +/b6qWFHaj7OwGZRV51R/GChS1HdVN42nsXHiIz26KPIf8BS6O/iAZlUaS8xhw5XB +je0uIQIDAQABAoIBAAh8WZn3Pfo7JRUJ3dbOmh4CGHj5+qj8Ua2XtmbEDediFTsV +ybQ6xQa9YQD16jBQOV2/wARa1VG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9LOMAbAzHhsJ +ia/yFcH7lat92/28mrxoAkHHk5oUdIcP6pcPny3cE874sh/UPG7BNKrS+h2ll21e +OFsE0r+qLh68/S0HZM1/eA== +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/rsa.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/rsa.key new file mode 100644 index 000000000000..fc4a4c7b8393 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/rsa.key @@ -0,0 +1,52 @@ +-----BEGIN PRIVATE KEY----- +MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQCb/Jbg0D7zw7IF +DBzn/KZ0kjPf+vkOaZOxNG/PosID2/+OKHK9oXgnZcVbEtvJgR4KKjc4nrSMFtFa +BbwsvJWxUEqGjLQ5WahSe04R2yZ4LViGbFuBOHAWq9qtxRyDdkghrQvNy8cOr53K +O8/UAOJCgkYr7x562QLEQ+FUvpGqID2xWI5TUxVezmHdU/sZF8bRyH7TtEZ5zMqZ +Lt2hjD8CrzFt9aMv2eBldX8c2YTi1/3YPKi8mos21jsyRFa8gPeyi/TnKfA5mows +DWxCN2dvOw3ynKapFQV1QZief7KRxw3FGnUOdUfw/FqfpddZK7TJ3/AoaM6oNHy5 +aAqcVMqPqb4ZC0eO1R6+xIA4SoZBD+ZTJC2khoVQRRwfRyKQJpp9eWJ9+SOGCkCY +r+yZbcvGAuz7Y8SPp3kUWZwflofRCeE3p77U+icKkppkkmEJIb1iMm6qYoTjc5M/ +wTpI5qeQmGaftzz4dlWafTAbHT2jbwvSMgYFQQvW4RyV8Iu95PYl6aUg12mXwv6a +pYf0QuOPGCMP4UzfLfFTYDniS+34aaWkl77Lzmw98BRHa2Xjmn+iGQcHYjKvh7FM +bRBiFxcSEWjkh+mgDypV+8mqS6FOPC7WeCNvt1XGIRoKnlF4OarZjdI5KP9wKtV5 +hhx6G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QYM0X +dCUCggEACvTEoQ7gZMeaqr+j8fhsisLoRRCtslqoU27jqWTriISlnlvjNHqYOWb/ +JXinuvpiYZG5jih6KXxa26H+Q5Pb4amVNPq/d6qBu5yv9qpD3mCJaHNHPByLScZ9 +G+pBW+y5JXHCdFJjo6G4ipLLpPglAPte/TmEnoShGsxtgOmupYSliNteAz0ykvSv +At+UfdzdSY2uHC7JLnJjB7SeOz8YeXyE8KCBOAokxCjs0CdBeZDK46sti9umMuIr +cDVIk/azvt5ex5sXP944Ds7tUs/qS1bdm5DsG4XYBkSKRhNqlkdxLumMPnGcwsZC +JSRSgO3qryi1B/PjFld2fmtKpkffCw== +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/secp224r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/secp224r1.key new file mode 100644 index 000000000000..8c74cd9783d8 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/secp224r1.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MHgCAQAwEAYHKoZIzj0CAQYFK4EEACEEYTBfAgEBBByDAgBh6UOQqYJSPoiNWrK0 +rA0rTMLw8JdCEveBoTwDOgAEABwjlgBV9PPpMfo8fo6yWRdT+sb1cUdEhobd+V/D +/i58cWpDqd4CApevJWtkGbwhU4J9mN0aYrk= +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/secp256k1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/secp256k1.key new file mode 100644 index 000000000000..05ab7d4dd065 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/secp256k1.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGEAgEAMBAGByqGSM49AgEGBSuBBAAKBG0wawIBAQQgAjoYh3zy6gJciB7F/pHi +fU+IfPBeEhgQBFT3zNvox5ihRANCAATTIv3AIcnOXMvnURBseRspHsowmPAxPgsx +LH5+aU2mW06f2PsIe9F8gG/Nf2UOOuO+aqwEStIkfSBR+Fwpl2UR +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/secp256r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/secp256r1.key new file mode 100644 index 000000000000..2ff386caba17 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/secp256r1.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgSFp08cP6os9Fxmky +o5VFi6woYEqvbhVNYTp9NvwzBCChRANCAAQo6UQaiHkZr7lxrKDZyL9Qinr4Vy0Q +W3K2EPFYbVIupvzW0RH8vBy+0/yoaNyUsw/IsmBO+A60mhBB4rTjmq6R +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/secp384r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/secp384r1.key new file mode 100644 index 000000000000..f662e85f76c6 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/secp384r1.key @@ -0,0 +1,6 @@ +-----BEGIN PRIVATE KEY----- +MIG2AgEAMBAGByqGSM49AgEGBSuBBAAiBIGeMIGbAgEBBDCqdZTmuPvhbOVI/Vkk +yjowWmBb1+81m+ay2QF15TZns1iX4HQlaOZ1GzaqhJRS0R2hZANiAASYw9dep7R9 +IoC8Dzt6T0NYOOJE/TPdOXOH+M6uJvKAtmXGalFeLQX6HKlUDNPnBDTKp9p6Nu/o +2k/p2C9m0DaX70sNuyfOmh738Bw2Hlz3If+903Jj+hKSR4kWDkKYb/s= +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/secp521r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/secp521r1.key new file mode 100644 index 000000000000..e987b65b0e03 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/secp521r1.key @@ -0,0 +1,8 @@ +-----BEGIN PRIVATE KEY----- +MIHuAgEAMBAGByqGSM49AgEGBSuBBAAjBIHWMIHTAgEBBEIAdO/4HyMRu7/QcjYn +f8vynFJRVOKHVVmRFrAzZwkdusoqf9gkicCxcxhOpOGLezzTH4XBynbcmmMn4PNS +ZriTYO6hgYkDgYYABAAp8YOO/QeQoVEdzsOwZt1ta0/b5r0ESM/QNkBVgrRdCsJ+ +y3p/xis4wFlhv7lsrtuDoeuMimnvl+fAfptCzMKHugGBvSE0SjLgydEmUjh/y/a4 +O3cGqwUXnnxiLKJ98NFaooGYY+AwH4h77oCbQR1lf8jhe1qsJkR9mXpYuGnkaJ7l +qg== +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/x25519.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/x25519.key new file mode 100644 index 000000000000..affde0dce116 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/x25519.key @@ -0,0 +1,3 @@ +-----BEGIN PRIVATE KEY----- +MC4CAQAwBQYDK2VuBCIEINAdGSXck38nDXMgbRKqKiBPVuxDirhOs9VDE+NaokZz +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/x448.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/x448.key new file mode 100644 index 000000000000..04b53654134e --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/pkcs8/x448.key @@ -0,0 +1,4 @@ +-----BEGIN PRIVATE KEY----- +MEYCAQAwBQYDK2VvBDoEOFRfvQhj134qZjH0wDbmPc90BADiqrpGZSae/sd8GG84 +au0ISBY6I7BJJZdiLLED+0abd0hLYAyl +-----END PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP256r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP256r1.key new file mode 100644 index 000000000000..b30036ae561d --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP256r1.key @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHgCAQEEIBfCkWEWyc2tHIvSAo6hhcj09dnh8NOmtZeqGmcXHnIqoAsGCSskAwMC +CAEBB6FEA0IABJbsd3pZks2/1qhGV29b3V8f7XCKQmKtr3sBvB9UopDKAAnhVUXI +7st9YCeEPDO1EJq0ePll0qbVf1EOhpLd17k= +-----END EC PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP256t1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP256t1.key new file mode 100644 index 000000000000..2ef7cc4194e7 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP256t1.key @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHgCAQEEIILhgc3joEZDWMDm9TYgrENN7gbqtMpMw1e2MTLwlJhCoAsGCSskAwMC +CAEBCKFEA0IABIgzdtCT/Dvc0iuOrT+jJFyTzQH8jSENIToHEP/xcOVdMoklPgTx +ng6CA7FvC5xJUtYSGVqtCVUDWYHuXotm7IU= +-----END EC PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP320r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP320r1.key new file mode 100644 index 000000000000..f0cf5d5bd797 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP320r1.key @@ -0,0 +1,6 @@ +-----BEGIN EC PRIVATE KEY----- +MIGQAgEBBCg2J9Odvhrl05HKvxAVUztmTD9/8AyblPk9DqJVMLOufD+RnyCXCX4k +oAsGCSskAwMCCAEBCaFUA1IABHSnWUC/tKXpNHGEP89QVKEgvetwCQWFoOENAgXO +RniLiaLdAdsR80ouTsZiFgHG9su0l5ESEnFWQr5xUMj/vPwwhSYm+YP5ucx5Nezu +BM4d +-----END EC PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP320t1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP320t1.key new file mode 100644 index 000000000000..17e60c9549cd --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP320t1.key @@ -0,0 +1,6 @@ +-----BEGIN EC PRIVATE KEY----- +MIGQAgEBBCi0aeKsFfr17MTtr3IgFByp4IybuFzlgAbwPjf3rK0Fr/b87+WicOU6 +oAsGCSskAwMCCAEBCqFUA1IABDQHDepa3l/S8Gt9WrNCNpCPZNBXvmkGPnVXZchZ +I5BtUySwYxHX1tpatGs3jY7drVYm+NyxZE81pecYTvXR8bu7e3BIp2SwZmXEDxdY +p1fw +-----END EC PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP384r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP384r1.key new file mode 100644 index 000000000000..0d9028ebfc5e --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP384r1.key @@ -0,0 +1,6 @@ +-----BEGIN EC PRIVATE KEY----- +MIGoAgEBBDArrLo3J0sxM2YuEM0/JMMoR6ZNZNS4wZ8FDETP6VAoCrP9Kji4D59D +Oiv+3y2j66KgCwYJKyQDAwIIAQELoWQDYgAEaK8X3KCyRDMpbACw2xG4UUe9Oxyu +GWFaGKPxhKJDyW5Z56gT5P1Q2y4CblL/X9VcDIMXdcQqRNBkPQfy1+fJXwKO0Clf +D6MIE3bv6PTZ55J6H2H1dpg38a2soRchz0FN +-----END EC PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP384t1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP384t1.key new file mode 100644 index 000000000000..39a94e293b32 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP384t1.key @@ -0,0 +1,6 @@ +-----BEGIN EC PRIVATE KEY----- +MIGoAgEBBDAEZRoS9O2fGbx85aPZzZxfj33Wu8aZ8a+K5ZZBFuVKKL+/0UbidDhD +YiuAHL6GAr2gCwYJKyQDAwIIAQEMoWQDYgAEQL0dQoOTArIx70V/XxipoxxBeKT7 +zmIe7id5pQiw4O4nA2S2BFxQF9eW9ipnm6DaN6jaX/+2k+cC4qIfqzeLcLUFXxz0 +qdec8lNNtr9QmwoQlv11beeHmQu9C1GwHmvG +-----END EC PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP512r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP512r1.key new file mode 100644 index 000000000000..ebd8ce77f7b1 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP512r1.key @@ -0,0 +1,7 @@ +-----BEGIN EC PRIVATE KEY----- +MIHaAgEBBECYRA0UwYgMuiMq12DxXvVZ1KzsWIGQToF+3bn7JjyiG6CT+7xop4go +1W1KKsyBCEYUnL8EgGS8zpXUl+euCWSOoAsGCSskAwMCCAEBDaGBhQOBggAEYbjT +nA0x42NdM7jVv7jAoZq0iOYopbwejlOEsx8/MqRaYt4Ef83holIsgOHWSeW+kw1o +MDmieoCrhnkM/3KgGzV+BxCeieAWGxABsj9YhAmbATorRJ4q/pMxRq8gIUv05/dG +uUttl1gdbKKnGQjxDBM4v5H+/4z00nzzj4Gbfx8= +-----END EC PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP512t1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP512t1.key new file mode 100644 index 000000000000..eedbcdb4b81c --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/brainpoolP512t1.key @@ -0,0 +1,7 @@ +-----BEGIN EC PRIVATE KEY----- +MIHaAgEBBEBNqbJnTzwGwg9JyyXBrQjXF8LT/q53Jydyv6L9AgU5c2vg5CJVvgoL +8JL/YU+i1UwVIdl8JLZuCLpi+Dcy1rlIoAsGCSskAwMCCAEBDqGBhQOBggAEm/uI +qsytMZypsqCuL0jwZh8xCRVEkUd02YPXcOBhMzS9bhAao4CLAuXhWzplr5qk/7tt +vczl7qFDOvBzNAIieZHwbFrouZ6Pew8pQXRcMDB+FnXwNgpljTNmz/f1ePjVKU1Z +gbQ+xVf8Qt8OI9S0Pla8siTgbVweGMLtq0A8Wuo= +-----END EC PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/prime256v1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/prime256v1.key new file mode 100644 index 000000000000..67fe6d1432bd --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/prime256v1.key @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEILnPbqUzEJ/G/paAMenPKttHR2AX91fd++CN5CSA5gtUoAoGCCqGSM49 +AwEHoUQDQgAEZy7jsS+5+xqtds3fb6tp3gL+j2HNYVujNoCSkm3xWBobXt/Nozid +k4MGk0C/yeSD0n7iSpJgDwSJfAnSSlpcAA== +-----END EC PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/secp224r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/secp224r1.key new file mode 100644 index 000000000000..daf908848dd4 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/secp224r1.key @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MGgCAQEEHIMCAGHpQ5CpglI+iI1asrSsDStMwvDwl0IS94GgBwYFK4EEACGhPAM6 +AAQAHCOWAFX08+kx+jx+jrJZF1P6xvVxR0SGht35X8P+LnxxakOp3gICl68la2QZ +vCFTgn2Y3RpiuQ== +-----END EC PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/secp256k1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/secp256k1.key new file mode 100644 index 000000000000..435ae6b0ddd2 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/secp256k1.key @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHQCAQEEIDA00HY8HWvgF6YYE3GNc9cCxlHqL6gmeNXQjyrg7HCGoAcGBSuBBAAK +oUQDQgAEwTINsajIo/W+G+UG2iAlGPjwl4HcCLix2q7rRmCcNO0Px/dddeFdgKqH +HLWuyAKpRzn+BxuX8W3TqZnJONcYHw== +-----END EC PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/secp256r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/secp256r1.key new file mode 100644 index 000000000000..b71eb2fe258d --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/secp256r1.key @@ -0,0 +1,5 @@ +-----BEGIN EC PRIVATE KEY----- +MHcCAQEEILoEofWgFpdy7y8VmPl31ZVoI0hRFwOStu2PpKlzpgdMoAoGCCqGSM49 +AwEHoUQDQgAEgr3Herakdcrvfr71ncnniKEH2Te6kcfhkHT62MzoL+kveMsY6NDu +rd7NNt9Px1scfCzkpZZI3fe4m1lHMatQMw== +-----END EC PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/secp384r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/secp384r1.key new file mode 100644 index 000000000000..3b75975ceac1 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/secp384r1.key @@ -0,0 +1,6 @@ +-----BEGIN EC PRIVATE KEY----- +MIGkAgEBBDBtqXb+BJ63n8LaSU1UU25vFg8yW998I+yJwXLCgqMuPDaxfY1py4KF +mBX2kRNlBVygBwYFK4EEACKhZANiAASYI+WvOkNIX6vPYCBx57uUpFeEsK+9jbRG +FGaqN0ip/aPMWLp3n6JlmO8Ug3xgk3qvy+gJdFBJsIWs/LiCJc/sEilUlg7JAd3J +vFB22r5EORPqSGgHhdlBUM+9z8L8v2k= +-----END EC PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/secp521r1.key b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/secp521r1.key new file mode 100644 index 000000000000..e6fcfe538cad --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/secp521r1.key @@ -0,0 +1,7 @@ +-----BEGIN EC PRIVATE KEY----- +MIHcAgEBBEIBbhPg/ddqjdlQ/u0GlA1O6bzbOaKVRn/fxzWVEOySNPMLwiOTddzy +vfuKFliNFLTx0KV4523h5UQjFB6Kwh4pDuegBwYFK4EEACOhgYkDgYYABAAHrlzH +UouimWUmKMrMBYlhLNQUzn0FahYNtOt8XxLhTUoo7ySLL4YvwZKYBp3ZMjqHyG+S +Hcy9pkkQsF3vUP9rJAGzxg/TJUEQNd6k4AQS3qtLxA2p7Ygd2zU1Ed+OM/aaj9SD +YxRQKIAqe6jZ2M71zy2oa/WZl+MNvgfb+Oq8YaPZqg== +-----END EC PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/to_pkcs8.sh b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/to_pkcs8.sh new file mode 100644 index 000000000000..ddf0ca3f4446 --- /dev/null +++ b/spring-boot-project/spring-boot/src/test/resources/org/springframework/boot/web/server/sec1/to_pkcs8.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + + + +openssl pkcs8 -topk8 -in brainpoolP256r1.key -nocrypt -out ../pkcs8/brainpoolP256r1.key +openssl pkcs8 -topk8 -in brainpoolP256t1.key -nocrypt -out ../pkcs8/brainpoolP256t1.key +openssl pkcs8 -topk8 -in brainpoolP320r1.key -nocrypt -out ../pkcs8/brainpoolP320r1.key +openssl pkcs8 -topk8 -in brainpoolP320t1.key -nocrypt -out ../pkcs8/brainpoolP320t1.key +openssl pkcs8 -topk8 -in brainpoolP384r1.key -nocrypt -out ../pkcs8/brainpoolP384r1.key +openssl pkcs8 -topk8 -in brainpoolP384t1.key -nocrypt -out ../pkcs8/brainpoolP384t1.key +openssl pkcs8 -topk8 -in brainpoolP512r1.key -nocrypt -out ../pkcs8/brainpoolP512r1.key +openssl pkcs8 -topk8 -in brainpoolP512t1.key -nocrypt -out ../pkcs8/brainpoolP512t1.key +openssl pkcs8 -topk8 -in prime256v1.key -nocrypt -out ../pkcs8/prime256v1.key +openssl pkcs8 -topk8 -in secp224r1.key -nocrypt -out ../pkcs8/secp224r1.key diff --git a/spring-boot-project/spring-boot/src/test/resources/test-ec-key-prime256v1.pem b/spring-boot-project/spring-boot/src/test/resources/test-ec-key-prime256v1.pem deleted file mode 100644 index 6256a64396ba..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/test-ec-key-prime256v1.pem +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN EC PRIVATE KEY----- -MHcCAQEEINa5DtcVrTiC4pMDX+rnMbhIlxm26Rn5FYz2+uT5DmBcoAoGCCqGSM49 -AwEHoUQDQgAEj0M8x6W5fF5y5tdHvFCp0ws8gCOcETQk52uXSL46G3Uukng6lscf -yNobOV+NjmBCqJRZd0bKEvbIiMvpo6B0Fw== ------END EC PRIVATE KEY----- diff --git a/spring-boot-project/spring-boot/src/test/resources/test-ec-key.pem b/spring-boot-project/spring-boot/src/test/resources/test-ec-key.pem deleted file mode 100644 index 56cdfc004c2d..000000000000 --- a/spring-boot-project/spring-boot/src/test/resources/test-ec-key.pem +++ /dev/null @@ -1,6 +0,0 @@ ------BEGIN EC PRIVATE KEY----- -MIGkAgEBBDB21WGGOb1DokKW0MUHO7RQ6jZSUYXfO2iyfCbjmSJhyK8fSuq1V0N2 -Bj7X+XYhS6ygBwYFK4EEACKhZANiAATsRaYri/tDMvrrB2NJlxWFOZ4YBLYdSM+a -FlGh1FuLjOHW9cx8w0iRHd1Hxn4sxqsa62KzGoCj63lGoaJgi67YNCF0lBa/zCLy -ktaMsQePDOR8UR0Cfi2J9bh+IjxXd+o= ------END EC PRIVATE KEY-----