@@ -26,17 +26,28 @@ import (
26
26
"github.com/scionproto/scion/pkg/metrics"
27
27
"github.com/scionproto/scion/pkg/private/serrors"
28
28
"github.com/scionproto/scion/pkg/private/util"
29
+ cryptopb "github.com/scionproto/scion/pkg/proto/crypto"
29
30
seg "github.com/scionproto/scion/pkg/segment"
30
31
"github.com/scionproto/scion/pkg/segment/extensions/digest"
31
32
"github.com/scionproto/scion/pkg/segment/extensions/epic"
32
33
"github.com/scionproto/scion/pkg/slayers/path"
33
- "github.com/scionproto/scion/private/trust"
34
34
)
35
35
36
36
// SignerGen generates signers and returns their expiration time.
37
37
type SignerGen interface {
38
38
// Generate generates a signer it.
39
- Generate (ctx context.Context ) (trust.Signer , error )
39
+ Generate (ctx context.Context ) (Signer , error )
40
+ }
41
+
42
+ type Signer interface {
43
+ Sign (context.Context , []byte , ... []byte ) (* cryptopb.SignedMessage , error )
44
+ GetExpiration () time.Time
45
+ }
46
+
47
+ type SignerGenFunc func (ctx context.Context ) (Signer , error )
48
+
49
+ func (f SignerGenFunc ) Generate (ctx context.Context ) (Signer , error ) {
50
+ return f (ctx )
40
51
}
41
52
42
53
// Extender extends path segments.
@@ -104,14 +115,14 @@ func (s *DefaultExtender) Extend(
104
115
}
105
116
// Make sure the hop expiration time is not longer than the signer expiration time.
106
117
expTime := s .MaxExpTime ()
107
- if ts .Add (path .ExpTimeToDuration (expTime )).After (signer .Expiration ) {
118
+ if ts .Add (path .ExpTimeToDuration (expTime )).After (signer .GetExpiration () ) {
108
119
metrics .GaugeSet (s .SegmentExpirationDeficient , 1 )
109
120
var err error
110
- expTime , err = path .ExpTimeFromDuration (signer .Expiration .Sub (ts ))
121
+ expTime , err = path .ExpTimeFromDuration (signer .GetExpiration () .Sub (ts ))
111
122
if err != nil {
112
123
return serrors .WrapStr (
113
124
"calculating expiry time from signer expiration time" , err ,
114
- "signer_expiration" , signer .Expiration ,
125
+ "signer_expiration" , signer .GetExpiration () ,
115
126
)
116
127
}
117
128
} else {
0 commit comments