You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OKS as a whole will issue only one DAC per public key. We implement this
using the file system / a common directory along with a file naming
scheme described in docs/debug-credentials.md.
Copy file name to clipboardExpand all lines: docs/debug-credentials.md
+54
Original file line number
Diff line number
Diff line change
@@ -26,3 +26,57 @@ The public key for the signer, the collection of trust anchors, and the DCSR are
26
26
The output is the DAC.
27
27
28
28
Most of the hard work in this process is done by the [lpc55_support](https://github.com/oxidecomputer/lpc55_support) crate.
29
+
30
+
## Issuance Policy
31
+
32
+
RFD 5280 defines policies that certificate authorities implement and abide by (at least that's what they're supposed to do).
33
+
DACs do not come with such guidelines but we do want to put some restrictions on their issuance.
34
+
OKS is the policy enforcement point by virtue of hosting the trust anchors that must sign the DAC.
35
+
36
+
### One key, one DAC
37
+
38
+
If we're willing to issue more than one DAC for a given key we create a situation where we must trust the key holder.
39
+
We would be trusting them to use each DAC in the appropriate context.
40
+
One could then attack the key holder by attempting to confuse them into using the key in the wrong context.
41
+
If the number of DACs we may issue is reasonably bounded (under some threshold) we can mitigate this threat by issuing only one DAC per signing key.
42
+
For now we're below this threshold and assume that will remain a constant.
43
+
44
+
Implementing this policy when OKS is presented with a DAC to sign requires that we compare the public key from the request (DcsrSpec) to each previously issued DAC.
45
+
This requires we iterate over all previously issued DACs.
46
+
We don't need to be able to do this particularly quickly so setting up and maintaining a database that we can query is overkill.
47
+
Instead we can use the file system much like the `openssl ca` command.
48
+
49
+
Reading back all past DACs from the file system could get expensive over time.
50
+
To avoid this we need an identifier that we can put into the DAC file names such that we can enforce this policy by reading a directory entry.
51
+
We can't put the full 4k RSA public key in the file name so we assign each a name that is the hex encoded sha256 digest.
52
+
We've been using the suffix `dc.bin` when exporting signed DACs and so we'll use that in this case as well.
53
+
54
+
Before OKS signs a DAC it calculates the digest of the public key and then searches through the collection of previosly issued DAC files looking for a file name that begins with the same digest.
55
+
If a match is found OKS will load this DAC and calculate the digest of the public key inside manually to verify.
56
+
57
+
### Digest What
58
+
59
+
When calculating the digest of the public key from a DAC we need to be explicit about the bytes we're running through the hash function.
60
+
For as long as we're using the LPC55 for our RoT these keys will always be RSA keys.
61
+
The `DebugCredentialSigningRequest` structure from the `lpc55_support` crate packages the public key in a format specific to RSA.
62
+
RSA keys are just two integers so we could run them both through the digest `update` function effectively concatenating them into a single digest.
63
+
64
+
While we'll be generating these digests in OKS, we want to enable external verification.
65
+
Doing this verification requires generating these digests from public keys obtained elsewhere and likely in other (standardized) formats.
66
+
These formats are going to either be PKCS#1, or SPKI.
67
+
68
+
Both of these formats store the public key as a DER encoded structure.
69
+
The prior is specific to RSA public keys and so we can hash this structure in its DER form directly:
70
+
71
+
```shell
72
+
openssl rsa -pubin -in path-to-pkcs1.pem -outform DER -RSAPublicKey_out | sha256sum
0 commit comments