Skip to content

Commit 38b4e5c

Browse files
ropnopRonnie Flathers
andauthored
added more tagtypes for byte slice encoding to ber.Encode (#27)
Co-authored-by: Ronnie Flathers <[email protected]>
1 parent 4255f2d commit 38b4e5c

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

ber.go

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,10 +485,32 @@ func Encode(ClassType Class, TagType Type, Tag Tag, Value interface{}, Descripti
485485
if ok {
486486
p.Data.Write([]byte(sv))
487487
}
488+
case TagEnumerated:
489+
bv, ok := v.Interface().([]byte)
490+
if ok {
491+
p.Data.Write(bv)
492+
}
493+
case TagEmbeddedPDV:
494+
bv, ok := v.Interface().([]byte)
495+
if ok {
496+
p.Data.Write(bv)
497+
}
498+
}
499+
} else if ClassType == ClassContext {
500+
switch Tag {
501+
case TagEnumerated:
502+
bv, ok := v.Interface().([]byte)
503+
if ok {
504+
p.Data.Write(bv)
505+
}
506+
case TagEmbeddedPDV:
507+
bv, ok := v.Interface().([]byte)
508+
if ok {
509+
p.Data.Write(bv)
510+
}
488511
}
489512
}
490513
}
491-
492514
return p
493515
}
494516

0 commit comments

Comments
 (0)