8000 proposal: encoding/asn1: support for generalstring by struct tag · Issue #18832 · golang/go · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

proposal: encoding/asn1: support for generalstring by struct tag #18832

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

Open
jcmturner opened this issue Jan 28, 2017 · 4 comments
Open

proposal: encoding/asn1: support for generalstring by struct tag #18832

jcmturner opened this issue Jan 28, 2017 · 4 comments
Labels
Proposal Proposal-Crypto Proposal related to crypto packages or other security issues
Milestone

Comments

@jcmturner
Copy link
jcmturner commented Jan 28, 2017

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

go version go1.7.5 linux/amd64

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GORACE=""
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build372878858=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1

The issue

Using "encoding/asn1" it is not possible to marshal into a an asn1 general string. It is possible to unmarshal from one but it is only possible to marshal into one of ia5, printable or utf8.
https://play.golang.org/p/cwv9ZGV5K5

Suggestion

There should be an struct tag such as "generalstring" that works in the same way as the "ia5" tag but sets the asn1 tag value of 27.

@vcabbage vcabbage changed the title ASN1: Cannot marshal into a GeneralString encoding/asn1: cannot marshal into a GeneralString Jan 28, 2017
@bradfitz bradfitz added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Mar 21, 2017
@bradfitz bradfitz added this to the Unplanned milestone Mar 21, 2017
8000 jcmturner added a commit to jcmturner/go that referenced this issue Sep 9, 2018
The current implementation cannot marshal a string into asn1 general
string encoded bytes. This capability has been added.

Fixes golang#18832
jcmturner added a commit to jcmturner/go that referenced this issue Sep 9, 2018
The current implementation cannot marshal a string into asn1 general
string encoded bytes. This capability has been added.

Fixes golang#18832
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/134223 mentions this issue: encoding/asn1: add ability to marshal to general string

@agnivade
Copy link
Contributor
agnivade commented Oct 8, 2019

/cc @FiloSottile

@johanbrandhorst
Copy link
Member

I wanted to revive this issue as a proposal, would it be better to open a new issue or can we reuse this one? I believe the suggestion is pretty straightforward - add a new struct tag to the encoding/asn1 package, generalstring that will marshal a string field using the GeneralString ASN.1 tag (27). The GeneralString type is used extensively by protocols such as Kerberos (RFC 1510, RFC 4120).

@seankhliao seankhliao changed the title encoding/asn1: cannot marshal into a GeneralString proposal: encoding/asn1: support for generalstring by struct tag Mar 11, 2025
@gopherbot gopherbot added Proposal and removed NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. labels Mar 11, 2025
@seankhliao seankhliao modified the milestones: Unplanned, Proposal Mar 11, 2025
@ianlancetaylor ianlancetaylor moved this to Incoming in Proposals Mar 12, 2025
@ianlancetaylor ianlancetaylor added the Proposal-Crypto Proposal related to crypto packages or other security issues label Mar 12, 2025
@ianlancetaylor
Copy link
Contributor

CC @golang/security

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Proposal Proposal-Crypto Proposal related to crypto packages or other security issues
Projects
Status: Incoming
Development

Successfully merging a pull request may close this issue.

8 participants
0