diff options
author | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-10-30 13:27:05 +0100 |
---|---|---|
committer | Rasmus Dahlberg <rasmus.dahlberg@kau.se> | 2020-10-30 13:27:05 +0100 |
commit | b8a8e56d4a311f15060efcd455c444949b2d20b9 (patch) | |
tree | 56b7239cad17fdeb0bb674c305b137bb8d6dcfaa /type.go | |
parent | 43c8e9b1e44255ecc3d8a0077dc285739cfbb79d (diff) |
started refactoring add-entry code path according to doc
Diffstat (limited to 'type.go')
-rw-r--r-- | type.go | 16 |
1 files changed, 11 insertions, 5 deletions
@@ -272,8 +272,9 @@ func StItemToB64(i StItem) (string, error) { // Appendix is extra data that Trillian can store about a leaf type Appendix struct { - Signature []byte `tls:"minlen:0,maxlen:16383"` - Chain []RawCertificate `tls:"minlen:0,maxlen:65535"` + Signature []byte `tls:"minlen:0,maxlen:16383"` + SignatureScheme uint16 + Chain []RawCertificate `tls:"minlen:0,maxlen:65535"` } // RawCertificate is a serialized X.509 certificate @@ -282,10 +283,15 @@ type RawCertificate struct { } // NewAppendix creates a new leaf Appendix for an X.509 chain and signature -func NewAppendix(x509Chain []*x509.Certificate, signature []byte) Appendix { - chain := make([]RawCertificate, 0, 2) // TODO: base length on config param +func NewAppendix(x509Chain []*x509.Certificate, signature []byte, signatureScheme uint16) Appendix { + chain := make([]RawCertificate, 0, len(x509Chain)) for _, c := range x509Chain { chain = append(chain, RawCertificate{c.Raw}) } - return Appendix{Signature: signature, Chain: chain} + + return Appendix{ + Signature: signature, + Chain: chain, + SignatureScheme: signatureScheme, + } } |