File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package x509ext_test
33import (
44 "crypto/x509"
55 "crypto/x509/pkix"
6+ "encoding/base64"
67 "testing"
78
89 "github.com/RedTeamPentesting/adauth/x509ext"
@@ -31,3 +32,26 @@ func TestSID(t *testing.T) {
3132 t .Fatalf ("parsed SID %s instead of %s" , parsedSID , sid )
3233 }
3334}
35+
36+ func TestParseSID (t * testing.T ) {
37+ expectedSID := "S-1-5-21-3562467320-83266577-1006951523-1141"
38+
39+ testExtensionData , err := base64 .StdEncoding .DecodeString (
40+ "MD6gPAYKKwYBBAGCNxkCAaAuBCxTLTEtNS0yMS0zNTYyNDY3MzIwLTgzMjY2NTc3LTEwMDY5NTE1MjMtMTE0MQ==" ,
41+ )
42+ if err != nil {
43+ t .Fatalf ("decode test extension: %v" , err )
44+ }
45+
46+ sid , err := x509ext .SIDFromExtension (pkix.Extension {
47+ Id : x509ext .NTDSCASecurityExtOID ,
48+ Value : testExtensionData ,
49+ })
50+ if err != nil {
51+ t .Fatalf ("SIDFromExtension: %v" , err )
52+ }
53+
54+ if sid != expectedSID {
55+ t .Fatalf ("extracted SID is %q instead of %q" , sid , expectedSID )
56+ }
57+ }
You can’t perform that action at this time.
0 commit comments