| 1 | package berscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ |
| 2 | |
| 3 | import ( |
| 4 | "bytesscip-go gomod github.com/golang/go/src go1.13 bytes/" |
| 5 | "errorsscip-go gomod github.com/golang/go/src go1.13 errors/" |
| 6 | "fmtscip-go gomod github.com/golang/go/src go1.13 fmt/" |
| 7 | "ioscip-go gomod github.com/golang/go/src go1.13 io/" |
| 8 | "mathscip-go gomod github.com/golang/go/src go1.13 math/" |
| 9 | "osscip-go gomod github.com/golang/go/src go1.13 os/" |
| 10 | "reflectscip-go gomod github.com/golang/go/src go1.13 reflect/" |
| 11 | "timescip-go gomod github.com/golang/go/src go1.13 time/" |
| 12 | "unicode/utf8scip-go gomod github.com/golang/go/src go1.13 `unicode/utf8`/" |
| 13 | ) |
| 14 | |
| 15 | // MaxPacketLengthBytes specifies the maximum allowed packet size when calling ReadPacket or DecodePacket. Set to 0 for |
| 16 | // no limit. |
| 17 | var MaxPacketLengthBytesscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/MaxPacketLengthBytes. int64 = mathscip-go gomod github.com/golang/go/src go1.13 math/.MaxInt32scip-go gomod github.com/golang/go/src go1.13 math/MaxInt32. |
| 18 | |
| 19 | type Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet# struct { |
| 20 | Identifierscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Identifier. |
| 21 | Valuescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Value. interface{} |
| 22 | ByteValuescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#ByteValue. []byte |
| 23 | Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data. *bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer# |
| 24 | Childrenscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Children. []*Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet# |
| 25 | Descriptionscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Description. string |
| 26 | } |
| 27 | |
| 28 | type Identifierscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Identifier# struct { |
| 29 | ClassTypescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Identifier#ClassType. Classscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Class# |
| 30 | TagTypescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Identifier#TagType. Typescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Type# |
| 31 | Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Identifier#Tag. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# |
| 32 | } |
| 33 | |
| 34 | type Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# uint64 |
| 35 | |
| 36 | const ( |
| 37 | TagEOCscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagEOC. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x00 |
| 38 | TagBooleanscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagBoolean. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x01 |
| 39 | TagIntegerscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagInteger. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x02 |
| 40 | TagBitStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagBitString. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x03 |
| 41 | TagOctetStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagOctetString. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x04 |
| 42 | TagNULLscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagNULL. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x05 |
| 43 | TagObjectIdentifierscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagObjectIdentifier. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x06 |
| 44 | TagObjectDescriptorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagObjectDescriptor. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x07 |
| 45 | TagExternalscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagExternal. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x08 |
| 46 | TagRealFloatscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagRealFloat. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x09 |
| 47 | TagEnumeratedscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagEnumerated. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x0a |
| 48 | TagEmbeddedPDVscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagEmbeddedPDV. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x0b |
| 49 | TagUTF8Stringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagUTF8String. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x0c |
| 50 | TagRelativeOIDscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagRelativeOID. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x0d |
| 51 | TagSequencescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagSequence. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x10 |
| 52 | TagSetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagSet. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x11 |
| 53 | TagNumericStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagNumericString. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x12 |
| 54 | TagPrintableStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagPrintableString. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x13 |
| 55 | TagT61Stringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagT61String. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x14 |
| 56 | TagVideotexStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagVideotexString. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x15 |
| 57 | TagIA5Stringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagIA5String. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x16 |
| 58 | TagUTCTimescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagUTCTime. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x17 |
| 59 | TagGeneralizedTimescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagGeneralizedTime. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x18 |
| 60 | TagGraphicStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagGraphicString. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x19 |
| 61 | TagVisibleStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagVisibleString. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x1a |
| 62 | TagGeneralStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagGeneralString. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x1b |
| 63 | TagUniversalStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagUniversalString. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x1c |
| 64 | TagCharacterStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagCharacterString. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x1d |
| 65 | TagBMPStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagBMPString. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x1e |
| 66 | TagBitmaskscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagBitmask. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x1f // xxx11111b |
| 67 | |
| 68 | // HighTag indicates the start of a high-tag byte sequence |
| 69 | HighTagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/HighTag. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x1f // xxx11111b |
| 70 | // HighTagContinueBitmask indicates the high-tag byte sequence should continue |
| 71 | HighTagContinueBitmaskscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/HighTagContinueBitmask. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x80 // 10000000b |
| 72 | // HighTagValueBitmask obtains the tag value from a high-tag byte sequence byte |
| 73 | HighTagValueBitmaskscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/HighTagValueBitmask. Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag# = 0x7f // 01111111b |
| 74 | ) |
| 75 | |
| 76 | const ( |
| 77 | // LengthLongFormBitmask is the mask to apply to the length byte to see if a long-form byte sequence is used |
| 78 | LengthLongFormBitmaskscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/LengthLongFormBitmask. = 0x80 |
| 79 | // LengthValueBitmask is the mask to apply to the length byte to get the number of bytes in the long-form byte sequence |
| 80 | LengthValueBitmaskscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/LengthValueBitmask. = 0x7f |
| 81 | |
| 82 | // LengthIndefinite is returned from readLength to indicate an indefinite length |
| 83 | LengthIndefinitescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/LengthIndefinite. = -1 |
| 84 | ) |
| 85 | |
| 86 | var tagMapscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/tagMap. = map[Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag#]string{ |
| 87 | TagEOCscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagEOC.: "EOC (End-of-Content)", |
| 88 | TagBooleanscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagBoolean.: "Boolean", |
| 89 | TagIntegerscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagInteger.: "Integer", |
| 90 | TagBitStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagBitString.: "Bit String", |
| 91 | TagOctetStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagOctetString.: "Octet String", |
| 92 | TagNULLscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagNULL.: "NULL", |
| 93 | TagObjectIdentifierscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagObjectIdentifier.: "Object Identifier", |
| 94 | TagObjectDescriptorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagObjectDescriptor.: "Object Descriptor", |
| 95 | TagExternalscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagExternal.: "External", |
| 96 | TagRealFloatscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagRealFloat.: "Real (float)", |
| 97 | TagEnumeratedscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagEnumerated.: "Enumerated", |
| 98 | TagEmbeddedPDVscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagEmbeddedPDV.: "Embedded PDV", |
| 99 | TagUTF8Stringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagUTF8String.: "UTF8 String", |
| 100 | TagRelativeOIDscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagRelativeOID.: "Relative-OID", |
| 101 | TagSequencescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagSequence.: "Sequence and Sequence of", |
| 102 | TagSetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagSet.: "Set and Set OF", |
| 103 | TagNumericStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagNumericString.: "Numeric String", |
| 104 | TagPrintableStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagPrintableString.: "Printable String", |
| 105 | TagT61Stringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagT61String.: "T61 String", |
| 106 | TagVideotexStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagVideotexString.: "Videotex String", |
| 107 | TagIA5Stringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagIA5String.: "IA5 String", |
| 108 | TagUTCTimescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagUTCTime.: "UTC Time", |
| 109 | TagGeneralizedTimescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagGeneralizedTime.: "Generalized Time", |
| 110 | TagGraphicStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagGraphicString.: "Graphic String", |
| 111 | TagVisibleStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagVisibleString.: "Visible String", |
| 112 | TagGeneralStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagGeneralString.: "General String", |
| 113 | TagUniversalStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagUniversalString.: "Universal String", |
| 114 | TagCharacterStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagCharacterString.: "Character String", |
| 115 | TagBMPStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagBMPString.: "BMP String", |
| 116 | } |
| 117 | |
| 118 | type Classscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Class# uint8 |
| 119 | |
| 120 | const ( |
| 121 | ClassUniversalscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ClassUniversal. Classscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Class# = 0 // 00xxxxxxb |
| 122 | ClassApplicationscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ClassApplication. Classscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Class# = 64 // 01xxxxxxb |
| 123 | ClassContextscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ClassContext. Classscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Class# = 128 // 10xxxxxxb |
| 124 | ClassPrivatescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ClassPrivate. Classscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Class# = 192 // 11xxxxxxb |
| 125 | ClassBitmaskscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ClassBitmask. Classscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Class# = 192 // 11xxxxxxb |
| 126 | ) |
| 127 | |
| 128 | var ClassMapscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ClassMap. = map[Classscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Class#]string{ |
| 129 | ClassUniversalscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ClassUniversal.: "Universal", |
| 130 | ClassApplicationscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ClassApplication.: "Application", |
| 131 | ClassContextscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ClassContext.: "Context", |
| 132 | ClassPrivatescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ClassPrivate.: "Private", |
| 133 | } |
| 134 | |
| 135 | type Typescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Type# uint8 |
| 136 | |
| 137 | const ( |
| 138 | TypePrimitivescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TypePrimitive. Typescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Type# = 0 // xx0xxxxxb |
| 139 | TypeConstructedscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TypeConstructed. Typescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Type# = 32 // xx1xxxxxb |
| 140 | TypeBitmaskscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TypeBitmask. Typescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Type# = 32 // xx1xxxxxb |
| 141 | ) |
| 142 | |
| 143 | var TypeMapscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TypeMap. = map[Typescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Type#]string{ |
| 144 | TypePrimitivescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TypePrimitive.: "Primitive", |
| 145 | TypeConstructedscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TypeConstructed.: "Constructed", |
| 146 | } |
| 147 | |
| 148 | var Debugscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Debug. = false |
| 149 | |
| 150 | func PrintBytesscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/PrintBytes().(out ioscip-go gomod github.com/golang/go/src go1.13 io/.Writerscip-go gomod github.com/golang/go/src go1.13 io/Writer#, buf []byte, indent string) { |
| 151 | dataLines := make([]string, (len(buf)/30)+1) |
| 152 | numLines := make([]string, (len(buf)/30)+1) |
| 153 | |
| 154 | for i, b := range buf { |
| 155 | dataLines[i/30] += fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("%02x ", b) |
| 156 | numLines[i/30] += fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("%02d ", (i+1)%100) |
| 157 | } |
| 158 | |
| 159 | for i := 0; i < len(dataLines); i++ { |
| 160 | _, _ = out.Writescip-go gomod github.com/golang/go/src go1.13 io/Writer#Write().([]byte(indent + dataLines[i] + "\n")) |
| 161 | _, _ = out.Writescip-go gomod github.com/golang/go/src go1.13 io/Writer#Write().([]byte(indent + numLines[i] + "\n\n")) |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | func WritePacketscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/WritePacket().(out ioscip-go gomod github.com/golang/go/src go1.13 io/.Writerscip-go gomod github.com/golang/go/src go1.13 io/Writer#, p *Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#) { |
| 166 | printPacketscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/printPacket().(out, p, 0, false) |
| 167 | } |
| 168 | |
| 169 | func PrintPacketscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/PrintPacket().(p *Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#) { |
| 170 | printPacketscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/printPacket().(osscip-go gomod github.com/golang/go/src go1.13 os/.Stdoutscip-go gomod github.com/golang/go/src go1.13 os/Stdout., p, 0, false) |
| 171 | } |
| 172 | |
| 173 | func printPacketscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/printPacket().(out ioscip-go gomod github.com/golang/go/src go1.13 io/.Writerscip-go gomod github.com/golang/go/src go1.13 io/Writer#, p *Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#, indent int, printBytes bool) { |
| 174 | indentStr := "" |
| 175 | |
| 176 | for len(indentStr) != indent { |
| 177 | indentStr += " " |
| 178 | } |
| 179 | |
| 180 | classStr := ClassMapscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ClassMap.[p.ClassTypescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Identifier#ClassType.] |
| 181 | |
| 182 | tagTypeStr := TypeMapscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TypeMap.[p.TagTypescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Identifier#TagType.] |
| 183 | |
| 184 | tagStr := fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("0x%02X", p.Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Identifier#Tag.) |
| 185 | |
| 186 | if p.ClassTypescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Identifier#ClassType. == ClassUniversalscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ClassUniversal. { |
| 187 | tagStr = tagMapscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/tagMap.[p.Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Identifier#Tag.] |
| 188 | } |
| 189 | |
| 190 | value := fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintscip-go gomod github.com/golang/go/src go1.13 fmt/Sprint().(p.Valuescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Value.) |
| 191 | description := "" |
| 192 | |
| 193 | if p.Descriptionscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Description. != "" { |
| 194 | description = p.Descriptionscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Description. + ": " |
| 195 | } |
| 196 | |
| 197 | _, _ = fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Fprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Fprintf().(out, "%s%s(%s, %s, %s) Len=%d %q\n", indentStr, description, classStr, tagTypeStr, tagStr, p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Lenscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Len().(), value) |
| 198 | |
| 199 | if printBytes { |
| 200 | PrintBytesscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/PrintBytes().(out, p.Bytesscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Bytes().(), indentStr) |
| 201 | } |
| 202 | |
| 203 | for _, child := range p.Childrenscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Children. { |
| 204 | printPacketscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/printPacket().(out, child, indent+1, printBytes) |
| 205 | } |
| 206 | } |
| 207 | |
| 208 | // ReadPacket reads a single Packet from the reader. |
| 209 | func ReadPacketscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ReadPacket().(reader ioscip-go gomod github.com/golang/go/src go1.13 io/.Readerscip-go gomod github.com/golang/go/src go1.13 io/Reader#) (*Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#, error) { |
| 210 | p, _, err := readPacketscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/readPacket().(reader) |
| 211 | if err != nil { |
| 212 | return nil, err |
| 213 | } |
| 214 | return p, nil |
| 215 | } |
| 216 | |
| 217 | func DecodeStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/DecodeString().(data []byte) string { |
| 218 | return string(data) |
| 219 | } |
| 220 | |
| 221 | func ParseInt64scip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ParseInt64().(bytes []byte) (ret int64, err error) { |
| 222 | if len(bytes) > 8 { |
| 223 | // We'll overflow an int64 in this case. |
| 224 | err = fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("integer too large") |
| 225 | return |
| 226 | } |
| 227 | for bytesRead := 0; bytesRead < len(bytes); bytesRead++ { |
| 228 | ret <<= 8 |
| 229 | ret |= int64(bytes[bytesRead]) |
| 230 | } |
| 231 | |
| 232 | // Shift up and down in order to sign extend the result. |
| 233 | ret <<= 64 - uint8(len(bytes))*8 |
| 234 | ret >>= 64 - uint8(len(bytes))*8 |
| 235 | return |
| 236 | } |
| 237 | |
| 238 | func encodeIntegerscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/encodeInteger().(i int64) []byte { |
| 239 | n := int64Lengthscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/int64Length().(i) |
| 240 | out := make([]byte, n) |
| 241 | |
| 242 | var j int |
| 243 | for ; n > 0; n-- { |
| 244 | out[j] = byte(i >> uint((n-1)*8)) |
| 245 | j++ |
| 246 | } |
| 247 | |
| 248 | return out |
| 249 | } |
| 250 | |
| 251 | func int64Lengthscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/int64Length().(i int64) (numBytes int) { |
| 252 | numBytes = 1 |
| 253 | |
| 254 | for i > 127 { |
| 255 | numBytes++ |
| 256 | i >>= 8 |
| 257 | } |
| 258 | |
| 259 | for i < -128 { |
| 260 | numBytes++ |
| 261 | i >>= 8 |
| 262 | } |
| 263 | |
| 264 | return |
| 265 | } |
| 266 | |
| 267 | // DecodePacket decodes the given bytes into a single Packet |
| 268 | // If a decode error is encountered, nil is returned. |
| 269 | func DecodePacketscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/DecodePacket().(data []byte) *Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet# { |
| 270 | p, _, _ := readPacketscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/readPacket().(bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.NewBufferscip-go gomod github.com/golang/go/src go1.13 bytes/NewBuffer().(data)) |
| 271 | |
| 272 | return p |
| 273 | } |
| 274 | |
| 275 | // DecodePacketErr decodes the given bytes into a single Packet |
| 276 | // If a decode error is encountered, nil is returned. |
| 277 | func DecodePacketErrscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/DecodePacketErr().(data []byte) (*Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#, error) { |
| 278 | p, _, err := readPacketscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/readPacket().(bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.NewBufferscip-go gomod github.com/golang/go/src go1.13 bytes/NewBuffer().(data)) |
| 279 | if err != nil { |
| 280 | return nil, err |
| 281 | } |
| 282 | return p, nil |
| 283 | } |
| 284 | |
| 285 | // readPacket reads a single Packet from the reader, returning the number of bytes read. |
| 286 | func readPacketscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/readPacket().(reader ioscip-go gomod github.com/golang/go/src go1.13 io/.Readerscip-go gomod github.com/golang/go/src go1.13 io/Reader#) (*Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#, int, error) { |
| 287 | identifier, length, read, err := readHeaderscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/readHeader().(reader) |
| 288 | if err != nil { |
| 289 | return nil, read, err |
| 290 | } |
| 291 | |
| 292 | p := &Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#{ |
| 293 | Identifierscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Identifier.: identifier, |
| 294 | } |
| 295 | |
| 296 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data. = new(bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#) |
| 297 | p.Childrenscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Children. = make([]*Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#, 0, 2) |
| 298 | p.Valuescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Value. = nil |
| 299 | |
| 300 | if p.TagTypescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Identifier#TagType. == TypeConstructedscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TypeConstructed. { |
| 301 | // TODO: if universal, ensure tag type is allowed to be constructed |
| 302 | |
| 303 | // Track how much content we've read |
| 304 | contentRead := 0 |
| 305 | for { |
| 306 | if length != LengthIndefinitescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/LengthIndefinite. { |
| 307 | // End if we've read what we've been told to |
| 308 | if contentRead == length { |
| 309 | break |
| 310 | } |
| 311 | // Detect if a packet boundary didn't fall on the expected length |
| 312 | if contentRead > length { |
| 313 | return nil, read, fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("expected to read %d bytes, read %d", length, contentRead) |
| 314 | } |
| 315 | } |
| 316 | |
| 317 | // Read the next packet |
| 318 | child, r, err := readPacketscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/readPacket().(reader) |
| 319 | if err != nil { |
| 320 | return nil, read, err |
| 321 | } |
| 322 | contentRead += r |
| 323 | read += r |
| 324 | |
| 325 | // Test is this is the EOC marker for our packet |
| 326 | if isEOCPacketscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/isEOCPacket().(child) { |
| 327 | if length == LengthIndefinitescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/LengthIndefinite. { |
| 328 | break |
| 329 | } |
| 330 | return nil, read, errorsscip-go gomod github.com/golang/go/src go1.13 errors/.Newscip-go gomod github.com/golang/go/src go1.13 errors/New().("eoc child not allowed with definite length") |
| 331 | } |
| 332 | |
| 333 | // Append and continue |
| 334 | p.AppendChildscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#AppendChild().(child) |
| 335 | } |
| 336 | return p, read, nil |
| 337 | } |
| 338 | |
| 339 | if length == LengthIndefinitescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/LengthIndefinite. { |
| 340 | return nil, read, errorsscip-go gomod github.com/golang/go/src go1.13 errors/.Newscip-go gomod github.com/golang/go/src go1.13 errors/New().("indefinite length used with primitive type") |
| 341 | } |
| 342 | |
| 343 | // Read definite-length content |
| 344 | if MaxPacketLengthBytesscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/MaxPacketLengthBytes. > 0 && int64(length) > MaxPacketLengthBytesscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/MaxPacketLengthBytes. { |
| 345 | return nil, read, fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("length %d greater than maximum %d", length, MaxPacketLengthBytesscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/MaxPacketLengthBytes.) |
| 346 | } |
| 347 | content := make([]byte, length) |
| 348 | if length > 0 { |
| 349 | _, err := ioscip-go gomod github.com/golang/go/src go1.13 io/.ReadFullscip-go gomod github.com/golang/go/src go1.13 io/ReadFull().(reader, content) |
| 350 | if err != nil { |
| 351 | if err == ioscip-go gomod github.com/golang/go/src go1.13 io/.EOFscip-go gomod github.com/golang/go/src go1.13 io/EOF. { |
| 352 | return nil, read, ioscip-go gomod github.com/golang/go/src go1.13 io/.ErrUnexpectedEOFscip-go gomod github.com/golang/go/src go1.13 io/ErrUnexpectedEOF. |
| 353 | } |
| 354 | return nil, read, err |
| 355 | } |
| 356 | read += length |
| 357 | } |
| 358 | |
| 359 | if p.ClassTypescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Identifier#ClassType. == ClassUniversalscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ClassUniversal. { |
| 360 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(content) |
| 361 | p.ByteValuescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#ByteValue. = content |
| 362 | |
| 363 | switch p.Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Identifier#Tag. { |
| 364 | case TagEOCscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagEOC.: |
| 365 | case TagBooleanscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagBoolean.: |
| 366 | val, _ := ParseInt64scip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ParseInt64().(content) |
| 367 | |
| 368 | p.Valuescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Value. = val != 0 |
| 369 | case TagIntegerscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagInteger.: |
| 370 | p.Valuescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Value., _ = ParseInt64scip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ParseInt64().(content) |
| 371 | case TagBitStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagBitString.: |
| 372 | case TagOctetStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagOctetString.: |
| 373 | // the actual string encoding is not known here |
| 374 | // (e.g. for LDAP content is already an UTF8-encoded |
| 375 | // string). Return the data without further processing |
| 376 | p.Valuescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Value. = DecodeStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/DecodeString().(content) |
| 377 | case TagNULLscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagNULL.: |
| 378 | case TagObjectIdentifierscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagObjectIdentifier.: |
| 379 | case TagObjectDescriptorscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagObjectDescriptor.: |
| 380 | case TagExternalscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagExternal.: |
| 381 | case TagRealFloatscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagRealFloat.: |
| 382 | p.Valuescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Value., err = ParseRealscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ParseReal().(content) |
| 383 | case TagEnumeratedscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagEnumerated.: |
| 384 | p.Valuescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Value., _ = ParseInt64scip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ParseInt64().(content) |
| 385 | case TagEmbeddedPDVscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagEmbeddedPDV.: |
| 386 | case TagUTF8Stringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagUTF8String.: |
| 387 | val := DecodeStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/DecodeString().(content) |
| 388 | if !utf8scip-go gomod github.com/golang/go/src go1.13 `unicode/utf8`/.Validscip-go gomod github.com/golang/go/src go1.13 `unicode/utf8`/Valid().([]byte(val)) { |
| 389 | err = errorsscip-go gomod github.com/golang/go/src go1.13 errors/.Newscip-go gomod github.com/golang/go/src go1.13 errors/New().("invalid UTF-8 string") |
| 390 | } else { |
| 391 | p.Valuescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Value. = val |
| 392 | } |
| 393 | case TagRelativeOIDscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagRelativeOID.: |
| 394 | case TagSequencescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagSequence.: |
| 395 | case TagSetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagSet.: |
| 396 | case TagNumericStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagNumericString.: |
| 397 | case TagPrintableStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagPrintableString.: |
| 398 | val := DecodeStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/DecodeString().(content) |
| 399 | if err = isPrintableStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/isPrintableString().(val); err == nil { |
| 400 | p.Valuescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Value. = val |
| 401 | } |
| 402 | case TagT61Stringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagT61String.: |
| 403 | case TagVideotexStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagVideotexString.: |
| 404 | case TagIA5Stringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagIA5String.: |
| 405 | val := DecodeStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/DecodeString().(content) |
| 406 | for i, c := range val { |
| 407 | if c >= 0x7F { |
| 408 | err = fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("invalid character for IA5String at pos %d: %c", i, c) |
| 409 | break |
| 410 | } |
| 411 | } |
| 412 | if err == nil { |
| 413 | p.Valuescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Value. = val |
| 414 | } |
| 415 | case TagUTCTimescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagUTCTime.: |
| 416 | case TagGeneralizedTimescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagGeneralizedTime.: |
| 417 | p.Valuescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Value., err = ParseGeneralizedTimescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ParseGeneralizedTime().(content) |
| 418 | case TagGraphicStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagGraphicString.: |
| 419 | case TagVisibleStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagVisibleString.: |
| 420 | case TagGeneralStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagGeneralString.: |
| 421 | case TagUniversalStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagUniversalString.: |
| 422 | case TagCharacterStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagCharacterString.: |
| 423 | case TagBMPStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagBMPString.: |
| 424 | } |
| 425 | } else { |
| 426 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(content) |
| 427 | } |
| 428 | |
| 429 | return p, read, err |
| 430 | } |
| 431 | |
| 432 | func isPrintableStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/isPrintableString().(val string) error { |
| 433 | for i, c := range val { |
| 434 | switch { |
| 435 | case c >= 'a' && c <= 'z': |
| 436 | case c >= 'A' && c <= 'Z': |
| 437 | case c >= '0' && c <= '9': |
| 438 | default: |
| 439 | switch c { |
| 440 | case '\'', '(', ')', '+', ',', '-', '.', '=', '/', ':', '?', ' ': |
| 441 | default: |
| 442 | return fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.13 fmt/Errorf().("invalid character in position %d", i) |
| 443 | } |
| 444 | } |
| 445 | } |
| 446 | return nil |
| 447 | } |
| 448 | |
| 449 | func (p *Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#) Bytesscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Bytes().() []byte { |
| 450 | var out bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer# |
| 451 | |
| 452 | out.Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(encodeIdentifierscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/encodeIdentifier().(p.Identifierscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Identifier.)) |
| 453 | out.Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(encodeLengthscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/encodeLength().(p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Lenscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Len().())) |
| 454 | out.Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Bytesscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Bytes().()) |
| 455 | |
| 456 | return out.Bytesscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Bytes().() |
| 457 | } |
| 458 | |
| 459 | func (p *Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#) AppendChildscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#AppendChild().(child *Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#) { |
| 460 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(child.Bytesscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Bytes().()) |
| 461 | p.Childrenscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Children. = append(p.Childrenscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Children., child) |
| 462 | } |
| 463 | |
| 464 | func Encodescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Encode().(classType Classscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Class#, tagType Typescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Type#, tag Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag#, value interface{}, description string) *Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet# { |
| 465 | p := new(Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#) |
| 466 | |
| 467 | p.ClassTypescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Identifier#ClassType. = classType |
| 468 | p.TagTypescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Identifier#TagType. = tagType |
| 469 | p.Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Identifier#Tag. = tag |
| 470 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data. = new(bytesscip-go gomod github.com/golang/go/src go1.13 bytes/.Bufferscip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#) |
| 471 | |
| 472 | p.Childrenscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Children. = make([]*Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#, 0, 2) |
| 473 | |
| 474 | p.Valuescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Value. = value |
| 475 | p.Descriptionscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Description. = description |
| 476 | |
| 477 | if value != nil { |
| 478 | v := reflectscip-go gomod github.com/golang/go/src go1.13 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.13 reflect/ValueOf().(value) |
| 479 | |
| 480 | if classType == ClassUniversalscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ClassUniversal. { |
| 481 | switch tag { |
| 482 | case TagOctetStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagOctetString.: |
| 483 | sv, ok := v.Interfacescip-go gomod github.com/golang/go/src go1.13 reflect/Value#Interface().().(string) |
| 484 | |
| 485 | if ok { |
| 486 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().([]byte(sv)) |
| 487 | } |
| 488 | case TagEnumeratedscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagEnumerated.: |
| 489 | bv, ok := v.Interfacescip-go gomod github.com/golang/go/src go1.13 reflect/Value#Interface().().([]byte) |
| 490 | if ok { |
| 491 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(bv) |
| 492 | } |
| 493 | case TagEmbeddedPDVscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagEmbeddedPDV.: |
| 494 | bv, ok := v.Interfacescip-go gomod github.com/golang/go/src go1.13 reflect/Value#Interface().().([]byte) |
| 495 | if ok { |
| 496 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(bv) |
| 497 | } |
| 498 | } |
| 499 | } else if classType == ClassContextscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ClassContext. { |
| 500 | switch tag { |
| 501 | case TagEnumeratedscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagEnumerated.: |
| 502 | bv, ok := v.Interfacescip-go gomod github.com/golang/go/src go1.13 reflect/Value#Interface().().([]byte) |
| 503 | if ok { |
| 504 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(bv) |
| 505 | } |
| 506 | case TagEmbeddedPDVscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagEmbeddedPDV.: |
| 507 | bv, ok := v.Interfacescip-go gomod github.com/golang/go/src go1.13 reflect/Value#Interface().().([]byte) |
| 508 | if ok { |
| 509 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(bv) |
| 510 | } |
| 511 | } |
| 512 | } |
| 513 | } |
| 514 | return p |
| 515 | } |
| 516 | |
| 517 | func NewSequencescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/NewSequence().(description string) *Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet# { |
| 518 | return Encodescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Encode().(ClassUniversalscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/ClassUniversal., TypeConstructedscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TypeConstructed., TagSequencescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/TagSequence., nil, description) |
| 519 | } |
| 520 | |
| 521 | func NewBooleanscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/NewBoolean().(classType Classscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Class#, tagType Typescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Type#, tag Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag#, value bool, description string) *Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet# { |
| 522 | intValue := int64(0) |
| 523 | |
| 524 | if value { |
| 525 | intValue = 1 |
| 526 | } |
| 527 | |
| 528 | p := Encodescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Encode().(classType, tagType, tag, nil, description) |
| 529 | |
| 530 | p.Valuescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Value. = value |
| 531 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(encodeIntegerscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/encodeInteger().(intValue)) |
| 532 | |
| 533 | return p |
| 534 | } |
| 535 | |
| 536 | // NewLDAPBoolean returns a RFC 4511-compliant Boolean packet. |
| 537 | func NewLDAPBooleanscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/NewLDAPBoolean().(classType Classscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Class#, tagType Typescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Type#, tag Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag#, value bool, description string) *Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet# { |
| 538 | intValue := int64(0) |
| 539 | |
| 540 | if value { |
| 541 | intValue = 255 |
| 542 | } |
| 543 | |
| 544 | p := Encodescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Encode().(classType, tagType, tag, nil, description) |
| 545 | |
| 546 | p.Valuescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Value. = value |
| 547 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(encodeIntegerscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/encodeInteger().(intValue)) |
| 548 | |
| 549 | return p |
| 550 | } |
| 551 | |
| 552 | func NewIntegerscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/NewInteger().(classType Classscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Class#, tagType Typescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Type#, tag Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag#, value interface{}, description string) *Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet# { |
| 553 | p := Encodescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Encode().(classType, tagType, tag, nil, description) |
| 554 | |
| 555 | p.Valuescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Value. = value |
| 556 | switch v := value.(type) { |
| 557 | case int: |
| 558 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(encodeIntegerscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/encodeInteger().(int64(v))) |
| 559 | case uint: |
| 560 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(encodeIntegerscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/encodeInteger().(int64(v))) |
| 561 | case int64: |
| 562 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(encodeIntegerscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/encodeInteger().(v)) |
| 563 | case uint64: |
| 564 | // TODO : check range or add encodeUInt... |
| 565 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(encodeIntegerscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/encodeInteger().(int64(v))) |
| 566 | case int32: |
| 567 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(encodeIntegerscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/encodeInteger().(int64(v))) |
| 568 | case uint32: |
| 569 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(encodeIntegerscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/encodeInteger().(int64(v))) |
| 570 | case int16: |
| 571 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(encodeIntegerscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/encodeInteger().(int64(v))) |
| 572 | case uint16: |
| 573 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(encodeIntegerscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/encodeInteger().(int64(v))) |
| 574 | case int8: |
| 575 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(encodeIntegerscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/encodeInteger().(int64(v))) |
| 576 | case uint8: |
| 577 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(encodeIntegerscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/encodeInteger().(int64(v))) |
| 578 | default: |
| 579 | // TODO : add support for big.Int ? |
| 580 | panic(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("Invalid type %T, expected {u|}int{64|32|16|8}", v)) |
| 581 | } |
| 582 | |
| 583 | return p |
| 584 | } |
| 585 | |
| 586 | func NewStringscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/NewString().(classType Classscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Class#, tagType Typescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Type#, tag Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag#, value, description string) *Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet# { |
| 587 | p := Encodescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Encode().(classType, tagType, tag, nil, description) |
| 588 | |
| 589 | p.Valuescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Value. = value |
| 590 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().([]byte(value)) |
| 591 | |
| 592 | return p |
| 593 | } |
| 594 | |
| 595 | func NewGeneralizedTimescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/NewGeneralizedTime().(classType Classscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Class#, tagType Typescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Type#, tag Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag#, value timescip-go gomod github.com/golang/go/src go1.13 time/.Timescip-go gomod github.com/golang/go/src go1.13 time/Time#, description string) *Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet# { |
| 596 | p := Encodescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Encode().(classType, tagType, tag, nil, description) |
| 597 | var s string |
| 598 | if value.Nanosecondscip-go gomod github.com/golang/go/src go1.13 time/Time#Nanosecond().() != 0 { |
| 599 | s = value.Formatscip-go gomod github.com/golang/go/src go1.13 time/Time#Format().(`20060102150405.000000000Z`) |
| 600 | } else { |
| 601 | s = value.Formatscip-go gomod github.com/golang/go/src go1.13 time/Time#Format().(`20060102150405Z`) |
| 602 | } |
| 603 | p.Valuescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Value. = s |
| 604 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().([]byte(s)) |
| 605 | return p |
| 606 | } |
| 607 | |
| 608 | func NewRealscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/NewReal().(classType Classscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Class#, tagType Typescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Type#, tag Tagscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Tag#, value interface{}, description string) *Packetscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet# { |
| 609 | p := Encodescip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Encode().(classType, tagType, tag, nil, description) |
| 610 | |
| 611 | switch v := value.(type) { |
| 612 | case float64: |
| 613 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(encodeFloatscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/encodeFloat().(v)) |
| 614 | case float32: |
| 615 | p.Datascip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/Packet#Data..Writescip-go gomod github.com/golang/go/src go1.13 bytes/Buffer#Write().(encodeFloatscip-go gomod github.com/go-asn1-ber/asn1-ber . `github.com/go-asn1-ber/asn1-ber`/encodeFloat().(float64(v))) |
| 616 | default: |
| 617 | panic(fmtscip-go gomod github.com/golang/go/src go1.13 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.13 fmt/Sprintf().("Invalid type %T, expected float{64|32}", v)) |
| 618 | } |
| 619 | return p |
| 620 | } |