summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorMark Benvenuto <mark.benvenuto@mongodb.com>2018-06-11 23:32:42 -0400
committerMark Benvenuto <mark.benvenuto@mongodb.com>2018-06-11 23:32:42 -0400
commit8678e9ee87d2864376922522b9fa9b5a909aac1b (patch)
tree36083b278b70c1ec095ff8b901bbcc106fd18b02 /jstests
parent27f0ac0db2c87f1a895c28b25ca22933227a26a9 (diff)
downloadmongo-8678e9ee87d2864376922522b9fa9b5a909aac1b.tar.gz
SERVER-35541 Support PKCS#8 PrivateKeyInfo in SChannel Provider
Diffstat (limited to 'jstests')
-rw-r--r--jstests/libs/client_privatekey.pem51
-rw-r--r--jstests/ssl/ssl_private_key.js36
2 files changed, 87 insertions, 0 deletions
diff --git a/jstests/libs/client_privatekey.pem b/jstests/libs/client_privatekey.pem
new file mode 100644
index 00000000000..c479d868366
--- /dev/null
+++ b/jstests/libs/client_privatekey.pem
@@ -0,0 +1,51 @@
+-----BEGIN CERTIFICATE-----
+MIID6TCCAtGgAwIBAgIJAOdcrxT4uC26MA0GCSqGSIb3DQEBCwUAMHQxFzAVBgNV
+BAMTDktlcm5lbCBUZXN0IENBMQ8wDQYDVQQLEwZLZXJuZWwxEDAOBgNVBAoTB01v
+bmdvREIxFjAUBgNVBAcTDU5ldyBZb3JrIENpdHkxETAPBgNVBAgTCE5ldyBZb3Jr
+MQswCQYDVQQGEwJVUzAeFw0xODA1MDQwMzE1MDhaFw0yODA1MDEwMzE1MDhaMIGx
+MQswCQYDVQQGEwJVUzERMA8GA1UECAwITmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZ
+b3JrIENpdHkxEDAOBgNVBAoMB01vbmdvREIxEzARBgNVBAsMCktlcm5lbFVzZXIx
+DzANBgNVBAMMBmNsaWVudDEiMCAGCSqGSIb3DQEJARYTZXhhbXBsZUBtb25nb2Ri
+LmNvbTEbMBkGA1UEDAwSQSBUZXN0IENlcnRpZmljYXRlMIIBIjANBgkqhkiG9w0B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BppaJtOqubOGUxRrxSNF212XJZzxpeOUJcjjOud3jRl9aHWyWgYGQKBgQCa
+MOwttMVP/pYmgflrXi9K/fVtvi9vscsFtaQ9j0fCfFcMN/ViMVAU9559ui9LVY+W
+1uIs7qrjdFgHCf5Z0JG3Whj5MEXRG10mAShClmjoSLVsqYZkbo/5hipTprFXzl/U
+GHH2GTojzY+ZWsIL1Ao8q4/JQWbdtVxfeh9NQCagdQKBgHw4VkLjtM3ZR9lNeacF
+GdBqEql08iVszXBwoknpKjMsBcpJVY6OQaRcMRoicKD6SyAhAhG1BjRZmuRtaZas
+zQBexYs/w8w6jjUxRF7FcQcKjJiXV9oPhgaNdaEtGPnAgE9X8/qqPGz+OCMI+RPW
+E28R8ZvFyr1KehGrSdEkjAt/
+-----END PRIVATE KEY----- \ No newline at end of file
diff --git a/jstests/ssl/ssl_private_key.js b/jstests/ssl/ssl_private_key.js
new file mode 100644
index 00000000000..5317d6c86fa
--- /dev/null
+++ b/jstests/ssl/ssl_private_key.js
@@ -0,0 +1,36 @@
+// Test that clients support "BEGIN PRIVATE KEY" pems with RSA keys
+load('jstests/ssl/libs/ssl_helpers.js');
+
+(function() {
+ "use strict";
+
+ const SERVER_CERT = "jstests/libs/server.pem";
+ const CA_CERT = "jstests/libs/ca.pem";
+ const CLIENT_CERT = "jstests/libs/client_privatekey.pem";
+
+ function authAndTest(port) {
+ const mongo = runMongoProgram("mongo",
+ "--host",
+ "localhost",
+ "--port",
+ port,
+ "--ssl",
+ "--sslCAFile",
+ CA_CERT,
+ "--sslPEMKeyFile",
+ CLIENT_CERT,
+ "--eval",
+ "1");
+
+ // runMongoProgram returns 0 on success
+ assert.eq(0, mongo, "Connection attempt failed");
+ }
+
+ const x509_options = {sslMode: "requireSSL", sslPEMKeyFile: SERVER_CERT, sslCAFile: CA_CERT};
+
+ let mongo = MongoRunner.runMongod(Object.merge(x509_options, {auth: ""}));
+
+ authAndTest(mongo.port);
+
+ MongoRunner.stopMongod(mongo);
+}());