crypto/x509: ParseCertificate returns a certificate with MaxPathLen of -1 if pathLenConstraint is not set #19285
Labels
Documentation
Issues describing a change to documentation.
FrozenDueToAge
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.7.4 darwin/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
I parsed a CA certificate which did not have
pathLenConstraint
set: https://play.golang.org/p/lFCQJQPRLhWhat did you expect to see?
Given the following comment in https://golang.org/pkg/crypto/x509/#Certificate:
and that RFC5280 4.2.1.9 specifies that the
pathLenConstraint
must be >= 0, I expected to seeMaxPathLen
as 0 andMaxPathLenZero
as false.What did you see instead?
MaxPathLen
was -1 andMaxPathLenZero
was false.I don't oppose using
-1
to indicate that it wasn't set, but comments forMaxPathLen
, etc. imply that-1
is not valid. If-1
is a valid value, should the docs be updated and possiblyMaxPathLenZero
be deprecated?The text was updated successfully, but these errors were encountered: