-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #129 from lealem47/san
Add ability to set more subjectAltName attributes
- Loading branch information
Showing
7 changed files
with
104 additions
and
13 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
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 |
---|---|---|
|
@@ -243,7 +243,7 @@ run3() { | |
./wolfssl x509 -inform pem -in certs/ca-cert.pem -outform der -out x509_test.der | ||
cert_test_case "-inform pem -outform der -in certs/ca-cert.pem -out x509_tmp.der" \ | ||
x509_test.der x509_tmp.der | ||
rm -f x509_test.pem x509_tmp.pem | ||
rm -f x509_test.pem x509_tmp.pem x509_test.der x509_tmp.der | ||
echo "TEST 3.c" | ||
test_case "-in certs/server-cert.pem -subject -noout" | ||
EXPECTED="/C=US/ST=Montana/L=Bozeman/O=wolfSSL/OU=Support/CN=www.wolfssl.com/[email protected]" | ||
|
@@ -367,6 +367,7 @@ run4 | |
rm -f out.txt | ||
rm -f tmp.pem | ||
rm -f tmp.der | ||
rm -f cert_stripped.pem | ||
|
||
echo "Done" | ||
exit 0 |
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 |
---|---|---|
|
@@ -100,6 +100,12 @@ coutnryName_min = 2 | |
basicConstraints = critical,CA:true | ||
keyUsage = nonRepudiation, digitalSignature, keyEncipherment | ||
subjectAltName = @alt_names | ||
[alt_names] | ||
RID.1 = 1.1.1.1 | ||
RID.2 = surname | ||
email.1 = [email protected] | ||
URI.1 = [email protected] | ||
EOF | ||
|
||
|
||
|
@@ -119,8 +125,21 @@ rm -f tmp.cert | |
# no parameter -conf | ||
#run_fail "req -new -key ./certs/server-key.pem -conf ./test.conf -out tmp.csr" | ||
|
||
run_success "req -new -key ./certs/server-key.pem -config ./test.conf -out tmp.csr" | ||
run_success "req -new -key ./certs/server-key.pem -config ./test-prompt.conf -out tmp.csr" "US" | ||
run_success "req -text -in tmp.csr" | ||
SUBJECT=`./wolfssl req -in tmp.csr -text | grep -A1 "X509v3 Subject Alternative Name"` | ||
EXPECTED=" X509v3 Subject Alternative Name: | ||
email:[email protected], Registered ID:1.1.1.1, Registered ID:surname, URI:[email protected]" | ||
if [ "$SUBJECT" != "$EXPECTED" ] | ||
then | ||
echo "found unexpected result" | ||
echo "Got : $SUBJECT" | ||
echo "Expected : $EXPECTED" | ||
exit 99 | ||
fi | ||
|
||
run_success "req -new -key ./certs/server-key.pem -config ./test.conf -out tmp.csr" "US" | ||
|
||
|
||
# fail when extensions can not be found | ||
run_fail "req -new -extensions v3_alt_ca_not_found -key ./certs/server-key.pem -config ./test.conf -x509 -out alt.crt" | ||
|
@@ -175,6 +194,7 @@ fi | |
|
||
rm -f tmp.cert | ||
rm -f tmp.csr | ||
rm -f alt.crt | ||
|
||
run_success "req -new -key ./certs/server-key.pem -config ./test.conf -x509 -out tmp.cert" | ||
SUBJECT=`./wolfssl x509 -in tmp.cert -text | grep Subject:` | ||
|
@@ -236,11 +256,10 @@ fi | |
run_success "req -newkey rsa:2048 -keyout new-key.pem -config ./test.conf -out tmp.cert -passout pass:123456789wolfssl -outform pem -sha256" | ||
run_success "rsa -in new-key.pem -passin pass:123456789wolfssl" | ||
|
||
rm -f tmp.cert | ||
|
||
run_success "req -new -x509 -key ./certs/ca-key.pem -config ./test-prompt.conf -out tmp.cert" "AA" | ||
run_fail "req -new -x509 -key ./certs/ca-key.pem -config ./test-prompt.conf -out tmp.cert" "LONG" | ||
|
||
rm -f tmp.cert | ||
rm -f new-key.pem | ||
rm -f test.conf | ||
rm -f test-prompt.conf | ||
|