|
|
@@ -104,7 +104,7 @@ func TestValidateCert(t *testing.T) {
|
|
|
t.Fatalf("got %v (%T), want *Certificate", key, key)
|
|
|
}
|
|
|
checker := CertChecker{}
|
|
|
- checker.IsAuthority = func(k PublicKey) bool {
|
|
|
+ checker.IsUserAuthority = func(k PublicKey) bool {
|
|
|
return bytes.Equal(k.Marshal(), validCert.SignatureKey.Marshal())
|
|
|
}
|
|
|
|
|
|
@@ -142,7 +142,7 @@ func TestValidateCertTime(t *testing.T) {
|
|
|
checker := CertChecker{
|
|
|
Clock: func() time.Time { return time.Unix(ts, 0) },
|
|
|
}
|
|
|
- checker.IsAuthority = func(k PublicKey) bool {
|
|
|
+ checker.IsUserAuthority = func(k PublicKey) bool {
|
|
|
return bytes.Equal(k.Marshal(),
|
|
|
testPublicKeys["ecdsa"].Marshal())
|
|
|
}
|
|
|
@@ -160,7 +160,7 @@ func TestValidateCertTime(t *testing.T) {
|
|
|
|
|
|
func TestHostKeyCert(t *testing.T) {
|
|
|
cert := &Certificate{
|
|
|
- ValidPrincipals: []string{"hostname", "hostname.domain"},
|
|
|
+ ValidPrincipals: []string{"hostname", "hostname.domain", "otherhost"},
|
|
|
Key: testPublicKeys["rsa"],
|
|
|
ValidBefore: CertTimeInfinity,
|
|
|
CertType: HostCert,
|
|
|
@@ -168,8 +168,8 @@ func TestHostKeyCert(t *testing.T) {
|
|
|
cert.SignCert(rand.Reader, testSigners["ecdsa"])
|
|
|
|
|
|
checker := &CertChecker{
|
|
|
- IsAuthority: func(p PublicKey) bool {
|
|
|
- return bytes.Equal(testPublicKeys["ecdsa"].Marshal(), p.Marshal())
|
|
|
+ IsHostAuthority: func(p PublicKey, h string) bool {
|
|
|
+ return h == "hostname" && bytes.Equal(testPublicKeys["ecdsa"].Marshal(), p.Marshal())
|
|
|
},
|
|
|
}
|
|
|
|
|
|
@@ -178,7 +178,7 @@ func TestHostKeyCert(t *testing.T) {
|
|
|
t.Errorf("NewCertSigner: %v", err)
|
|
|
}
|
|
|
|
|
|
- for _, name := range []string{"hostname", "otherhost"} {
|
|
|
+ for _, name := range []string{"hostname", "otherhost", "lasthost"} {
|
|
|
c1, c2, err := netPipe()
|
|
|
if err != nil {
|
|
|
t.Fatalf("netPipe: %v", err)
|