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