func (b *Builder) MarshalASN1(v interface{}) {
	if b.err != nil {
		return
	}
	bytes, err := asn1.Marshal(v)
	if err != nil {
		b.err = err
		return
	}
	b.AddBytes(bytes)
}
MarshalASN1 calls asn1.Marshal on its input and appends the result if
successful or records an error if one occurred.
package cryptobyte
import (
	"encoding/asn1"
	"fmt"
	"math/big"
	"reflect"
	"time"
)
type Tag uint8
func (t Tag) ContextSpecific() Tag { return t | 0x80 }
func (t Tag) Constructed() Tag { return t | 0x20 }
func (b *Builder) AddASN1Int64(v int64) {
	b.addASN1Signed(asn1.TagInteger, v)
}
func (b *Builder) AddASN1Enum(v int64) {
	b.addASN1Signed(asn1.TagEnum, v)
}
func (b *Builder) addASN1Signed(tag Tag, v int64) {
	b.AddASN1(tag, func(c *Builder) {
		length := 1
		for i := v; i >= 0x80 || i < -0x80; i >>= 8 {
			length++
		}
		for ; length > 0; length-- {
			i := v >> uint((length-1)*8) & 0xff
			c.AddUint8(uint8(i))
		}
	})
}
func (b *Builder) AddASN1Uint64(v uint64) {
	b.AddASN1(asn1.TagInteger, func(c *Builder) {
		length := 1
		for i := v; i >= 0x80; i >>= 8 {
			length++
		}
		for ; length > 0; length-- {
			i := v >> uint((length-1)*8) & 0xff
			c.AddUint8(uint8(i))
		}
	})
}
func (b *Builder) AddASN1BigInt(n *big.Int) {
	if b.err != nil {
		return
	}
	b.AddASN1(asn1.TagInteger, func(c *Builder) {
		if n.Sign() < 0 {
			nMinus1 := new(big.Int).Neg(n)
			nMinus1.Sub(nMinus1, bigOne)
			bytes := nMinus1.Bytes()
			for i := range bytes {
				bytes[i] ^= 0xff
			}
			if bytes[0]&0x80 == 0 {
				c.add(0xff)
			}
			c.add(bytes...)
		} else if n.Sign() == 0 {
			c.add(0)
		} else {
			bytes := n.Bytes()
			if bytes[0]&0x80 != 0 {
				c.add(0)
			}
			c.add(bytes...)
		}
	})
}
func (b *Builder) AddASN1OctetString(bytes []byte) {
	b.AddASN1(asn1.TagOctetString, func(c *Builder) {
		c.AddBytes(bytes)
	})
}
const generalizedTimeFormatStr = "20060102150405Z0700"
func (b *Builder) AddASN1GeneralizedTime(t time.Time) {
	if t.Year() < 0 || t.Year() > 9999 {
		b.err = fmt.Errorf("cryptobyte: cannot represent %v as a GeneralizedTime", t)
		return
	}
	b.AddASN1(asn1.TagGeneralizedTime, func(c *Builder) {
		c.AddBytes([]byte(t.Format(generalizedTimeFormatStr)))
	})
}
func (b *Builder) AddASN1BitString(s asn1.BitString) {
	b.MarshalASN1(s)
}