key: finish key encoding and start cert

This commit is contained in:
Greg T. Wallace 2024-01-27 11:35:35 -05:00
commit 1f6dad4907
14 changed files with 592 additions and 115 deletions
pkg/tools/asn1obj

26
pkg/tools/asn1obj/set.go Normal file
View file

@ -0,0 +1,26 @@
package asn1obj
import "encoding/asn1"
// Set returns an ASN.1 SET with the specified content
func Set(content [][]byte) []byte {
val := []byte{}
for i := range content {
val = append(val, content[i]...)
}
raw := asn1.RawValue{
Class: asn1.ClassUniversal,
Tag: asn1.TagSet,
IsCompound: true,
Bytes: val,
}
// should never error
asn1result, err := asn1.Marshal(raw)
if err != nil {
panic(err)
}
return asn1result
}