summaryrefslogtreecommitdiff
path: root/jstests/ssl
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/ssl
parent27f0ac0db2c87f1a895c28b25ca22933227a26a9 (diff)
downloadmongo-8678e9ee87d2864376922522b9fa9b5a909aac1b.tar.gz
SERVER-35541 Support PKCS#8 PrivateKeyInfo in SChannel Provider
Diffstat (limited to 'jstests/ssl')
-rw-r--r--jstests/ssl/ssl_private_key.js36
1 files changed, 36 insertions, 0 deletions
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);
+}());