Commit Graph

12 Commits

Author SHA1 Message Date
Joe Richey
03018e6828 Remove certificate-transparency-go dependancy
Signed-off-by: Joe Richey <joerichey@google.com>
2022-04-04 13:48:39 -07:00
Go-Attestation Team
20a9e4b381 Internal change
PiperOrigin-RevId: 380881515
2021-06-22 20:41:11 +00:00
Matthew Garrett
3cc596e3c6 Add missing optional tags
Some fields have default values, which also means they should be treated
as optional. Fix up the tagging to handle that. The natural defaults
here will work, so no need to make them explicit.
2020-11-17 15:00:41 -08:00
Matthew Garrett
4ad1cc2bf5 Fix type for ComponentClassValue
This is an octet string (ie, an array of bytes) rather than a string.
Fix it to be []byte.
2020-11-12 16:31:41 -08:00
Matthew Garrett
cc244b36f4 Explicitly tag context-specific UTF8Strings
Context-specific fields in ASN.1 don't have explicit type tags in the
ASN.1 stream, so encoding/asn1 infers the tag from the type of the
struct field the stream is being unmarshalled to. By default string is
assumed to be PrintableString, which is only permitted to contain a
subset of possible characters. If a field is defined as UTF8String in
the spec then it may contain characters that are not permitted in
PrintableString, and in this case Unmarshal() will return an error. We
can avoid this by explicitly tagging any context-specific UTF8Strings.
2020-11-12 16:31:41 -08:00
Brandon Weeks
9559fc1cd4 Create oid package to centralize TCG relevant OIDs 2020-07-23 12:13:07 -07:00
Matthew Garrett
42b1d805de
Handle platform certificates that only provide a single property (#168)
Handle platform certificates that only provide a single property

The spec states that the PlatformProperties field of the
PlatformConfiguration attribute should be a sequence of key value pairs.
However, it seems that if there's only a single property present, it's
sometimes being stored as a bare key value pair rather than a sequence
with a single entry. Work around that.
2020-05-29 17:24:06 -07:00
Matthew Garrett
fbd936aac7 Parse out platform component and properties data
This provides information about individual components within the system,
which may be useful for various policy decisions.
2020-05-08 14:32:33 -07:00
Matthew Garrett
3538e3d287 Fix broken tag statements
A number of the struct definitions had broken tag definitions, which
meant some parsing was working by accident and some parsing was entirely
broken. Fixing this uncovered some additional issues (a mixture of
incorrect definitions and platform certificates that violate the spec),
so this is all cleaned up as well.
2020-05-08 14:32:33 -07:00
Matthew Garrett
61ed2a0d17 Fix attribute certificate signature handling
Attribute certificates are generally using RSA-SHA1 or RSA-SHA256
signatures, so include those. In addition, the CA signing restrictions
imposed for general purpose certificates don't apply here - drop that
restriction from certificate signature validation.
2020-05-06 18:54:52 -07:00
Eric Chiang
6cfb57c8eb attributecert: update names that golint complains about
golint current generates complaints:

        var oidTpmIdLabel should be oidTpmIDLabel
        var oidTcgPlatformManufacturerIdV2 should be oidTcgPlatformManufacturerIDV2
        var oidTcgPlatformConfigUri should be oidTcgPlatformConfigURI

Update names to satisfy golint.

The following commands were run to generate this change:

        gopls rename -w attributecert.go:44:2 oidTpmIDLabel
        gopls rename -w attributecert.go:54:2 oidTcgPlatformManufacturerIDV2
        gopls rename -w attributecert.go:55:2 oidTcgPlatformConfigURI
        gopls rename -w attributecert.go:163:6 authKeyID
        gopls rename -w attributecert.go:164:2 ID
        gopls rename -w attributecert.go:171:2 ID
        gopls rename -w attributecert.go:178:2 ID
        gopls rename -w attributecert.go:210:2 BaseCertificateID
        gopls rename -w attributecert.go:232:2 ID
        gopls rename -w attributecert.go:304:2 ID
        gopls rename -w attributecert.go:309:2 ID
        gopls rename -w attributecert.go:390:2 ComponentManufacturerID
        sed -i 's/Uri/URI/g' attributecert.go
        git clean -f

Updates #131
2019-11-06 11:09:02 +01:00
Matthew Garrett
f5fa92f739
First attempt at adding support for attribute certificates (#117)
Platform certificates are defined as RFC5755 attribute certificates with
various additional attributes and extensions defined in the TCG Platform
Certificate Profile. Add support for parsing them, derived from
crypto/x509. Include some test certificates and verify we parse them.
2019-10-27 23:12:15 -07:00