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: error for "trailing data after X.509 subject" should say "issuer" instead #35841

Open
egonk opened this issue Nov 26, 2019 · 2 comments
Assignees
Labels
Milestone

Comments

@egonk
Copy link

@egonk egonk commented Nov 26, 2019

See the following error in parseCertificate:

return nil, errors.New("x509: trailing data after X.509 subject")

It should probably say issuer, not subject.

Edit:

	var issuer, subject pkix.RDNSequence
	if rest, err := asn1.Unmarshal(in.TBSCertificate.Subject.FullBytes, &subject); err != nil {
		return nil, err
	} else if len(rest) != 0 {
		return nil, errors.New("x509: trailing data after X.509 subject")
	}
	if rest, err := asn1.Unmarshal(in.TBSCertificate.Issuer.FullBytes, &issuer); err != nil {
		return nil, err
	} else if len(rest) != 0 {
		return nil, errors.New("x509: trailing data after X.509 subject")
	}
@toothrot toothrot self-assigned this Nov 26, 2019
@toothrot toothrot added the NeedsFix label Nov 26, 2019
@toothrot toothrot added this to the Go1.14 milestone Nov 26, 2019
@toothrot

This comment has been minimized.

Copy link
Contributor

@toothrot toothrot commented Nov 26, 2019

This looks pretty clearly incorrect. I'll take a look at this.

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Nov 26, 2019

Change https://golang.org/cl/208978 mentions this issue: crypto/x509: correct error message for trailing issuer data

@toothrot toothrot modified the milestones: Go1.14, Go1.15 Nov 26, 2019
@odeke-em odeke-em changed the title x509: trailing data after X.509 subject / issuer crypto/x509: error for "trailing data after X.509 subject" should say "issuer" instead Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.