Skip to content

Commit 7b7557c

Browse files
x509ext: Remove error returned by SID(...) when extension is not present
1 parent ea51cc5 commit 7b7557c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

x509ext/sid.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ func NewNTDSCaSecurityExt(sid string) (ext pkix.Extension, err error) {
5353
return ext, nil
5454
}
5555

56-
// SID retrieves the SID from the szOID_NTDS_CA_SECURITY_EXT extension of the
57-
// certificate if it is present and returns an error otherwise.
56+
// SID retrieves the SID from the szOID_NTDS_CA_SECURITY_EXT extension and an
57+
// empty string with no error when the extension is not present.
5858
func SID(cert *x509.Certificate) (string, error) {
5959
for _, extension := range append(cert.Extensions, cert.ExtraExtensions...) {
6060
if !extension.Id.Equal(NTDSCASecurityExtOID) {
@@ -64,7 +64,7 @@ func SID(cert *x509.Certificate) (string, error) {
6464
return SIDFromExtension(extension)
6565
}
6666

67-
return "", fmt.Errorf("certificate has no NTDS_CA_SECURITY_EXT extension")
67+
return "", nil
6868
}
6969

7070
// SID retrieves the SID from the szOID_NTDS_CA_SECURITY_EXT extension.

0 commit comments

Comments
 (0)