@@ -16,7 +16,6 @@ package scti
16
16
17
17
import (
18
18
"context"
19
- "crypto/x509"
20
19
"encoding/base64"
21
20
"encoding/json"
22
21
"errors"
@@ -384,37 +383,6 @@ func deadlineTime(opts *HandlerOptions) time.Time {
384
383
return opts .TimeSource .Now ().Add (opts .Deadline )
385
384
}
386
385
387
- // verifyAddChain is used by add-chain and add-pre-chain. It does the checks that the supplied
388
- // cert is of the correct type and chains to a trusted root.
389
- // TODO(phbnf): add tests
390
- // TODO(phbnf): move to chain_validation.go
391
- func verifyAddChain (log * log , req rfc6962.AddChainRequest , expectingPrecert bool ) ([]* x509.Certificate , error ) {
392
- // We already checked that the chain is not empty so can move on to verification
393
- validPath , err := validateChain (req .Chain , log .chainValidationOpts )
394
- if err != nil {
395
- // We rejected it because the cert failed checks or we could not find a path to a root etc.
396
- // Lots of possible causes for errors
397
- return nil , fmt .Errorf ("chain failed to verify: %s" , err )
398
- }
399
-
400
- isPrecert , err := isPrecertificate (validPath [0 ])
401
- if err != nil {
402
- return nil , fmt .Errorf ("precert test failed: %s" , err )
403
- }
404
-
405
- // The type of the leaf must match the one the handler expects
406
- if isPrecert != expectingPrecert {
407
- if expectingPrecert {
408
- klog .Warningf ("%s: Cert (or precert with invalid CT ext) submitted as precert chain: %q" , log .origin , req .Chain )
409
- } else {
410
- klog .Warningf ("%s: Precert (or cert with invalid CT ext) submitted as cert chain: %q" , log .origin , req .Chain )
411
- }
412
- return nil , fmt .Errorf ("cert / precert mismatch: %T" , expectingPrecert )
413
- }
414
-
415
- return validPath , nil
416
- }
417
-
418
386
// marshalAndWriteAddChainResponse is used by add-chain and add-pre-chain to create and write
419
387
// the JSON response to the client
420
388
func marshalAndWriteAddChainResponse (sct * rfc6962.SignedCertificateTimestamp , w http.ResponseWriter ) error {
0 commit comments