Skip to content

Commit 7e5c8aa

Browse files
committed
fix(certs): Download cert can now download a cert w/o a chain
1 parent 344d35d commit 7e5c8aa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

v2/api/certificate.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,15 @@ func (c *Client) DownloadCertificate(certId int, thumbprint string, serialNumber
168168
}
169169

170170
//todo: review this as it seems to be returning the wrong cert
171-
leaf := certs.Certificates[1]
172171

172+
var leaf *x509.Certificate
173173
if len(certs.Certificates) > 1 {
174+
//leaf is last cert in chain
175+
leaf = certs.Certificates[len(certs.Certificates)-1]
174176
return leaf, certs.Certificates, nil
175177
}
176178

177-
return leaf, nil, nil
179+
return certs.Certificates[0], nil, nil
178180
}
179181

180182
// EnrollCSR takes arguments for EnrollCSRFctArgs to enroll a passed Certificate Signing

0 commit comments

Comments
 (0)