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

crypto/asn1: ASN.1 Marshal with application tag #18873

Closed
kazkansouh opened this issue Jan 31, 2017 · 7 comments
Closed

crypto/asn1: ASN.1 Marshal with application tag #18873

kazkansouh opened this issue Jan 31, 2017 · 7 comments

Comments

@kazkansouh
Copy link

Please answer these questions before submitting your issue. Thanks!

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

go version go1.6.2 linux/amd64

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH=""
GORACE=""
GOROOT="/usr/lib/go-1.6"
GOTOOLDIR="/usr/lib/go-1.6/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

What did you do?

Not an error. I want marshal/unmarshal ASN.1 where the first byte is defined as an application tag, e.g. 0x60. However this is not possible because the encoding/asn1/Marshal function does not allow for the parameters to be configured.

I suggest adding a function "MarshalWithParameters" that allows for some of the parameters to be configured, such as setting the tag to asn1:"application" or adopting a solution similar to the xml encoding XMLName type that augments a given structure with meta data for the encoding.

@bradfitz bradfitz changed the title ASN.1 Marshal with application tag crypto/asn1: ASN.1 Marshal with application tag Jan 31, 2017
@bradfitz bradfitz added this to the Go1.9Maybe milestone Jan 31, 2017
@bradfitz
Copy link
Contributor

I will let @agl decide what to do here. I think he may no longer be accepting changes to this package.

The right answer may be for somebody to start maintaining a fork of the asn1 package outside of the Go tree.

@agl
Copy link
Contributor

agl commented Jan 31, 2017

I'm not adverse to this since I think the complexity cost would probably be quite small. (Brad is correct that, in general however, I regret the design of encoding/asn1 and am hoping, over time, to internally move things onto a different ASN.1 parser.)

@hirochachacha
Copy link
Contributor

Can I send a CL?

func MarshalWithParams(val interface{}, params string) ([]byte, error)

@bradfitz
Copy link
Contributor

@hirochachacha, feel free to send one so we know what it looks like.

@bradfitz bradfitz modified the milestones: Go1.10, Go1.9Maybe May 24, 2017
@hirochachacha
Copy link
Contributor

@bradfitz Thanks. I'll think about it.

@hirochachacha
Copy link
Contributor

I found an another issue #20488.

@gopherbot
Copy link

CL https://golang.org/cl/44111 mentions this issue.

@golang golang locked and limited conversation to collaborators Nov 16, 2018
@rsc rsc unassigned agl Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants