jasn1/style/verbose.go

28 lines
591 B
Go

package style
import (
"math/big"
"jasn1/x509"
)
type SignatureAlgorithm struct {
Oid []uint64 `json:"oid"`
Name string `json:"name"`
}
type VerboseFormat struct {
Version uint8 `json:"version"`
Serial *big.Int `json:"serial_number"`
Algo SignatureAlgorithm `json:"signature_algorithm"`
}
func FormatAsVerbose(cert *x509.Certificate) *VerboseFormat {
out := VerboseFormat {
Version: cert.Data.Version + 1,
Serial: big.NewInt(0).SetBytes(cert.Data.Serial),
Algo: SignatureAlgorithm { cert.Data.Signature.Kind, cert.Data.Signature.Name },
}
return &out
}