mirror of
https://github.com/SSLMate/certspotter.git
synced 2026-01-31 17:54:21 +01:00
Add SCT marshalling
This commit is contained in:
@@ -23,6 +23,23 @@ type SignedCertificateTimestamp struct {
|
||||
Signature tlstypes.DigitallySigned `json:"signature"`
|
||||
}
|
||||
|
||||
func (sct *SignedCertificateTimestamp) Marshal(b *cryptobyte.Builder) error {
|
||||
if err := sct.SCTVersion.Marshal(b); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := sct.ID.Marshal(b); err != nil {
|
||||
return err
|
||||
}
|
||||
b.AddUint64(sct.Timestamp)
|
||||
if err := sct.Extensions.Marshal(b); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := sct.Signature.Marshal(b); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (sct *SignedCertificateTimestamp) Unmarshal(s *cryptobyte.String) error {
|
||||
if !sct.SCTVersion.Unmarshal(s) {
|
||||
return fmt.Errorf("error reading SCT version")
|
||||
|
||||
Reference in New Issue
Block a user