Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding/asn1: support indefinite form #42021

Closed
lxShaDoWxl opened this issue Oct 16, 2020 · 3 comments
Closed

encoding/asn1: support indefinite form #42021

lxShaDoWxl opened this issue Oct 16, 2020 · 3 comments
Milestone

Comments

@lxShaDoWxl
Copy link

@lxShaDoWxl lxShaDoWxl commented Oct 16, 2020

Hi! asn1 encode incorrect support ISO/IEC 8825-1:2015
https://www.itu.int/ITU-T/recommendations/rec.aspx?rec=12483&lang=ru

Length octets
Two forms of length octets are specified. These are:
a) the definite form (see 8.1.3.3); and
b) the indefinite form (see 8.1.3.6).

not work form "b"

What version of Go are you using (go version)?

$ go version
go version go1.14.9 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/viktor/.cache/go-build"
GOENV="/home/viktor/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/viktor/main/projects/golang"
GOPRIVATE=""
GOPROXY="direct"
GOROOT="/usr/lib/golang"
GOSUMDB="off"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/golang/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/viktor/main/projects/golang/src/incraft/soap-test/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build647107160=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Usage asn1.Unmarshal
https://play.golang.org/p/a1FhCy3nUvj

What did you expect to see?

success unmarshal bytes

What did you see instead?

asn1: syntax error: indefinite length found (not DER)

@lxShaDoWxl lxShaDoWxl changed the title bugs: asn1 encode no supports indefinite form asn1 encode no supports indefinite form Oct 16, 2020
@toothrot toothrot changed the title asn1 encode no supports indefinite form encoding/asn1: support indefinite form Oct 16, 2020
@toothrot toothrot added this to the Backlog milestone Oct 16, 2020
@toothrot
Copy link
Contributor

@toothrot toothrot commented Oct 16, 2020

See also #12267

/cc @FiloSottile @agl

@lxShaDoWxl
Copy link
Author

@lxShaDoWxl lxShaDoWxl commented Oct 17, 2020

bad no support BER (Basic Encoding Rules)
it wasn't just called basic))

@FiloSottile
Copy link
Member

@FiloSottile FiloSottile commented Oct 19, 2020

encoding/asn1 intentionally only implements DER, as that's what almost all cryptography packages that depend on it need.

Package asn1 implements parsing of DER-encoded ASN.1 data structures, as defined in ITU-T Rec X.690.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.