mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
crypto/x509: update MaxPathLen & MaxPathLenZero docs
Fixes #19285 Change-Id: I11e864eff9980dec8247c47e4c600f76602e7ada Reviewed-on: https://go-review.googlesource.com/46092 Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
855d823d2d
commit
3ca8ee14d1
1 changed files with 28 additions and 13 deletions
|
|
@ -665,13 +665,28 @@ type Certificate struct {
|
||||||
ExtKeyUsage []ExtKeyUsage // Sequence of extended key usages.
|
ExtKeyUsage []ExtKeyUsage // Sequence of extended key usages.
|
||||||
UnknownExtKeyUsage []asn1.ObjectIdentifier // Encountered extended key usages unknown to this package.
|
UnknownExtKeyUsage []asn1.ObjectIdentifier // Encountered extended key usages unknown to this package.
|
||||||
|
|
||||||
BasicConstraintsValid bool // if true then the next two fields are valid.
|
// BasicConstraintsValid indicates whether IsCA, MaxPathLen,
|
||||||
|
// and MaxPathLenZero are valid.
|
||||||
|
BasicConstraintsValid bool
|
||||||
IsCA bool
|
IsCA bool
|
||||||
MaxPathLen int
|
|
||||||
// MaxPathLenZero indicates that BasicConstraintsValid==true and
|
// MaxPathLen and MaxPathLenZero indicate the presence and
|
||||||
// MaxPathLen==0 should be interpreted as an actual maximum path length
|
// value of the BasicConstraints' "pathLenConstraint".
|
||||||
// of zero. Otherwise, that combination is interpreted as MaxPathLen
|
//
|
||||||
// not being set.
|
// When parsing a certificate, a positive non-zero MaxPathLen
|
||||||
|
// means that the field was specified, -1 means it was unset,
|
||||||
|
// and MaxPathLenZero being true mean that the field was
|
||||||
|
// explicitly set to zero. The case of MaxPathLen==0 with MaxPathLenZero==false
|
||||||
|
// should be treated equivalent to -1 (unset).
|
||||||
|
//
|
||||||
|
// When generating a certificate, an unset pathLenConstraint
|
||||||
|
// can be requested with either MaxPathLen == -1 or using the
|
||||||
|
// zero value for both MaxPathLen and MaxPathLenZero.
|
||||||
|
MaxPathLen int
|
||||||
|
// MaxPathLenZero indicates that BasicConstraintsValid==true
|
||||||
|
// and MaxPathLen==0 should be interpreted as an actual
|
||||||
|
// maximum path length of zero. Otherwise, that combination is
|
||||||
|
// interpreted as MaxPathLen not being set.
|
||||||
MaxPathLenZero bool
|
MaxPathLenZero bool
|
||||||
|
|
||||||
SubjectKeyId []byte
|
SubjectKeyId []byte
|
||||||
|
|
@ -1149,7 +1164,7 @@ func parseCertificate(in *certificate) (*Certificate, error) {
|
||||||
out.IsCA = constraints.IsCA
|
out.IsCA = constraints.IsCA
|
||||||
out.MaxPathLen = constraints.MaxPathLen
|
out.MaxPathLen = constraints.MaxPathLen
|
||||||
out.MaxPathLenZero = out.MaxPathLen == 0
|
out.MaxPathLenZero = out.MaxPathLen == 0
|
||||||
|
// TODO: map out.MaxPathLen to 0 if it has the -1 default value? (Issue 19285)
|
||||||
case 17:
|
case 17:
|
||||||
out.DNSNames, out.EmailAddresses, out.IPAddresses, err = parseSANExtension(e.Value)
|
out.DNSNames, out.EmailAddresses, out.IPAddresses, err = parseSANExtension(e.Value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -1717,12 +1732,12 @@ func signingParamsForPublicKey(pub interface{}, requestedSigAlgo SignatureAlgori
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateCertificate creates a new certificate based on a template. The
|
// CreateCertificate creates a new certificate based on a template.
|
||||||
// following members of template are used: AuthorityKeyId,
|
// The following members of template are used: AuthorityKeyId,
|
||||||
// BasicConstraintsValid, DNSNames, ExcludedDNSDomains, ExtKeyUsage, IsCA,
|
// BasicConstraintsValid, DNSNames, ExcludedDNSDomains, ExtKeyUsage,
|
||||||
// KeyUsage, MaxPathLen, NotAfter, NotBefore, PermittedDNSDomains,
|
// IsCA, KeyUsage, MaxPathLen, MaxPathLenZero, NotAfter, NotBefore,
|
||||||
// PermittedDNSDomainsCritical, SerialNumber, SignatureAlgorithm, Subject,
|
// PermittedDNSDomains, PermittedDNSDomainsCritical, SerialNumber,
|
||||||
// SubjectKeyId, and UnknownExtKeyUsage.
|
// SignatureAlgorithm, Subject, SubjectKeyId, and UnknownExtKeyUsage.
|
||||||
//
|
//
|
||||||
// The certificate is signed by parent. If parent is equal to template then the
|
// The certificate is signed by parent. If parent is equal to template then the
|
||||||
// certificate is self-signed. The parameter pub is the public key of the
|
// certificate is self-signed. The parameter pub is the public key of the
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue