@@ -17,21 +17,20 @@ package loadtest
17
17
import (
18
18
"context"
19
19
"crypto/sha256"
20
+ "crypto/x509"
20
21
"encoding/base64"
21
22
"encoding/json"
22
23
"errors"
23
24
"fmt"
24
25
"math/rand/v2"
25
26
"time"
26
27
27
- "slices"
28
-
29
- "github.com/google/certificate-transparency-go/x509"
30
28
"github.com/transparency-dev/formats/log"
31
29
"github.com/transparency-dev/merkle/proof"
32
30
"github.com/transparency-dev/merkle/rfc6962"
33
31
"github.com/transparency-dev/static-ct/internal/client"
34
32
"github.com/transparency-dev/static-ct/internal/types"
33
+ "github.com/transparency-dev/static-ct/internal/x509util"
35
34
"github.com/transparency-dev/trillian-tessera/api/layout"
36
35
"github.com/transparency-dev/trillian-tessera/ctonly"
37
36
"k8s.io/klog/v2"
@@ -427,7 +426,7 @@ func entryFromChain(chain []*x509.Certificate, isPrecert bool, timestamp uint64)
427
426
428
427
// Next, post-process the DER-encoded TBSCertificate, to remove the CT poison
429
428
// extension and possibly update the issuer field.
430
- defangedTBS , err := x509 .BuildPrecertTBS (cert .RawTBSCertificate , preIssuer )
429
+ defangedTBS , err := x509util .BuildPrecertTBS (cert .RawTBSCertificate , preIssuer )
431
430
if err != nil {
432
431
return nil , fmt .Errorf ("failed to remove poison extension: %v" , err )
433
432
}
@@ -445,6 +444,15 @@ func entryFromChain(chain []*x509.Certificate, isPrecert bool, timestamp uint64)
445
444
// isPreIssuer indicates whether a certificate is a pre-cert issuer with the specific
446
445
// certificate transparency extended key usage.
447
446
// Copied from certificate-transparency-go/serialization.go and internal/scti/handlers.go.
448
- func isPreIssuer (issuer * x509.Certificate ) bool {
449
- return slices .Contains (issuer .ExtKeyUsage , x509 .ExtKeyUsageCertificateTransparency )
447
+ // TODO(phboneff): unify these.
448
+ func isPreIssuer (cert * x509.Certificate ) bool {
449
+ // Look for the extension in the Extensions field and not ExtKeyUsage
450
+ // since the base TLS library does not recognize this extension as
451
+ // an ExtKeyUsage.
452
+ for _ , ext := range cert .Extensions {
453
+ if types .OIDExtKeyUsageCertificateTransparency .Equal (ext .Id ) {
454
+ return true
455
+ }
456
+ }
457
+ return false
450
458
}
0 commit comments