MCPcopy Create free account
hub / github.com/rabbitstack/fibratus / Marshal

Method Marshal

pkg/sys/trust.go:414–435  ·  view source on GitHub ↗

Marshal writes certificate info into a raw buffer.

()

Source from the content-addressed store, hash-verified

412
413// Marshal writes certificate info into a raw buffer.
414func (c *Cert) Marshal() []byte {
415 b := make([]byte, 0)
416
417 before := make([]byte, 0)
418 before = c.NotBefore.AppendFormat(before, time.RFC3339Nano)
419 b = append(b, bytes.WriteUint16(uint16(len(before)))...)
420 b = append(b, before...)
421
422 after := make([]byte, 0)
423 after = c.NotAfter.AppendFormat(after, time.RFC3339Nano)
424 b = append(b, bytes.WriteUint16(uint16(len(after)))...)
425 b = append(b, after...)
426
427 b = append(b, bytes.WriteUint16(uint16(len(c.SerialNumber)))...)
428 b = append(b, c.SerialNumber...)
429 b = append(b, bytes.WriteUint16(uint16(len(c.Subject)))...)
430 b = append(b, c.Subject...)
431 b = append(b, bytes.WriteUint16(uint16(len(c.Issuer)))...)
432 b = append(b, c.Issuer...)
433
434 return b
435}
436
437// Unmarshal decodes cert info from the raw buffer. This method
438// assumes the certificate structure size was already read.

Callers 8

MarshalJSONMethod · 0.45
encodeMethod · 0.45
writeSnapshotsMethod · 0.45
LoadMacrosMethod · 0.45
decodeFilterFunction · 0.45
emitMethod · 0.45
MarshalRawMethod · 0.45

Calls 1

WriteUint16Function · 0.92

Tested by 1