Skip to content

Commit

Permalink
✅ Test harness, of sorts.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihara committed Jun 22, 2023
1 parent db35342 commit ea03404
Show file tree
Hide file tree
Showing 30 changed files with 532 additions and 4 deletions.
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,13 @@ go.work
.vscode/launch.json
build/*
lotw-trust
test.sh

# Testcases tree
testcases/results/*
testcases/keys/cache/chain/*.der
!testcases/keys/cache/chain/mockup.der
testcases/keys/cache/*.der
testcases/**/*.old

# This, surprisingly, goes last.
!.gitkeep
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ This is a [Go](https://go.dev/) program, so this should be easy enough, provided

go install github.com/Mihara/lotw-trust@latest

It was written with go 1.20.5 and I currently don't know what's the minimum version requirement. Binaries for a number of platforms are provided in the releases section.
It was written with go 1.20.5 and I currently don't know what's the minimum version requirement. Binaries for a number of platforms are provided in the releases section. `build.sh` will cross-compile binaries for all supported platforms.

See `testcases` and `test.sh` for simple test cases and a faux-LoTW certification tree structure to play with.

## Plans for future development

Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func main() {
rootFiles, _ = os.ReadDir(rootsCacheDir)
for _, f := range rootFiles {
if strings.HasSuffix(strings.ToLower(f.Name()), ".der") {
der, err := dataFiles.ReadFile(filepath.Join(rootsCacheDir, f.Name()))
der, err := os.ReadFile(filepath.Join(rootsCacheDir, f.Name()))
check(err, "Failed to read a root certificate from cache.")
crt, err := x509.ParseCertificate(der)
check(err, "Failed to parse a root certificate from cache.")
Expand Down
23 changes: 23 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

# This is a preliminary smoke test engine, and not a proper integration test framework.
# Yet. It lets people run tests without ever touching their real key file though.

CACHE=testcases/keys/cache
KEY=testcases/keys/N0CALL.p12
SRC=testcases/files
DST=testcases/results

# Straightforward signature.
go run *.go sign -c $CACHE -p changeme $KEY $SRC/sstv.jpg $DST/sstv-signed.jpg
go run *.go verify -c $CACHE $DST/sstv-signed.jpg $DST/sstv-unsigned.jpg
cmp -l $SRC/sstv.jpg $DST/sstv-unsigned.jpg

# Uncompressed signature.
go run *.go sign -c $CACHE -p changeme -u -a $KEY $SRC/sstv.jpg $DST/sstv-signed-unc.jpg
go run *.go verify -c $CACHE $DST/sstv-signed-unc.jpg $DST/sstv-unsigned.jpg
cmp -l $SRC/sstv.jpg $DST/sstv-unsigned.jpg

# Text mode signing.
go run *.go sign -t -c $CACHE -p changeme $KEY $SRC/lipsum.txt $DST/lipsum-signed.txt
go run *.go verify -t -c $CACHE $DST/lipsum-signed.txt $DST/lipsum-unsigned.txt
10 changes: 10 additions & 0 deletions testcases/files/lipsum.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Enim facilisis gravida neque convallis a cras semper. Viverra maecenas accumsan lacus vel facilisis volutpat est. Nunc sed velit dignissim sodales ut eu sem. Tellus integer feugiat scelerisque varius morbi. Nec nam aliquam sem et tortor consequat. Urna porttitor rhoncus dolor purus. Ac ut consequat semper viverra. Amet venenatis urna cursus eget nunc scelerisque viverra mauris. Tortor condimentum lacinia quis vel eros. Tellus cras adipiscing enim eu turpis egestas pretium aenean. Duis convallis convallis tellus id interdum. Varius duis at consectetur lorem donec massa sapien faucibus et. Aenean euismod elementum nisi quis eleifend quam adipiscing. Nibh sit amet commodo nulla facilisi nullam. Sit amet purus gravida quis blandit. Nullam vehicula ipsum a arcu cursus vitae congue mauris.

Dui accumsan sit amet nulla. Nunc sed blandit libero volutpat sed cras ornare arcu dui. Tellus at urna condimentum mattis pellentesque id nibh tortor. Magna sit amet purus gravida quis blandit turpis cursus in. Non curabitur gravida arcu ac tortor dignissim convallis aenean. Sed risus ultricies tristique nulla. Varius duis at consectetur lorem donec massa sapien. Lobortis feugiat vivamus at augue eget arcu dictum varius duis. Netus et malesuada fames ac turpis egestas integer. Lectus magna fringilla urna porttitor rhoncus dolor. Dignissim cras tincidunt lobortis feugiat vivamus at. Non odio euismod lacinia at quis. Praesent elementum facilisis leo vel fringilla.

At tempor commodo ullamcorper a lacus. Sit amet massa vitae tortor condimentum lacinia quis vel eros. Non blandit massa enim nec. Tortor at risus viverra adipiscing at. Nulla pellentesque dignissim enim sit amet venenatis urna cursus. Eget lorem dolor sed viverra ipsum nunc. Vitae ultricies leo integer malesuada nunc vel risus commodo viverra. Accumsan in nisl nisi scelerisque eu. At quis risus sed vulputate odio ut enim blandit. Dictum varius duis at consectetur lorem donec massa. Ultrices dui sapien eget mi proin sed. Nisl vel pretium lectus quam id leo. Ipsum a arcu cursus vitae congue mauris rhoncus.

Nisl suscipit adipiscing bibendum est ultricies integer quis auctor elit. Nulla porttitor massa id neque aliquam. Praesent semper feugiat nibh sed pulvinar proin gravida. Interdum velit laoreet id donec. Feugiat in ante metus dictum at tempor. Convallis posuere morbi leo urna molestie at elementum. Netus et malesuada fames ac turpis egestas integer eget aliquet. Gravida cum sociis natoque penatibus et. Amet facilisis magna etiam tempor orci eu lobortis elementum nibh. Tristique nulla aliquet enim tortor. At tellus at urna condimentum mattis pellentesque id nibh tortor. Lectus mauris ultrices eros in. Purus faucibus ornare suspendisse sed nisi lacus sed viverra tellus. Vestibulum lectus mauris ultrices eros in cursus turpis. Pharetra convallis posuere morbi leo urna molestie at elementum.

Bibendum arcu vitae elementum curabitur vitae. Eu facilisis sed odio morbi quis commodo. Tristique et egestas quis ipsum suspendisse. Eu volutpat odio facilisis mauris sit amet massa vitae tortor. Ultricies integer quis auctor elit. Quis ipsum suspendisse ultrices gravida dictum. Integer malesuada nunc vel risus commodo viverra maecenas accumsan lacus. Eget duis at tellus at urna. Egestas egestas fringilla phasellus faucibus scelerisque eleifend donec pretium vulputate. Turpis egestas maecenas pharetra convallis posuere. Nunc sed id semper risus. Nunc scelerisque viverra mauris in aliquam sem fringilla ut morbi. Id consectetur purus ut faucibus pulvinar. Nisi porta lorem mollis aliquam ut porttitor leo a. Nunc aliquet bibendum enim facilisis gravida neque convallis a cras. Enim eu turpis egestas pretium aenean pharetra magna. Vitae nunc sed velit dignissim sodales.

Binary file added testcases/files/sstv.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions testcases/generator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# CA tree generator

The `generate_keys.sh` script builds a certificate authority structure that looks very much like LoTW's, but isn't, in addition to producing a user certificate for N0CALL. This certificate will not be recognized by `lotw-trust` unless the requisite `mockup.der` files are placed directly into the key cache -- or the key cache is pointed at the directory where they live, `testcases/keys/cache`, with `-c` command line option. This particular stunt makes it possible to use a completely fake certificate authority structure for testing purposes.

Running this script will wipe the existing structure in `testcases/generator` and start again, so signatures created with keys you had before will stop verifying.

Generally you shouldn't need to do use this again, unless LoTW does something unusual.

61 changes: 61 additions & 0 deletions testcases/generator/generate_keys.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/bin/bash

rm root/* intermediate/* user/*

touch root/index.txt
echo 01 >root/serial
touch intermediate/index.txt
echo 01 >intermediate/serial

echo === Generating root CA.
openssl genrsa -out root/ca.key.pem 4096
openssl req -config ./openssl.conf \
-key root/ca.key.pem \
-new -x509 -days 7300 -sha512 -extensions v3_ca \
-out root/ca.cert.pem \
-subj "/C=US/ST=CT/L=Pseudocity/O=Fake American Radio Relay League/OU=Logbook of the World Mockup/CN=Logbook of the World Root CA Mockup/emailAddress=lotw@example.com"

echo === Generating Intermediate CA CSR
openssl genrsa -out intermediate/ca.key.pem 2048
openssl req -config ./openssl.conf -new -sha256 \
-key intermediate/ca.key.pem \
-out intermediate/ca.csr.pem \
-subj "/C=US/ST=CT/L=Pseudocity/O=Fake American Radio Relay League/OU=Logbook of the World Mockup/CN=Logbook of the World Production CA Mockup/emailAddress=lotw@example.com"

echo === Signing the Intermediate CA CSR with Root CA.
openssl ca -config ./openssl.conf -extensions v3_intermediate_ca \
-days 6000 -notext -md sha256 -batch \
-in intermediate/ca.csr.pem \
-out intermediate/ca.cert.pem

echo === Generating a callsign CSR.
openssl genrsa -out user/user.key.pem 2048
openssl req -config ./openssl.conf -new -sha256 \
-subj "/CN=John Doe/emailAddress=john@example.com/Callsign=N0CALL" \
-key user/user.key.pem \
-out user/user.csr.pem

echo === Signing the callsign CSR with Intermediate CA.
openssl ca -config openssl.conf -name CA_intermediate -batch \
-extensions user_cert -days 5000 -notext -md sha256 \
-in user/user.csr.pem \
-out user/user.cert.pem

echo === Saving results.

KEYS=../keys
CACHE=$KEYS/cache

mkdir -p $CACHE/roots
openssl x509 -in root/ca.cert.pem -outform der -out $CACHE/roots/mockup.der
mkdir -p $CACHE/chain
openssl x509 -in intermediate/ca.cert.pem -outform der -out $CACHE/chain/mockup.der

# Now the fun part, making a pkcs12 file...
openssl pkcs12 -export -out $KEYS/N0CALL.p12 \
-password pass:changeme \
-inkey user/user.key.pem \
-in user/user.cert.pem \
-certfile intermediate/ca.cert.pem

echo === Done!
23 changes: 23 additions & 0 deletions testcases/generator/intermediate/01.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-----BEGIN CERTIFICATE-----
MIID5DCCAsygAwIBAgIBATANBgkqhkiG9w0BAQsFADCBwDELMAkGA1UEBhMCVVMx
CzAJBgNVBAgMAkNUMSkwJwYDVQQKDCBGYWtlIEFtZXJpY2FuIFJhZGlvIFJlbGF5
IExlYWd1ZTEkMCIGA1UECwwbTG9nYm9vayBvZiB0aGUgV29ybGQgTW9ja3VwMTIw
MAYDVQQDDClMb2dib29rIG9mIHRoZSBXb3JsZCBQcm9kdWN0aW9uIENBIE1vY2t1
cDEfMB0GCSqGSIb3DQEJARYQbG90d0BleGFtcG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END CERTIFICATE-----
32 changes: 32 additions & 0 deletions testcases/generator/intermediate/ca.cert.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
-----BEGIN CERTIFICATE-----
MIIFbzCCA1egAwIBAgIBATANBgkqhkiG9w0BAQsFADCBzzELMAkGA1UEBhMCVVMx
CzAJBgNVBAgMAkNUMRMwEQYDVQQHDApQc2V1ZG9jaXR5MSkwJwYDVQQKDCBGYWtl
IEFtZXJpY2FuIFJhZGlvIFJlbGF5IExlYWd1ZTEkMCIGA1UECwwbTG9nYm9vayBv
ZiB0aGUgV29ybGQgTW9ja3VwMSwwKgYDVQQDDCNMb2dib29rIG9mIHRoZSBXb3Js
ZCBSb290IENBIE1vY2t1cDEfMB0GCSqGSIb3DQEJARYQbG90d0BleGFtcGxlLmNv
bTAeFw0yMzA2MjIxMDIyMjVaFw0zOTExMjUxMDIyMjVaMIHAMQswCQYDVQQGEwJV
UzELMAkGA1UECAwCQ1QxKTAnBgNVBAoMIEZha2UgQW1lcmljYW4gUmFkaW8gUmVs
YXkgTGVhZ3VlMSQwIgYDVQQLDBtMb2dib29rIG9mIHRoZSBXb3JsZCBNb2NrdXAx
MjAwBgNVBAMMKUxvZ2Jvb2sgb2YgdGhlIFdvcmxkIFByb2R1Y3Rpb24gQ0EgTW9j
a3VwMR8wHQYJKoZIhvcNAQkBFhBsb3R3QGV4YW1wbGUuY29tMIIBIjANBgkqhkiG
9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoFK1iYtdMHbDp3Pe8s+EmGmPUBwpczEhK0l5
eGzXQz4PGkCEY6fv/qi/WzVSfs6FsKrIHelPmyS4SEwL2jjQQzIxm4II9PGu3yzT
M7un1Y1NY4jENSR2Gs1TxSmjvcMEuniLXdXv41D30ae+i8gKHlvpZ1teJzeWJyMK
ZQKtgNd2VytjOXkYbbmzOShyBvoQrXT20NDVtH/qYzSIEJ98CVHpzh7DZQHDb9bP
77ILSqK5NSexPaAUzQY4vP3IgxIQAg0NT+MkA8opNq11jW8f0yHwL5gfCKz+2xN6
JkShawJm68cdYr8aRj/KFhcBujj514yxM6PIhbyF9G0BFTCeZwIDAQABo2MwYTAd
BgNVHQ4EFgQUdh99H2bpKDHFO8m7Ihn9glBW2wUwHwYDVR0jBBgwFoAUtccMME0V
jHrWHeP8MzpJcIRIuE0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYw
DQYJKoZIhvcNAQELBQADggIBAHisuMAGui94Xf0NG9/DU1Q9DQuMrv/MEuE4KtPp
higiUQwXTepthmFxJycuyYhbGvoVTVoV7HO/pcQTiKp1bUcM55lAazT4rA3nJOuZ
frj5DhnAZX9rqkyddPxHSgY51Vb8gpIAZSNdMhOAblA3bGq8bSeeIrwUMtF8viD9
d2wdrm4APJLTiDfswCJdp3lGDQg5et+Kqlqhee3O0+/Y9pNM+xokuslQDyx/QqTf
hhyvEw1JHMRv4RWi2/Wzs38lGSvy8UnnerW9RhYRrwuSHIVrdLFO/+LGl7w7TNnh
9o3t1oYZZlGRN93rVp+ApbhC+OgpcqkTB16f6L7YHkX+toeKlEZYUzjGF/EMOn6T
iLTamzIrU1+J0dJTRIpHX7EW9o+a4JhafLMcqV9xfZkadqOBS4z80/prGzJ5AtKN
b8CAOy+G+H65+lNjBCtYrqohti9jJ8TlDf7UtDV2rg2rSFuxfbkna07+DeqzyNAq
YsWTTnXxHcYVQcZJpqp+m2OorPnYguEr+mgnP2hTCvqOxdralqtCKF8tWa64PhSf
2GQptkHCAmAsrMlxU7JBI8JRVRbgMNiLvONIxaooz1O7WQyRFPqkLy8fmcnQeQHl
stqQ1JsJfsvwNZzAkL/PfBGdGsITtLRH+UhgEYzexuuZzPMZ0mWD44kE4M5ueyBg
3JON
-----END CERTIFICATE-----
19 changes: 19 additions & 0 deletions testcases/generator/intermediate/ca.csr.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-----BEGIN CERTIFICATE REQUEST-----
MIIDGzCCAgMCAQAwgdUxCzAJBgNVB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TIFICATE REQUEST-----
28 changes: 28 additions & 0 deletions testcases/generator/intermediate/ca.key.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCgUrWJi10wdsOn
c97yz4SYaY9QHClzMSErSXl4bNdDPg8aQIRjp+/+qL9bNVJ+zoWwqsgd6U+bJLhI
TAvaONBDMjGbggj08a7fLNMzu6fVjU1jiMQ1JHYazVPFKaO9wwS6eItd1e/jUPfR
p76LyAoeW+lnW14nN5YnIwplAq2A13ZXK2M5eRhtubM5KHIG+hCtdPbQ0NW0f+pj
NIgQn3wJUenOHsNlAcNv1s/vsgtKork1J7E9oBTNBji8/ciDEhACDQ1P4yQDyik2
rXWNbx/TIfAvmB8IrP7bE3omRKFrAmbrxx1ivxpGP8oWFwG6OPnXjLEzo8iFvIX0
bQEVMJ5nAgMBAAECggEAKyZ3s+BtoYilmmFGZWXTE05+AxrBUT6s5cCtz+rDeVav
q+ond8cQgiMa9cqBPJ4LP4SHvf04rtIQQ20sV3ypGRzeWzOBg6O05F5lLexY/NI+
PQbngEIjA421+T/+0Sk3EZU2NXhKS41UVfpm/6pEhu1IAciGq9l7MWdt+cfhuOZX
QLMY/5+MWJf8Ru16tQjl34XeM0+3wFt6glcdiCtcCr/sxGYU/vsKaZvrtvqs7PkU
82MtyJfXjAKkC94FekEVOSUJtGuKrTffxy4yH/dtNyeaNiLkRDpXIAbP1xZiAz9N
aG7MjunfvObpLAHCeiwVQdNRkO2XjpY5VyUhLbM3gQKBgQC1qp/Tv/C0FiMTWhZE
bF2Wy4FXHnK+rgnqCLlKCDFi0Cb760HJnlJa/kc+pWFCTRhoE+80iEdE+66aVIE2
WdzpLuA8GPfibvklu7ASpa0R437UAkKroF8dZXXdEOKBe7u1HFrGhv1dNftM/fVu
D4gKlA+I+cZJ5wJvb2htpKPhJwKBgQDh7GJRa4FH6JX837LYedxHI1Z6VkC6h+qL
id9t7+svf+ftqe4CMWLqzp1+39ci1TF3trwXWdEnbBDWLOTfe9pKoDrH/e+qtF/4
N6JL5j2afSivY6QbZadsL8sKyn3QjWTX++r/N4DpptGsQ390z/8nsVEw0Hel1RUW
Xn4mK+kgwQKBgQCKj/jWJsluYpAgW48uY0VDFjex/kxg+hgfxMWnHPamOsPxVDBa
mwKP2vD2bGfxjSI3iDTkaamKiTlVB22CyioARbvMuvKfaCtqx2x13J5UTaPYC11U
0L6bil7K3e0V/A1hB56JXD72EI173RyM9RW7k9EBlhnTFns6CcyqDHDe8wKBgQCI
nliqIdeQ835X57KQI8joH994pVYJNo3ICfzZz16qX6+R0dPC8bh+g6lMAvJm9wMu
AIvnlwHa1AeubIGO/6d2v0QskkvvL5plUMdNHJMeLBeBUED57FP9IT2obeD9T7Ou
xIFMCnVjVeSvRjX6HpmOmDSfz0C7QIq69zNTw/P7QQKBgBA+IpYxe6wMEcMnb124
f3Rl8y5JvsvZMz44r9BrVRW870Aaex8IRpTtKrg0aLftks5to69frgIf/ri6PFXs
uaACayleku6C8eWGEsqpaXNzN36bsu8D/MH5XoVG6LpP1fGLlMpujGyYO+jCQmWA
OVYvQxVNfnIZuxll11Hk1mnz
-----END PRIVATE KEY-----
1 change: 1 addition & 0 deletions testcases/generator/intermediate/index.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
V 370228102225Z 01 unknown /CN=John Doe/Callsign=N0CALL/emailAddress=john@example.com
1 change: 1 addition & 0 deletions testcases/generator/intermediate/index.txt.attr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
unique_subject = yes
1 change: 1 addition & 0 deletions testcases/generator/intermediate/serial
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
02
119 changes: 119 additions & 0 deletions testcases/generator/openssl.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@

oid_section = lotw_oids

[ lotw_oids ]
Callsign=1.3.6.1.4.1.12348.1.1

[ ca ]
default_ca = CA_root

[ CA_root ]
dir = ./root
certs = $dir/certs
crl_dir = $dir/crl
new_certs_dir = $dir
database = $dir/index.txt
serial = $dir/serial
RANDFILE = $dir/private/.rand

private_key = $dir/ca.key.pem
certificate = $dir/ca.cert.pem

crlnumber = $dir/crlnumber
crl = $dir/ca.crl.pem
crl_extensions = crl_ext
default_crl_days = 30

default_md = sha256

name_opt = ca_default
cert_opt = ca_default
default_days = 375
preserve = no
policy = policy_strict

[ CA_intermediate ]
dir = ./intermediate
certs = $dir
crl_dir = $dir
new_certs_dir = $dir
database = $dir/index.txt
serial = $dir/serial
RANDFILE = $dir/.rand
private_key = $dir/ca.key.pem
certificate = $dir/ca.cert.pem

crlnumber = $dir/crlnumber
crl = $dir/ca.crl.pem
crl_extensions = crl_ext
default_crl_days = 30

default_md = sha256

name_opt = ca_default
cert_opt = ca_default
default_days = 375
preserve = no
policy = policy_loose

[ policy_strict ]
countryName = match
stateOrProvinceName = match
organizationName = match
organizationalUnitName = optional
commonName = supplied
emailAddress = optional

[ policy_loose ]
countryName = optional
stateOrProvinceName = optional
localityName = optional
organizationName = optional
organizationalUnitName = optional
commonName = supplied
Callsign = supplied
emailAddress = optional

[ req ]
default_bits = 2048
distinguished_name = req_distinguished_name
string_mask = utf8only
default_md = sha256
x509_extensions = v3_ca

[ req_distinguished_name ]
countryName = Country Name (2 letter code)
stateOrProvinceName = State or Province Name
localityName = Locality Name
0.organizationName = Organization Name
organizationalUnitName = Organizational Unit Name
commonName = Common Name
emailAddress = Email Address
Callsign = Callsign

countryName_default = US
stateOrProvinceName_default = CT
localityName_default = NotNewington
0.organizationName_default = Logbook of the World Mockup
organizationalUnitName_default = Fake American Radio Relay League
emailAddress_default = lotw@example.com
Callsign_default = N0CALL

[ v3_ca ]
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always,issuer
basicConstraints = critical, CA:true
keyUsage = critical, digitalSignature, cRLSign, keyCertSign

[ v3_intermediate_ca ]
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always,issuer
basicConstraints = critical, CA:true
keyUsage = critical, digitalSignature, cRLSign, keyCertSign

[ user_cert ]
subjectKeyIdentifier = hash
basicConstraints = CA:FALSE
authorityKeyIdentifier = keyid,issuer
keyUsage = critical, nonRepudiation, digitalSignature, keyEncipherment

Loading

0 comments on commit ea03404

Please sign in to comment.