Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Zheng <[email protected]>
  • Loading branch information
Two-Hearts committed Nov 22, 2024
1 parent 0fcd116 commit b606f89
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions internal/timestamp/timestamp.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ func Timestamp(req *signature.SignRequest, opts tspclient.RequestOptions) ([]byt
return nil, err
}
// certificate chain revocation check after timestamping
if req.RevocationTimestampingValidator != nil {
certResults, err := req.RevocationTimestampingValidator.ValidateContext(ctx, revocation.ValidateContextOptions{
if req.TSARevocationValidator != nil {
certResults, err := req.TSARevocationValidator.ValidateContext(ctx, revocation.ValidateContextOptions{
CertChain: tsaCertChain,
})
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions internal/timestamp/timestamp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func TestTimestamp(t *testing.T) {
req := &signature.SignRequest{
Timestamper: timestamper,
TSARootCAs: rootCAs,
RevocationTimestampingValidator: &dummyTimestampRevocationValidator{
TSARevocationValidator: &dummyTSARevocationValidator{
failOnValidate: true,
},
}
Expand All @@ -159,7 +159,7 @@ func TestTimestamp(t *testing.T) {
req := &signature.SignRequest{
Timestamper: timestamper,
TSARootCAs: rootCAs,
RevocationTimestampingValidator: &dummyTimestampRevocationValidator{
TSARevocationValidator: &dummyTSARevocationValidator{
revoked: true,
},
}
Expand Down Expand Up @@ -324,12 +324,12 @@ func (d dummyTimestamper) Timestamp(context.Context, *tspclient.Request) (*tspcl
return nil, errors.New("failed to timestamp")
}

type dummyTimestampRevocationValidator struct {
type dummyTSARevocationValidator struct {
failOnValidate bool
revoked bool
}

func (v *dummyTimestampRevocationValidator) ValidateContext(ctx context.Context, validateContextOpts revocation.ValidateContextOptions) ([]*result.CertRevocationResult, error) {
func (v *dummyTSARevocationValidator) ValidateContext(ctx context.Context, validateContextOpts revocation.ValidateContextOptions) ([]*result.CertRevocationResult, error) {
if v.failOnValidate {
return nil, errors.New("failed in ValidateContext")
}
Expand Down
4 changes: 2 additions & 2 deletions signature/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ type SignRequest struct {
// TSARootCAs is the set of caller trusted TSA root certificates
TSARootCAs *x509.CertPool

// RevocationTimestampingValidator is used for timestamping certificate
// TSARevocationValidator is used for timestamping certificate
// chain revocation check after signing.
// When present, only used when timestamping is performed.
RevocationTimestampingValidator revocation.Validator
TSARevocationValidator revocation.Validator

// ctx is the caller context. It should only be modified via WithContext.
// It is unexported to prevent people from using Context wrong
Expand Down

0 comments on commit b606f89

Please sign in to comment.