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/x509: Certificate Subject UID not being parsed #25667

Closed
Trane9991 opened this issue May 31, 2018 · 4 comments
Closed

crypto/x509: Certificate Subject UID not being parsed #25667

Trane9991 opened this issue May 31, 2018 · 4 comments

Comments

@Trane9991
Copy link

@Trane9991 Trane9991 commented May 31, 2018

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

1.10.2

Does this issue reproduce with the latest release?

Yes

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

GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"

What did you do?

Trying to get the UID from certificate attributes.

What did you expect to see?

pkix.Name object with the UID field in it.

What did you see instead?

OID for the UserID http://www.alvestrand.no/objectid/0.9.2342.19200300.100.1.1.html is not defined in the https://golang.org/src/crypto/x509/pkix/pkix.go, so it is not being parsed.

@adamdecaf
Copy link
Contributor

@adamdecaf adamdecaf commented May 31, 2018

@bradfitz bradfitz added this to the Go1.12 milestone May 31, 2018
@bradfitz bradfitz changed the title x509 Certificate Subject UID not being parsed crypto/x509: Certificate Subject UID not being parsed May 31, 2018
@odeke-em
Copy link
Member

@odeke-em odeke-em commented Jun 1, 2018

/cc @agl too

@FiloSottile
Copy link
Member

@FiloSottile FiloSottile commented Jun 1, 2018

It should still be accessible unparsed in the Names field.

If you think we should add an entry to the struct for it, we'll need example certificates and the use cases of it. We intentionally only parse the most popular OIDs, and leave the rest to be parsed by applications in Names.

@FiloSottile FiloSottile modified the milestones: Go1.12, Unplanned Jun 1, 2018
@Trane9991
Copy link
Author

@Trane9991 Trane9991 commented Jun 1, 2018

Yeah, I was able to get it this way: https://stackoverflow.com/questions/39125873/golang-subject-dn-from-x509-cert/50640119#50640119, but thanks for your reply, it is simple to get it from Names field (I will update my SO reply with this approach).

I'm using this to get the UID from Apple Push Notifications Certificates since app bundle id is stored there. But I think reading it from Names field is enough for my use case and I can close this issue. Let's reopen if there is more demand for this field.

@Trane9991 Trane9991 closed this Jun 1, 2018
@golang golang locked and limited conversation to collaborators Jun 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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