forked from mongodb/mongo-go-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GODRIVER-2239 use source of PyKMIP (mongodb#1051)
* add script to generate elliptic curve certificates * GODRIVER-2239 do not use fork of PyKMIP Co-authored-by: Preston Vasquez <24281431+prestonvasquez@users.noreply.github.com>
- Loading branch information
1 parent
e720278
commit 78f5014
Showing
10 changed files
with
131 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
These Elliptic Curve (EC) certificates were generated by running `etc/gen-ec-certs/gen-ec-certs.sh`. | ||
The EC certificates are used for testing the Go driver with PyKMIP. | ||
PyKMIP does not support Golang's default TLS cipher suites with RSA. | ||
|
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,12 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIBtjCCAVsCAj+0MAoGCCqGSM49BAMCMGUxCzAJBgNVBAYTAlVTMREwDwYDVQQI | ||
DAhOZXcgWW9yazEWMBQGA1UEBwwNTmV3IFlvcmsgQ2l0eTEQMA4GA1UECgwHTW9u | ||
Z29EQjEMMAoGA1UECwwDREJYMQswCQYDVQQDDAJjYTAgFw0yMjA4MTgwMDM5NTZa | ||
GA8yMDYyMDgwODAwMzk1NlowZTELMAkGA1UEBhMCVVMxETAPBgNVBAgMCE5ldyBZ | ||
b3JrMRYwFAYDVQQHDA1OZXcgWW9yayBDaXR5MRAwDgYDVQQKDAdNb25nb0RCMQww | ||
CgYDVQQLDANEQlgxCzAJBgNVBAMMAmNhMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcD | ||
QgAE0YOWpm6I2mES1h6CKMw5j29lWDfk36/S7i2+Rw5e9JvGmDGSepDH03MJlm4l | ||
J9pou6NJrtAfIhMsxvh4oECodTAKBggqhkjOPQQDAgNJADBGAiEAyr7ByfWjA1aG | ||
hJD1zFtU2C/+i59vGY3oYQ3gX6Y7HrICIQDkO5JF9tXeDOL5IPkpjBAp6OjACE6Y | ||
Ns42/ywMFmyWhA== | ||
-----END CERTIFICATE----- |
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,18 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIB/jCCAaSgAwIBAgICYz4wCgYIKoZIzj0EAwIwZTELMAkGA1UEBhMCVVMxETAP | ||
BgNVBAgMCE5ldyBZb3JrMRYwFAYDVQQHDA1OZXcgWW9yayBDaXR5MRAwDgYDVQQK | ||
DAdNb25nb0RCMQwwCgYDVQQLDANEQlgxCzAJBgNVBAMMAmNhMCAXDTIyMDgxODAw | ||
Mzk1NloYDzIwNjIwODA4MDAzOTU2WjBpMQswCQYDVQQGEwJVUzERMA8GA1UECAwI | ||
TmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3JrIENpdHkxEDAOBgNVBAoMB01vbmdv | ||
REIxDDAKBgNVBAsMA0RCWDEPMA0GA1UEAwwGY2xpZW50MFkwEwYHKoZIzj0CAQYI | ||
KoZIzj0DAQcDQgAE3lcl3A0IqcmuNeNhk9u8KZKe/Du5/e2xd3B8MRqROb/MDTFY | ||
JkBatcCNhcSCIjgtFMjZ8Rv2WrrN0fvmEqYpm6M+MDwwCQYDVR0TBAIwADAaBgNV | ||
HREEEzARgglsb2NhbGhvc3SHBH8AAAEwEwYDVR0lBAwwCgYIKwYBBQUHAwIwCgYI | ||
KoZIzj0EAwIDSAAwRQIgbkV6V3MK2nZdjr7LV0PKqfxKCWRyxRACEOH61a6dctsC | ||
IQD6k65C8AXAPOL+cqaZjoEMBpRea4F8gL0jIwzHh+tkAA== | ||
-----END CERTIFICATE----- | ||
-----BEGIN EC PRIVATE KEY----- | ||
MHcCAQEEIOw4V3MEjv/5go8JQGr9Au1sa9yzLzPXVsiZ2OihwN7joAoGCCqGSM49 | ||
AwEHoUQDQgAE3lcl3A0IqcmuNeNhk9u8KZKe/Du5/e2xd3B8MRqROb/MDTFYJkBa | ||
tcCNhcSCIjgtFMjZ8Rv2WrrN0fvmEqYpmw== | ||
-----END EC PRIVATE KEY----- |
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,18 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIB/TCCAaSgAwIBAgICNNIwCgYIKoZIzj0EAwIwZTELMAkGA1UEBhMCVVMxETAP | ||
BgNVBAgMCE5ldyBZb3JrMRYwFAYDVQQHDA1OZXcgWW9yayBDaXR5MRAwDgYDVQQK | ||
DAdNb25nb0RCMQwwCgYDVQQLDANEQlgxCzAJBgNVBAMMAmNhMCAXDTIyMDgxODAw | ||
Mzk1NloYDzIwNjIwODA4MDAzOTU2WjBpMQswCQYDVQQGEwJVUzERMA8GA1UECAwI | ||
TmV3IFlvcmsxFjAUBgNVBAcMDU5ldyBZb3JrIENpdHkxEDAOBgNVBAoMB01vbmdv | ||
REIxDDAKBgNVBAsMA0RCWDEPMA0GA1UEAwwGc2VydmVyMFkwEwYHKoZIzj0CAQYI | ||
KoZIzj0DAQcDQgAEgWFZeI/XzPl42qAMa8UZBLoW2IdkIowhz+iu9F5LkAXI388L | ||
qbRE4327RvquPO7Ca5eB9GNs77DEtnfMnVuXQ6M+MDwwCQYDVR0TBAIwADAaBgNV | ||
HREEEzARgglsb2NhbGhvc3SHBH8AAAEwEwYDVR0lBAwwCgYIKwYBBQUHAwEwCgYI | ||
KoZIzj0EAwIDRwAwRAIgHz7k59ubmnFHM+4GQpz0aeQ+FQGadRYe/h31iRye2wMC | ||
IAvirZCoxYBLlZ0NoXH8ncmEQzgkCx9hhv7mWpjNRk/h | ||
-----END CERTIFICATE----- | ||
-----BEGIN EC PRIVATE KEY----- | ||
MHcCAQEEIIRjzdANl/ghc/LgEdyGRc3xo07YHu1qku3GQNGY2OnboAoGCCqGSM49 | ||
AwEHoUQDQgAEgWFZeI/XzPl42qAMa8UZBLoW2IdkIowhz+iu9F5LkAXI388LqbRE | ||
4327RvquPO7Ca5eB9GNs77DEtnfMnVuXQw== | ||
-----END EC PRIVATE KEY----- |
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,3 @@ | ||
basicConstraints = CA: FALSE | ||
subjectAltName = DNS: localhost, IP: 127.0.0.1 | ||
extendedKeyUsage = clientAuth |
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 @@ | ||
# A nearly empty OpenSSL CA configuration file. | ||
# `openssl req` complains without a configuration file. | ||
[ req ] | ||
distinguished_name = distinguished_name | ||
|
||
[ distinguished_name ] |
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,45 @@ | ||
# This script is used to generate Elliptic Curve (EC) certificates. | ||
# The EC certificates are used for testing the Go driver with PyKMIP. | ||
# PyKMIP does not support Go's default TLS cipher suites with RSA. | ||
# See: GODRIVER-2239. | ||
set -euo pipefail | ||
CA_SERIAL=$RANDOM | ||
SERVER_SERIAL=$RANDOM | ||
CLIENT_SERIAL=$RANDOM | ||
DAYS=14600 | ||
|
||
# Generate CA certificate ... begin | ||
# Generate an EC private key. | ||
openssl ecparam -name prime256v1 -genkey -out ca-ec.key -noout | ||
# Generate a certificate signing request. | ||
openssl req -new -key ca-ec.key -out ca-ec.csr -subj "/C=US/ST=New York/L=New York City/O=MongoDB/OU=DBX/CN=ca/" -config empty.cnf -sha256 | ||
# Self-sign the request. | ||
openssl x509 -in ca-ec.csr -out ca-ec.pem -req -signkey ca-ec.key -days $DAYS -sha256 -set_serial $CA_SERIAL | ||
# Generate CA certificate ... end | ||
|
||
# Generate Server certificate ... begin | ||
# Generate an EC private key. | ||
openssl ecparam -name prime256v1 -genkey -out server-ec.key -noout | ||
# Generate a certificate signing request. | ||
openssl req -new -key server-ec.key -out server-ec.csr -subj "/C=US/ST=New York/L=New York City/O=MongoDB/OU=DBX/CN=server/" -config empty.cnf -sha256 | ||
# Sign the request with the CA. Add server extensions. | ||
openssl x509 -in server-ec.csr -out server-ec.pem -req -CA ca-ec.pem -CAkey ca-ec.key -days $DAYS -sha256 -set_serial $SERVER_SERIAL -extfile server.ext | ||
# Append private key to .pem file. | ||
cat server-ec.key >> server-ec.pem | ||
# Generate Server certificate ... end | ||
|
||
# Generate Client certificate ... begin | ||
# Generate an EC private key. | ||
openssl ecparam -name prime256v1 -genkey -out client-ec.key -noout | ||
# Generate a certificate signing request. | ||
# Use the Common Name (CN) of "client". PyKMIP identifies the client by the CN. The test server expects the identity of "client". | ||
openssl req -new -key client-ec.key -out client-ec.csr -subj "/C=US/ST=New York/L=New York City/O=MongoDB/OU=DBX/CN=client/" -config empty.cnf -sha256 | ||
# Sign the request with the CA. Add client extensions. | ||
openssl x509 -in client-ec.csr -out client-ec.pem -req -CA ca-ec.pem -CAkey ca-ec.key -days $DAYS -sha256 -set_serial $CLIENT_SERIAL -extfile client.ext | ||
# Append private key to .pem file. | ||
cat client-ec.key >> client-ec.pem | ||
# Generate Client certificate ... end | ||
|
||
# Clean-up. | ||
rm *.csr | ||
rm *.key |
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,3 @@ | ||
basicConstraints = CA: FALSE | ||
subjectAltName = DNS: localhost, IP: 127.0.0.1 | ||
extendedKeyUsage = serverAuth |