Skip to content

Commit

Permalink
update cert gen script
Browse files Browse the repository at this point in the history
  • Loading branch information
jocover committed Jun 24, 2024
1 parent 50df393 commit ec0fce1
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 24 deletions.
14 changes: 14 additions & 0 deletions main/cert/attestation-ca-cert.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[req]
distinguished_name = distinguished_name_sec
attributes = attributes_sec
prompt = no

[attributes_sec]

[distinguished_name_sec]
CN = CanoKeys FIDO Attestation Root CA No.1

[ca_extensions_sec]
subjectKeyIdentifier = hash
basicConstraints = CA:TRUE, pathlen:0
keyUsage = critical, cRLSign, keyCertSign
21 changes: 21 additions & 0 deletions main/cert/attestation-device-cert.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[req]
distinguished_name = distinguished_name_sec
attributes = attributes_sec
req_extensions = extensions_sec
prompt = no

[attributes_sec]

[distinguished_name_sec]
CN = CanoKey Serial 123456
OU = Authenticator Attestation
O = CanoKeys
C = CN

[extensions_sec]
# subjectKeyIdentifier = hash
basicConstraints = CA:FALSE
# AAGUID: should match the value in ctap.c (the prefix "04 10" is required for ASN.1 encoding)
1.3.6.1.4.1.45724.1.1.4 = DER:04:10:24:4e:b2:9e:e0:90:4e:49:81:fe:1f:20:f8:d3:b8:f4
# fido-u2f-authenticator-transports-extension-v1.2-ps-20170411.html
# 1.3.6.1.4.1.45724.2.1.1 = DER:03:02:04:30
5 changes: 5 additions & 0 deletions main/cert/gen_attestation_ca.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -e
openssl genrsa -out ca.key 2048
openssl req -config ./attestation-ca-cert.cnf -extensions ca_extensions_sec -x509 -days 7120 -new -key ca.key -nodes -out ca.pem
echo 01 >ca.srl # create the serial file
10 changes: 10 additions & 0 deletions main/cert/gen_attestation_devive_cert.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -e
openssl ecparam -out ec_key.pem -name secp256r1 -genkey -out dev.key
openssl req -config ./attestation-device-cert.cnf -new -key dev.key -nodes -out dev.csr
openssl x509 -extfile ./attestation-device-cert.cnf -extensions extensions_sec -days 3560 -req -in dev.csr -CA ca.pem -CAserial ca.srl -CAkey ca.key -out dev.pem
openssl x509 -outform der -in dev.pem -out dev.der
rm dev.csr

openssl ec -in dev.key -outform DER -no_public | tail -c +8 | head -c 32 > u2f_cert_key.bin

2 changes: 1 addition & 1 deletion main/cert/u2f_aaguid.bin
Original file line number Diff line number Diff line change
@@ -1 +1 @@
fM�g��A*������m
$N����NI�� �Ӹ�
19 changes: 0 additions & 19 deletions main/cert/u2f_genkeys.sh

This file was deleted.

4 changes: 0 additions & 4 deletions main/cert/v3.ext

This file was deleted.

0 comments on commit ec0fce1

Please sign in to comment.