mirror of
https://github.com/gregtwallace/apc-p15-tool.git
synced 2025-09-18 14:02:06 +00:00
app: restructure and start building p15 output
This commit is contained in:
parent
6610c92058
commit
e2e4f2037c
24 changed files with 622 additions and 168 deletions
pkg/tools/asn1obj
26
pkg/tools/asn1obj/sequence.go
Normal file
26
pkg/tools/asn1obj/sequence.go
Normal file
|
@ -0,0 +1,26 @@
|
|||
package asn1obj
|
||||
|
||||
import "encoding/asn1"
|
||||
|
||||
// Sequence returns an ASN.1 SEQUENCE with the specified content
|
||||
func Sequence(content [][]byte) []byte {
|
||||
val := []byte{}
|
||||
for i := range content {
|
||||
val = append(val, content[i]...)
|
||||
}
|
||||
|
||||
raw := asn1.RawValue{
|
||||
Class: asn1.ClassUniversal,
|
||||
Tag: asn1.TagSequence,
|
||||
IsCompound: true,
|
||||
Bytes: val,
|
||||
}
|
||||
|
||||
// should never error
|
||||
asn1result, err := asn1.Marshal(raw)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return asn1result
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue