-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'support_ec_keys' of github.com:pascal-hofmann/mockserve…
…r into pascal-hofmann-support_ec_keys
- Loading branch information
Showing
18 changed files
with
197 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...est/resources/org/mockserver/authentication/mtls/generate_custom_certifcates.md
This file was deleted.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
...st/resources/org/mockserver/authentication/mtls/generate_custom_certificates.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
see [generate_custom_certifcates](src/test/resources/org/mockserver/netty/integration/tls/generate_custom_certificates.md) for instructions on how to generate these certificates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...tegration/tls/inbound/CustomPrivateKeyAndCertificateWithECKeysMockingIntegrationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package org.mockserver.netty.integration.tls.inbound; | ||
|
||
import org.junit.AfterClass; | ||
import org.junit.BeforeClass; | ||
import org.mockserver.testing.integration.mock.AbstractBasicMockingSameJVMIntegrationTest; | ||
|
||
import static org.mockserver.configuration.ConfigurationProperties.certificateAuthorityCertificate; | ||
import static org.mockserver.configuration.ConfigurationProperties.certificateAuthorityPrivateKey; | ||
import static org.mockserver.configuration.ConfigurationProperties.privateKeyPath; | ||
import static org.mockserver.configuration.ConfigurationProperties.x509CertificatePath; | ||
import static org.mockserver.integration.ClientAndServer.startClientAndServer; | ||
import static org.mockserver.stop.Stop.stopQuietly; | ||
|
||
/** | ||
* @author pascal-hofmann | ||
*/ | ||
public class CustomPrivateKeyAndCertificateWithECKeysMockingIntegrationTest extends AbstractBasicMockingSameJVMIntegrationTest { | ||
|
||
private static int mockServerPort; | ||
private static String originalCertificateAuthorityCertificate; | ||
private static String originalCertificateAuthorityPrivateKey; | ||
private static String originalPrivateKeyPath; | ||
private static String originalX509CertificatePath; | ||
|
||
@BeforeClass | ||
public static void startServer() { | ||
// save original value | ||
originalCertificateAuthorityCertificate = certificateAuthorityCertificate(); | ||
originalCertificateAuthorityPrivateKey = certificateAuthorityPrivateKey(); | ||
originalPrivateKeyPath = privateKeyPath(); | ||
originalX509CertificatePath = x509CertificatePath(); | ||
|
||
// set new values | ||
certificateAuthorityCertificate("org/mockserver/netty/integration/tls/ec/ca.pem"); | ||
certificateAuthorityPrivateKey("org/mockserver/netty/integration/tls/ec/ca-key-pkcs8.pem"); | ||
privateKeyPath("org/mockserver/netty/integration/tls/ec/leaf-key-pkcs8.pem"); | ||
x509CertificatePath("org/mockserver/netty/integration/tls/ec/leaf-cert.pem"); | ||
|
||
mockServerClient = startClientAndServer(); | ||
mockServerPort = mockServerClient.getPort(); | ||
} | ||
|
||
@AfterClass | ||
public static void stopServer() { | ||
stopQuietly(mockServerClient); | ||
|
||
// set back to original value | ||
certificateAuthorityCertificate(originalCertificateAuthorityCertificate); | ||
certificateAuthorityPrivateKey(originalCertificateAuthorityPrivateKey); | ||
privateKeyPath(originalPrivateKeyPath); | ||
x509CertificatePath(originalX509CertificatePath); | ||
} | ||
|
||
@Override | ||
public int getServerPort() { | ||
return mockServerPort; | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
mockserver-netty/src/test/resources/org/mockserver/netty/integration/tls/ec/ca-csr.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"key": { | ||
"algo": "ecdsa", | ||
"size": 256 | ||
}, | ||
"names": [ | ||
{ | ||
"C": "UK", | ||
"L": "London", | ||
"O": "MockServer", | ||
"CN": "www.mockserver.com" | ||
} | ||
] | ||
} |
5 changes: 5 additions & 0 deletions
5
mockserver-netty/src/test/resources/org/mockserver/netty/integration/tls/ec/ca-key-pkcs8.pem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-----BEGIN PRIVATE KEY----- | ||
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgYYWHA2muEszTvTfd | ||
gMLtANU7g3vJFvOvu29OlSA9+LehRANCAAQMVjmPw4w5QdEh/RkOca5W+1uSajwH | ||
jMWFw3QM44ltecE0rfXMlx9EgUwOmvwgS/flzicbp71O24ylW4TxF4DP | ||
-----END PRIVATE KEY----- |
5 changes: 5 additions & 0 deletions
5
mockserver-netty/src/test/resources/org/mockserver/netty/integration/tls/ec/ca-key.pem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-----BEGIN EC PRIVATE KEY----- | ||
MHcCAQEEIGGFhwNprhLM07033YDC7QDVO4N7yRbzr7tvTpUgPfi3oAoGCCqGSM49 | ||
AwEHoUQDQgAEDFY5j8OMOUHRIf0ZDnGuVvtbkmo8B4zFhcN0DOOJbXnBNK31zJcf | ||
RIFMDpr8IEv35c4nG6e9TtuMpVuE8ReAzw== | ||
-----END EC PRIVATE KEY----- |
11 changes: 11 additions & 0 deletions
11
mockserver-netty/src/test/resources/org/mockserver/netty/integration/tls/ec/ca.pem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIBqjCCAVCgAwIBAgIUIOLrgCyQHOjdGLM5btVSA7QygbwwCgYIKoZIzj0EAwIw | ||
MzELMAkGA1UEBhMCVUsxDzANBgNVBAcTBkxvbmRvbjETMBEGA1UEChMKTW9ja1Nl | ||
cnZlcjAeFw0yMjA3MDYwMDQ3MDBaFw0yNzA3MDUwMDQ3MDBaMDMxCzAJBgNVBAYT | ||
AlVLMQ8wDQYDVQQHEwZMb25kb24xEzARBgNVBAoTCk1vY2tTZXJ2ZXIwWTATBgcq | ||
hkjOPQIBBggqhkjOPQMBBwNCAAQMVjmPw4w5QdEh/RkOca5W+1uSajwHjMWFw3QM | ||
44ltecE0rfXMlx9EgUwOmvwgS/flzicbp71O24ylW4TxF4DPo0IwQDAOBgNVHQ8B | ||
Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVE1DEs/YuwgSe1wD | ||
4/13ATIuR30wCgYIKoZIzj0EAwIDSAAwRQIhAKUh8DIaZAQxqSCP8A8hURgnplIc | ||
6+izhDnVp5xtWiBKAiAU8+KfCsS+zL/gwvV8cnY5W+Gw1dWEqRvGIy+4057vfQ== | ||
-----END CERTIFICATE----- |
21 changes: 21 additions & 0 deletions
21
mockserver-netty/src/test/resources/org/mockserver/netty/integration/tls/ec/csr.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"hosts": [ | ||
"example.com", | ||
"www.example.com", | ||
"https://www.example.com", | ||
"localhost", | ||
"127.0.0.1" | ||
], | ||
"key": { | ||
"algo": "ecdsa", | ||
"size": 256 | ||
}, | ||
"names": [ | ||
{ | ||
"C": "UK", | ||
"L": "London", | ||
"O": "MockServer", | ||
"CN": "www.mockserver.com" | ||
} | ||
] | ||
} |
11 changes: 11 additions & 0 deletions
11
...sources/org/mockserver/netty/integration/tls/ec/generate_custom_certificates.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
To generate these certificates, follow the instructions in | ||
[generate_custom_certifcates](../generate_custom_certificates.md) but use these key settings instead: | ||
|
||
``` | ||
… | ||
"key": { | ||
"algo": "ecdsa", | ||
"size": 256 | ||
}, | ||
… | ||
``` |
26 changes: 26 additions & 0 deletions
26
...rver-netty/src/test/resources/org/mockserver/netty/integration/tls/ec/leaf-cert-chain.pem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIICGzCCAcGgAwIBAgIUdWxKTU18GRCME/wOGM4Tlia1WNQwCgYIKoZIzj0EAwIw | ||
MzELMAkGA1UEBhMCVUsxDzANBgNVBAcTBkxvbmRvbjETMBEGA1UEChMKTW9ja1Nl | ||
cnZlcjAeFw0yMjA3MDYwMDQ5MDBaFw0yMzA3MDYwMDQ5MDBaMDMxCzAJBgNVBAYT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EB/zAdBgNVHQ4EFgQUVE1DEs/YuwgSe1wD | ||
4/13ATIuR30wCgYIKoZIzj0EAwIDSAAwRQIhAKUh8DIaZAQxqSCP8A8hURgnplIc | ||
6+izhDnVp5xtWiBKAiAU8+KfCsS+zL/gwvV8cnY5W+Gw1dWEqRvGIy+4057vfQ== | ||
-----END CERTIFICATE----- |
15 changes: 15 additions & 0 deletions
15
mockserver-netty/src/test/resources/org/mockserver/netty/integration/tls/ec/leaf-cert.pem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIICGzCCAcGgAwIBAgIUdWxKTU18GRCME/wOGM4Tlia1WNQwCgYIKoZIzj0EAwIw | ||
MzELMAkGA1UEBhMCVUsxDzANBgNVBAcTBkxvbmRvbjETMBEGA1UEChMKTW9ja1Nl | ||
cnZlcjAeFw0yMjA3MDYwMDQ5MDBaFw0yMzA3MDYwMDQ5MDBaMDMxCzAJBgNVBAYT | ||
AlVLMQ8wDQYDVQQHEwZMb25kb24xEzARBgNVBAoTCk1vY2tTZXJ2ZXIwWTATBgcq | ||
hkjOPQIBBggqhkjOPQMBBwNCAATn+jJTL/MzRe6DQtPnBdvZn7JEFP06gEuNmTB6 | ||
sZQUGvfDjx/HRfvHDp1dW3CzyPvs0H7Z0027XbVMTD2DGnr8o4GyMIGvMA4GA1Ud | ||
DwEB/wQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcDAQYIKwYBBQUHAwIwDAYDVR0T | ||
AQH/BAIwADAdBgNVHQ4EFgQUQYBTX8Lg+jLXOwlmo0LAa6mxFpcwUQYDVR0RBEow | ||
SIILZXhhbXBsZS5jb22CD3d3dy5leGFtcGxlLmNvbYIJbG9jYWxob3N0hwR/AAAB | ||
hhdodHRwczovL3d3dy5leGFtcGxlLmNvbTAKBggqhkjOPQQDAgNIADBFAiAl0noW | ||
hQd0uGksqvEj2Wc6w/3Fi5SiVHrn3cygGsWqTgIhAMGtvHJNRE7PaK0V2ISULnXr | ||
ZaA7BweVjGAD8JQAUS0s | ||
-----END CERTIFICATE----- | ||
|
5 changes: 5 additions & 0 deletions
5
...erver-netty/src/test/resources/org/mockserver/netty/integration/tls/ec/leaf-key-pkcs8.pem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-----BEGIN PRIVATE KEY----- | ||
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgW/VkDCWlWqD4pds6 | ||
+V797DqUk2HnZtXibwTIgElChcmhRANCAATn+jJTL/MzRe6DQtPnBdvZn7JEFP06 | ||
gEuNmTB6sZQUGvfDjx/HRfvHDp1dW3CzyPvs0H7Z0027XbVMTD2DGnr8 | ||
-----END PRIVATE KEY----- |
6 changes: 6 additions & 0 deletions
6
mockserver-netty/src/test/resources/org/mockserver/netty/integration/tls/ec/leaf-key.pem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
-----BEGIN EC PRIVATE KEY----- | ||
MHcCAQEEIFv1ZAwlpVqg+KXbOvle/ew6lJNh52bV4m8EyIBJQoXJoAoGCCqGSM49 | ||
AwEHoUQDQgAE5/oyUy/zM0Xug0LT5wXb2Z+yRBT9OoBLjZkwerGUFBr3w48fx0X7 | ||
xw6dXVtws8j77NB+2dNNu121TEw9gxp6/A== | ||
-----END EC PRIVATE KEY----- | ||
|
File renamed without changes.