mirror of
https://github.com/SSLMate/certspotter.git
synced 2025-12-17 04:24:19 +01:00
Do SCT marshalling correctly
This commit is contained in:
@@ -23,20 +23,18 @@ type SignedCertificateTimestamp struct {
|
|||||||
Signature tlstypes.DigitallySigned `json:"signature"`
|
Signature tlstypes.DigitallySigned `json:"signature"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (sct *SignedCertificateTimestamp) Bytes() ([]byte, error) {
|
||||||
|
var builder cryptobyte.Builder
|
||||||
|
builder.AddValue(sct)
|
||||||
|
return builder.Bytes()
|
||||||
|
}
|
||||||
|
|
||||||
func (sct *SignedCertificateTimestamp) Marshal(b *cryptobyte.Builder) error {
|
func (sct *SignedCertificateTimestamp) Marshal(b *cryptobyte.Builder) error {
|
||||||
if err := sct.SCTVersion.Marshal(b); err != nil {
|
b.AddValue(sct.SCTVersion)
|
||||||
return err
|
b.AddValue(sct.ID)
|
||||||
}
|
|
||||||
if err := sct.ID.Marshal(b); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
b.AddUint64(sct.Timestamp)
|
b.AddUint64(sct.Timestamp)
|
||||||
if err := sct.Extensions.Marshal(b); err != nil {
|
b.AddValue(sct.Extensions)
|
||||||
return err
|
b.AddValue(sct.Signature)
|
||||||
}
|
|
||||||
if err := sct.Signature.Marshal(b); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user