Fix setter of basic constraints.

pull/312/head
Mariano Cano 4 years ago
parent 068bafe5a3
commit 0847af16cb

@ -293,9 +293,17 @@ type BasicConstraints struct {
// Set sets the basic constraints to the given certificate.
func (b BasicConstraints) Set(c *x509.Certificate) {
c.IsCA = b.IsCA
if c.IsCA {
c.BasicConstraintsValid = true
switch {
case b.MaxPathLen == 0:
c.MaxPathLen = b.MaxPathLen
if c.MaxPathLen < 0 {
c.MaxPathLenZero = true
case b.MaxPathLen < 0:
c.MaxPathLen = -1
default:
c.MaxPathLen = b.MaxPathLen
}
}
}

Loading…
Cancel
Save