diff --git a/cmd/keytransparency-server/main.go b/cmd/keytransparency-server/main.go index ef0a619c5..81b7d24d4 100644 --- a/cmd/keytransparency-server/main.go +++ b/cmd/keytransparency-server/main.go @@ -193,12 +193,14 @@ func main() { // Connect to map server. var tmap trillian.TrillianMapClient + var tadmin trillian.TrillianAdminClient if *mapURL != "" { mconn, err := grpc.Dial(*mapURL, grpc.WithInsecure()) if err != nil { glog.Exitf("grpc.Dial(%v): %v", *mapURL, err) } tmap = trillian.NewTrillianMapClient(mconn) + tadmin = trillian.NewTrillianAdminClient(mconn) } else { // Create an in-process readonly mapserver. tmap, err = newReadonlyMapServer(context.Background(), *mapID, sqldb, factory) @@ -208,7 +210,7 @@ func main() { } // Create gRPC server. - svr := keyserver.New(*logID, tlog, *mapID, tmap, commitments, + svr := keyserver.New(*logID, tlog, *mapID, tmap, tadmin, commitments, vrfPriv, mutator, auth, authz, factory, mutations) grpcServer := grpc.NewServer( grpc.Creds(creds), diff --git a/core/crypto/vrf/p256/p256.go b/core/crypto/vrf/p256/p256.go index 358383c0f..b13b1ed76 100644 --- a/core/crypto/vrf/p256/p256.go +++ b/core/crypto/vrf/p256/p256.go @@ -221,6 +221,22 @@ func NewVRFSigner(key *ecdsa.PrivateKey) (*PrivateKey, error) { return &PrivateKey{key}, nil } +// Public returns the corresponding public key as bytes. +func (k PrivateKey) Public() ([]byte, error) { + // Copied from: core/crypto/signatures/p256/ecdsa_p256.go + pkBytes, err := x509.MarshalPKIXPublicKey(&k.PublicKey) + if err != nil { + return nil, err + } + pkPEM := pem.EncodeToMemory( + &pem.Block{ + Type: "PUBLIC KEY", + Bytes: pkBytes, + }, + ) + return pkPEM, nil +} + // NewVRFVerifier creates a verifier object from a public key. func NewVRFVerifier(pubkey *ecdsa.PublicKey) (*PublicKey, error) { if *(pubkey.Params()) != *curve.Params() { diff --git a/core/crypto/vrf/vrf.go b/core/crypto/vrf/vrf.go index 1d64d7e69..6d706e243 100644 --- a/core/crypto/vrf/vrf.go +++ b/core/crypto/vrf/vrf.go @@ -30,6 +30,8 @@ import ( type PrivateKey interface { // Evaluate returns the output of H(f_k(m)) and its proof. Evaluate(m []byte) (index [32]byte, proof []byte) + // Public returns the corresponding public key as bytes. + Public() ([]byte, error) } // PublicKey supports verifying output from the VRF function. diff --git a/core/keyserver/keyserver.go b/core/keyserver/keyserver.go index 9e5a72b3e..f289a3b5c 100644 --- a/core/keyserver/keyserver.go +++ b/core/keyserver/keyserver.go @@ -32,6 +32,7 @@ import ( authzpb "github.com/google/keytransparency/core/proto/authorization" tpb "github.com/google/keytransparency/core/proto/keytransparency_v1_types" "github.com/google/trillian" + "github.com/google/trillian/crypto/keyspb" ) const ( @@ -51,6 +52,7 @@ type Server struct { tlog trillian.TrillianLogClient mapID int64 tmap trillian.TrillianMapClient + tadmin trillian.TrillianAdminClient committer commitments.Committer auth authentication.Authenticator authz authorization.Authorization @@ -65,6 +67,7 @@ func New(logID int64, tlog trillian.TrillianLogClient, mapID int64, tmap trillian.TrillianMapClient, + tadmin trillian.TrillianAdminClient, committer commitments.Committer, vrf vrf.PrivateKey, mutator mutator.Mutator, @@ -77,6 +80,7 @@ func New(logID int64, tlog: tlog, mapID: mapID, tmap: tmap, + tadmin: tadmin, committer: committer, vrf: vrf, mutator: mutator, @@ -319,6 +323,39 @@ func (s *Server) UpdateEntry(ctx context.Context, in *tpb.UpdateEntryRequest) (* return &tpb.UpdateEntryResponse{Proof: resp}, nil } +// GetDomainInfo returns all info tied to the specified domain. +// +// This API to get all necessary data needed to verify a particular +// key-server. Data contains for instance the tree-info, like for instance the +// log-/map-id and the corresponding public-keys. +func (s *Server) GetDomainInfo(ctx context.Context, in *tpb.GetDomainInfoRequest) (*tpb.GetDomainInfoResponse, error) { + logTree, err := s.tadmin.GetTree(ctx, &trillian.GetTreeRequest{ + TreeId: s.logID, + }) + if err != nil { + return nil, err + } + mapTree, err := s.tadmin.GetTree(ctx, &trillian.GetTreeRequest{ + TreeId: s.mapID, + }) + if err != nil { + return nil, err + } + + vrfPub, err := s.vrf.Public() + if err != nil { + return nil, err + } + + return &tpb.GetDomainInfoResponse{ + Log: logTree, + Map: mapTree, + Vrf: &keyspb.PublicKey{ + Der: vrfPub, + }, + }, nil +} + func (s *Server) saveCommitment(ctx context.Context, kv *tpb.KeyValue, committed *tpb.Committed) error { entry := new(tpb.Entry) if err := proto.Unmarshal(kv.Value, entry); err != nil { diff --git a/core/keyserver/keyserver_test.go b/core/keyserver/keyserver_test.go index 8c7ef303b..980fb1e43 100644 --- a/core/keyserver/keyserver_test.go +++ b/core/keyserver/keyserver_test.go @@ -70,8 +70,9 @@ func TestListEntryHistory(t *testing.T) { sths := &fakeSequenced{make([][]byte, 0)} mapsvr := mapserver.NewReadonly(mapID, tree, fakeFactory{}, sths) tlog := fake.NewFakeTrillianLogClient() + tadmin := trillian.NewTrillianAdminClient(nil) - srv := New(logID, tlog, mapID, mapsvr, c, fakePrivateKey{}, fakeMutator{}, + srv := New(logID, tlog, mapID, mapsvr, tadmin, c, fakePrivateKey{}, fakeMutator{}, authentication.NewFake(), fakeAuthz{}, fakeFactory{}, fakeMutation{}) if err := addProfiles(profileCount, c, tree, sths); err != nil { t.Fatalf("addProfile(%v, _, _, _)=%v", profileCount, err) @@ -196,6 +197,8 @@ type fakePrivateKey struct{} func (fakePrivateKey) Evaluate(m []byte) ([32]byte, []byte) { return [32]byte{}, nil } +func (fakePrivateKey) Public() ([]byte, error) { return []byte{}, nil } + // mutator.Mutator fake. type fakeMutator struct{} diff --git a/core/proto/keytransparency_v1_types/keytransparency_v1_types.pb.go b/core/proto/keytransparency_v1_types/keytransparency_v1_types.pb.go index 94839f807..4f6d61237 100644 --- a/core/proto/keytransparency_v1_types/keytransparency_v1_types.pb.go +++ b/core/proto/keytransparency_v1_types/keytransparency_v1_types.pb.go @@ -29,12 +29,15 @@ It has these top-level messages: UpdateEntryResponse GetMutationsRequest GetMutationsResponse + GetDomainInfoRequest + GetDomainInfoResponse */ package keytransparency_v1_types import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" +import keyspb "github.com/google/trillian/crypto/keyspb" import sigpb "github.com/google/trillian/crypto/sigpb" import trillian "github.com/google/trillian" import trillian1 "github.com/google/trillian" @@ -348,8 +351,8 @@ func (m *SignedKV) GetPrevious() []byte { type Mutation struct { // update contains the actual mutation information. Update *SignedKV `protobuf:"bytes,1,opt,name=update" json:"update,omitempty"` - // proof contains a leaf and an inclusion proof in the map. - // This is used by Storage-less monitors. + // proof contains a leaf and an inclusion proof in the map of the previous + // epoch. This is used by Storage-less monitors. Proof *trillian1.MapLeafInclusion `protobuf:"bytes,2,opt,name=proof" json:"proof,omitempty"` } @@ -756,6 +759,52 @@ func (m *GetMutationsResponse) GetNextPageToken() string { return "" } +// GetDomainInfoRequest contains an empty request to query the GetDomainInfo +// APIs. +type GetDomainInfoRequest struct { +} + +func (m *GetDomainInfoRequest) Reset() { *m = GetDomainInfoRequest{} } +func (m *GetDomainInfoRequest) String() string { return proto.CompactTextString(m) } +func (*GetDomainInfoRequest) ProtoMessage() {} +func (*GetDomainInfoRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } + +// GetDomainInfoResponse contains the results of GetDomainInfo APIs. +type GetDomainInfoResponse struct { + // Log contains the Log-Tree's info. + Log *trillian.Tree `protobuf:"bytes,1,opt,name=log" json:"log,omitempty"` + // Map contains the Map-Tree's info. + Map *trillian.Tree `protobuf:"bytes,2,opt,name=map" json:"map,omitempty"` + // Vrf contains the VRF public key. + Vrf *keyspb.PublicKey `protobuf:"bytes,3,opt,name=vrf" json:"vrf,omitempty"` +} + +func (m *GetDomainInfoResponse) Reset() { *m = GetDomainInfoResponse{} } +func (m *GetDomainInfoResponse) String() string { return proto.CompactTextString(m) } +func (*GetDomainInfoResponse) ProtoMessage() {} +func (*GetDomainInfoResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } + +func (m *GetDomainInfoResponse) GetLog() *trillian.Tree { + if m != nil { + return m.Log + } + return nil +} + +func (m *GetDomainInfoResponse) GetMap() *trillian.Tree { + if m != nil { + return m.Map + } + return nil +} + +func (m *GetDomainInfoResponse) GetVrf() *keyspb.PublicKey { + if m != nil { + return m.Vrf + } + return nil +} + func init() { proto.RegisterType((*Committed)(nil), "keytransparency.v1.types.Committed") proto.RegisterType((*EntryUpdate)(nil), "keytransparency.v1.types.EntryUpdate") @@ -772,72 +821,79 @@ func init() { proto.RegisterType((*UpdateEntryResponse)(nil), "keytransparency.v1.types.UpdateEntryResponse") proto.RegisterType((*GetMutationsRequest)(nil), "keytransparency.v1.types.GetMutationsRequest") proto.RegisterType((*GetMutationsResponse)(nil), "keytransparency.v1.types.GetMutationsResponse") + proto.RegisterType((*GetDomainInfoRequest)(nil), "keytransparency.v1.types.GetDomainInfoRequest") + proto.RegisterType((*GetDomainInfoResponse)(nil), "keytransparency.v1.types.GetDomainInfoResponse") } func init() { proto.RegisterFile("keytransparency_v1_types.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 985 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xdf, 0x6e, 0xdb, 0xb6, - 0x17, 0xae, 0xed, 0xd8, 0xb1, 0x4e, 0xfe, 0x15, 0x6c, 0x7e, 0x89, 0x7e, 0x1e, 0x5a, 0x04, 0x2a, - 0xb6, 0x75, 0xc3, 0xe0, 0x35, 0x2a, 0x92, 0xad, 0xdd, 0xc5, 0xba, 0x76, 0x43, 0x13, 0x24, 0x01, - 0x02, 0xa6, 0xcd, 0x2e, 0x05, 0xc6, 0xa2, 0x15, 0x22, 0xb2, 0xc8, 0x91, 0x94, 0x51, 0x05, 0xd8, - 0x1b, 0x0c, 0x18, 0xb0, 0x67, 0xd8, 0x33, 0xec, 0x05, 0xf6, 0x16, 0x7b, 0x9a, 0x81, 0xa4, 0x64, - 0xcb, 0xa9, 0xd3, 0x34, 0xbd, 0xd8, 0x4d, 0xc0, 0x73, 0x78,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 0xa0, 0x85, 0xf2, 0x9b, 0x5b, 0xad, 0xf7, 0x67, 0x3c, 0xce, 0xcf, 0x52, 0x36, 0x38, 0xa0, - 0x05, 0x5e, 0x9d, 0x62, 0x0f, 0x68, 0xa1, 0x82, 0x3f, 0x1b, 0xe0, 0x4d, 0x6e, 0x51, 0x0f, 0x16, - 0x69, 0x1c, 0xee, 0xec, 0x6c, 0x3f, 0x75, 0x89, 0xf7, 0xee, 0xe0, 0xca, 0x81, 0xbe, 0x83, 0xff, - 0x4b, 0x45, 0xa2, 0x31, 0x95, 0x6c, 0x58, 0xb0, 0x2c, 0x89, 0xd4, 0x39, 0x09, 0x77, 0x76, 0xa3, - 0x27, 0x8f, 0xbf, 0x09, 0x1d, 0xb1, 0x7b, 0x77, 0xf0, 0x86, 0x54, 0xe4, 0xb4, 0x8a, 0x38, 0xb1, - 0x01, 0xe6, 0x1e, 0x85, 0xb0, 0x4e, 0x07, 0xf1, 0x0c, 0x5c, 0x84, 0x3b, 0xbb, 0x96, 0x2b, 0x83, - 0x43, 0xf6, 0x76, 0x82, 0x3c, 0x0e, 0x77, 0x76, 0x5f, 0x00, 0x74, 0x2f, 0x68, 0x61, 0x25, 0x14, - 0x84, 0xd0, 0x3d, 0xa0, 0xc5, 0x29, 0x49, 0x73, 0x3a, 0x67, 0xbc, 0xeb, 0xd0, 0x1e, 0x9b, 0xab, - 0x72, 0xbe, 0xce, 0x08, 0xfe, 0x68, 0x42, 0xb7, 0x9a, 0x14, 0xfa, 0x1e, 0x3c, 0xf3, 0x31, 0x17, - 0xd6, 0xb8, 0x69, 0xc0, 0x55, 0x2e, 0x6c, 0x2a, 0x70, 0x59, 0x31, 0x80, 0x62, 0x49, 0x46, 0x74, - 0x2e, 0x69, 0xc5, 0x78, 0x78, 0xb3, 0x44, 0xec, 0xc1, 0x81, 0xec, 0x78, 0x71, 0xed, 0x2b, 0xa8, - 0x07, 0x5d, 0x21, 0xe9, 0x98, 0xf1, 0x5c, 0x39, 0x26, 0x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 0x93, 0x27, 0x2a, 0x17, 0xda, 0x49, 0xe9, 0xd3, 0xeb, 0xfb, - 0xaa, 0xfd, 0xf2, 0xe1, 0x25, 0x3a, 0x35, 0x82, 0x9f, 0xe1, 0xde, 0x4c, 0xdd, 0x25, 0x65, 0xcf, - 0xab, 0x7d, 0x77, 0x4f, 0xc5, 0x6d, 0x18, 0x2b, 0xf7, 0xff, 0xf7, 0x06, 0xdc, 0x7b, 0x45, 0x75, - 0xf5, 0xfa, 0xa8, 0x8a, 0x92, 0x75, 0x68, 0x53, 0xc1, 0x07, 0xe7, 0xf6, 0xcb, 0x2d, 0xec, 0x8c, - 0x79, 0x8d, 0x37, 0xe7, 0x35, 0x7e, 0x1f, 0xc0, 0x4a, 0x48, 0xf3, 0x0b, 0x9a, 0x59, 0x6e, 0x3c, - 0x6c, 0x45, 0xf5, 0xda, 0x38, 0x66, 0x15, 0xb6, 0x30, 0xab, 0xb0, 0xe0, 0xef, 0x26, 0xac, 0xcf, - 0x56, 0x54, 0x36, 0x3b, 0xbf, 0xa4, 0x72, 0x4b, 0x9b, 0xb7, 0xdc, 0xd2, 0xd6, 0xc7, 0x6f, 0xe9, - 0xc2, 0x87, 0x6d, 0x69, 0xfb, 0xdd, 0x2d, 0x45, 0xcf, 0xc1, 0x1b, 0x55, 0x7d, 0xd9, 0x6d, 0x7f, - 0xef, 0xf3, 0x5e, 0x51, 0x80, 0xa7, 0x20, 0x33, 0x01, 0x2b, 0xf0, 0x1a, 0xbd, 0x8b, 0x96, 0xde, - 0x15, 0xe3, 0x3e, 0xae, 0x28, 0x3e, 0xeb, 0xd8, 0xff, 0xc0, 0x9e, 0xfc, 0x1b, 0x00, 0x00, 0xff, - 0xff, 0xbd, 0x88, 0x8a, 0x70, 0xff, 0x09, 0x00, 0x00, + // 1057 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xdd, 0x4e, 0x1b, 0xc7, + 0x17, 0x8f, 0xbd, 0xd8, 0xd8, 0x87, 0xaf, 0xfc, 0x27, 0x04, 0xf6, 0xef, 0x2a, 0x11, 0x5a, 0xd4, + 0x36, 0xad, 0x2a, 0x37, 0x38, 0x82, 0x36, 0xe9, 0x45, 0xd3, 0x24, 0x55, 0x40, 0x80, 0x84, 0x86, + 0x84, 0x5e, 0xae, 0x06, 0x7b, 0xbc, 0x8c, 0x58, 0xef, 0x4c, 0x67, 0x66, 0xad, 0x2c, 0x52, 0xa5, + 0x3e, 0x40, 0xa5, 0x4a, 0x7d, 0x86, 0x3e, 0x43, 0x5f, 0xa0, 0x6f, 0xd1, 0xa7, 0xa9, 0xe6, 0x63, + 0xfd, 0x01, 0x26, 0x84, 0x5c, 0xf4, 0xc6, 0x9e, 0xf3, 0xb5, 0xe7, 0x9c, 0xdf, 0xf9, 0x9d, 0xd9, + 0x85, 0x87, 0xe7, 0xb4, 0xd0, 0x92, 0x64, 0x4a, 0x10, 0x49, 0xb3, 0x6e, 0x11, 0x0f, 0xb7, 0x62, + 0x5d, 0x08, 0xaa, 0xda, 0x42, 0x72, 0xcd, 0x51, 0x78, 0xc9, 0xde, 0x1e, 0x6e, 0xb5, 0xad, 0xbd, + 0xd5, 0xea, 0xca, 0x42, 0x68, 0xfe, 0xf5, 0x39, 0x2d, 0x94, 0x38, 0xf5, 0x7f, 0x2e, 0xaa, 0x15, + 0x7a, 0x9b, 0x62, 0x89, 0x38, 0x75, 0xbf, 0xde, 0xb2, 0xac, 0x25, 0x4b, 0x53, 0x46, 0x32, 0x2f, + 0xaf, 0x95, 0x72, 0x3c, 0x20, 0x22, 0x26, 0x82, 0x39, 0x7d, 0xb4, 0x05, 0xcd, 0x97, 0x7c, 0x30, + 0x60, 0x5a, 0xd3, 0x1e, 0xba, 0x0b, 0xc1, 0x39, 0x2d, 0xc2, 0xca, 0x46, 0xe5, 0xd1, 0x22, 0x36, + 0x47, 0x84, 0x60, 0xae, 0x47, 0x34, 0x09,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x45, 0x65, 0xcc, 0x7a, 0xbe, 0xa9, 0xba, 0x11, 0xf7, 0x7a, 0xe8, 0x3e, 0xd4, 0x89, 0x10, + 0x46, 0x5f, 0xb5, 0xfa, 0x1a, 0x11, 0x62, 0xaf, 0x87, 0x3e, 0x83, 0x95, 0x3e, 0x93, 0x4a, 0xc7, + 0x5a, 0x52, 0x1a, 0x2b, 0x76, 0x41, 0x2d, 0x6c, 0x01, 0x5e, 0xb2, 0xea, 0x37, 0x92, 0xd2, 0x63, + 0x76, 0x41, 0xa3, 0x7f, 0xaa, 0x70, 0x77, 0x9c, 0x4b, 0x09, 0x9e, 0x29, 0x8a, 0x3e, 0x81, 0xe6, + 0x50, 0xf6, 0x63, 0x57, 0xb5, 0x23, 0x4f, 0x63, 0x28, 0xfb, 0x47, 0x46, 0x9e, 0x5e, 0xe0, 0xea, + 0xc7, 0x2c, 0x30, 0x7a, 0x0a, 0x90, 0x52, 0x52, 0x26, 0x08, 0x6e, 0x84, 0xa5, 0x69, 0xbc, 0x5d, + 0xf6, 0x2f, 0x20, 0x50, 0x03, 0x19, 0xce, 0xd9, 0x98, 0xf5, 0x71, 0x8c, 0x43, 0xfd, 0x90, 0x08, + 0xcc, 0xb9, 0xc6, 0xc6, 0x07, 0x75, 0xa0, 0x91, 0xf2, 0x24, 0x96, 0x9c, 0xeb, 0xb0, 0x36, 0xdb, + 0xff, 0x80, 0x27, 0xd6, 0x7f, 0x3e, 0x75, 0x07, 0xf4, 0x39, 0xac, 0x98, 0x98, 0x2e, 0xcf, 0x14, + 0x53, 0xda, 0xb4, 0x12, 0xd6, 0x37, 0x82, 0x47, 0x8b, 0x78, 0x39, 0xe5, 0xc9, 0xcb, 0xb1, 0x16, + 0x6d, 0xc2, 0x92, 0x71, 0x64, 0x65, 0x8d, 0xe1, 0xbc, 0x75, 0x5b, 0x4c, 0x79, 0x32, 0xaa, 0xdb, + 0xdc, 0x18, 0xeb, 0x07, 0x4c, 0x39, 0x74, 0x77, 0x99, 0xd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0xb3, 0x4b, + 0xf2, 0x5b, 0x5a, 0xbd, 0xe5, 0x96, 0x06, 0x1f, 0xbf, 0xa5, 0x73, 0x1f, 0xb6, 0xa5, 0xb5, 0xab, + 0x5b, 0x8a, 0x9e, 0x43, 0x73, 0x50, 0xf6, 0x65, 0xb7, 0xfd, 0xbd, 0xd7, 0x7b, 0x09, 0x01, 0x1e, + 0x07, 0x99, 0x09, 0x58, 0x82, 0x4f, 0xc0, 0x3b, 0x6f, 0xe1, 0x5d, 0x32, 0xea, 0xa3, 0x12, 0xe2, + 0x68, 0xcd, 0x82, 0xf8, 0x8a, 0x0f, 0x08, 0xcb, 0xf6, 0xb2, 0x3e, 0xf7, 0x73, 0x8d, 0x7e, 0xad, + 0xc0, 0xfd, 0x4b, 0x06, 0x0f, 0xef, 0x06, 0x04, 0x29, 0x4f, 0x3c, 0x93, 0x96, 0xc7, 0xc0, 0x98, + 0xa1, 0x62, 0x63, 0x32, 0x1e, 0x03, 0x22, 0x3c, 0xd4, 0x57, 0x3c, 0x06, 0x44, 0xa0, 0x4d, 0x08, + 0x86, 0xb2, 0xbc, 0x66, 0xff, 0xd7, 0xf6, 0x9f, 0x93, 0xe3, 0xef, 0x1c, 0x63, 0x3d, 0xad, 0xdb, + 0x8f, 0xc3, 0x27, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x87, 0x52, 0x53, 0x62, 0xb6, 0x0a, 0x00, + 0x00, } diff --git a/core/proto/keytransparency_v1_types/keytransparency_v1_types.proto b/core/proto/keytransparency_v1_types/keytransparency_v1_types.proto index 1636eb61b..f406f5c8e 100644 --- a/core/proto/keytransparency_v1_types/keytransparency_v1_types.proto +++ b/core/proto/keytransparency_v1_types/keytransparency_v1_types.proto @@ -21,6 +21,7 @@ syntax = "proto3"; // associated with it. package keytransparency.v1.types; +import "crypto/keyspb/keyspb.proto"; import "crypto/sigpb/sigpb.proto"; import "trillian.proto"; import "trillian_map_api.proto"; @@ -100,8 +101,8 @@ message SignedKV { message Mutation { // update contains the actual mutation information. SignedKV update = 1; - // proof contains a leaf and an inclusion proof in the map. - // This is used by Storage-less monitors. + // proof contains a leaf and an inclusion proof in the map of the previous + // epoch. This is used by Storage-less monitors. trillian.MapLeafInclusion proof = 2; } @@ -236,3 +237,17 @@ message GetMutationsResponse { // results. string next_page_token = 7; } + +// GetDomainInfoRequest contains an empty request to query the GetDomainInfo +// APIs. +message GetDomainInfoRequest {} + +// GetDomainInfoResponse contains the results of GetDomainInfo APIs. +message GetDomainInfoResponse { + // Log contains the Log-Tree's info. + trillian.Tree log = 1; + // Map contains the Map-Tree's info. + trillian.Tree map = 2; + // Vrf contains the VRF public key. + keyspb.PublicKey vrf = 3; +} diff --git a/impl/proto/keytransparency_v1_service/keytransparency_v1_service.pb.go b/impl/proto/keytransparency_v1_service/keytransparency_v1_service.pb.go index 671988f09..8023aec19 100644 --- a/impl/proto/keytransparency_v1_service/keytransparency_v1_service.pb.go +++ b/impl/proto/keytransparency_v1_service/keytransparency_v1_service.pb.go @@ -64,6 +64,12 @@ type KeyTransparencyServiceClient interface { // Returns the current user profile. // Clients must retry until this function returns a proof containing the desired value. UpdateEntry(ctx context.Context, in *keytransparency_v1_types.UpdateEntryRequest, opts ...grpc.CallOption) (*keytransparency_v1_types.UpdateEntryResponse, error) + // GetDomainInfo returns all info tied to the specified domain. + // + // This API to get all necessary data needed to verify a particular + // key-server. Data contains for instance the tree-info, like for instance the + // log-/map-id and the corresponding public-keys. + GetDomainInfo(ctx context.Context, in *keytransparency_v1_types.GetDomainInfoRequest, opts ...grpc.CallOption) (*keytransparency_v1_types.GetDomainInfoResponse, error) } type keyTransparencyServiceClient struct { @@ -101,6 +107,15 @@ func (c *keyTransparencyServiceClient) UpdateEntry(ctx context.Context, in *keyt return out, nil } +func (c *keyTransparencyServiceClient) GetDomainInfo(ctx context.Context, in *keytransparency_v1_types.GetDomainInfoRequest, opts ...grpc.CallOption) (*keytransparency_v1_types.GetDomainInfoResponse, error) { + out := new(keytransparency_v1_types.GetDomainInfoResponse) + err := grpc.Invoke(ctx, "/keytransparency.v1.service.KeyTransparencyService/GetDomainInfo", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // Server API for KeyTransparencyService service type KeyTransparencyServiceServer interface { @@ -118,6 +133,12 @@ type KeyTransparencyServiceServer interface { // Returns the current user profile. // Clients must retry until this function returns a proof containing the desired value. UpdateEntry(context.Context, *keytransparency_v1_types.UpdateEntryRequest) (*keytransparency_v1_types.UpdateEntryResponse, error) + // GetDomainInfo returns all info tied to the specified domain. + // + // This API to get all necessary data needed to verify a particular + // key-server. Data contains for instance the tree-info, like for instance the + // log-/map-id and the corresponding public-keys. + GetDomainInfo(context.Context, *keytransparency_v1_types.GetDomainInfoRequest) (*keytransparency_v1_types.GetDomainInfoResponse, error) } func RegisterKeyTransparencyServiceServer(s *grpc.Server, srv KeyTransparencyServiceServer) { @@ -178,6 +199,24 @@ func _KeyTransparencyService_UpdateEntry_Handler(srv interface{}, ctx context.Co return interceptor(ctx, in, info, handler) } +func _KeyTransparencyService_GetDomainInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(keytransparency_v1_types.GetDomainInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KeyTransparencyServiceServer).GetDomainInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/keytransparency.v1.service.KeyTransparencyService/GetDomainInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KeyTransparencyServiceServer).GetDomainInfo(ctx, req.(*keytransparency_v1_types.GetDomainInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _KeyTransparencyService_serviceDesc = grpc.ServiceDesc{ ServiceName: "keytransparency.v1.service.KeyTransparencyService", HandlerType: (*KeyTransparencyServiceServer)(nil), @@ -194,6 +233,10 @@ var _KeyTransparencyService_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateEntry", Handler: _KeyTransparencyService_UpdateEntry_Handler, }, + { + MethodName: "GetDomainInfo", + Handler: _KeyTransparencyService_GetDomainInfo_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "keytransparency_v1_service.proto", @@ -202,24 +245,27 @@ var _KeyTransparencyService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("keytransparency_v1_service.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 300 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x91, 0xbf, 0x4a, 0xc4, 0x40, - 0x10, 0xc6, 0x39, 0x05, 0x91, 0x68, 0x21, 0x2b, 0x5a, 0xe4, 0x14, 0xc4, 0xab, 0x4e, 0x34, 0x4b, - 0xce, 0xce, 0x5e, 0x14, 0xb4, 0xf2, 0x4f, 0x1d, 0xf6, 0x92, 0x21, 0xb7, 0xa8, 0xbb, 0xeb, 0xce, - 0x24, 0xb0, 0x88, 0x16, 0xbe, 0x82, 0xd8, 0xfa, 0x4e, 0xe2, 0x2b, 0xf8, 0x20, 0x72, 0xc9, 0x06, - 0x8e, 0x90, 0xc0, 0x59, 0xa5, 0x98, 0xdf, 0x7c, 0xdf, 0x2f, 0xb3, 0xc1, 0xc1, 0x03, 0x38, 0xb2, - 0x42, 0xa1, 0x11, 0x16, 0x54, 0xea, 0x92, 0x32, 0x4e, 0x10, 0x6c, 0x29, 0x53, 0x88, 0x8c, 0xd5, - 0xa4, 0x59, 0xd8, 0x22, 0xa2, 0x32, 0x8e, 0x3c, 0x11, 0x66, 0xb9, 0xa4, 0x59, 0x31, 0x8d, 0x52, - 0xfd, 0xc4, 0x73, 0xad, 0xf3, 0x47, 0xe0, 0x2d, 0x9a, 0xa7, 0xda, 0x02, 0xaf, 0x92, 0x78, 0x47, - 0x15, 0x39, 0x03, 0xd8, 0x3b, 0xa8, 0x0d, 0xc2, 0x3d, 0x1f, 0x2d, 0x8c, 0xe4, 0x42, 0x29, 0x4d, - 0x82, 0xa4, 0x56, 0x7e, 0x3a, 0xf9, 0x5e, 0x0d, 0x76, 0xaf, 0xc0, 0xdd, 0x2d, 0x04, 0xdc, 0xd6, - 0x7a, 0xec, 0x2d, 0x58, 0xbf, 0x00, 0x3a, 0x57, 0x64, 0x1d, 0x1b, 0x47, 0x1d, 0xff, 0x51, 0xb7, - 0x34, 0xcc, 0x0d, 0x3c, 0x17, 0x80, 0x14, 0x1e, 0x2d, 0x83, 0xa2, 0xd1, 0x0a, 0xe1, 0x70, 0xf8, - 0xfe, 0xf3, 0xfb, 0xb1, 0xb2, 0xc3, 0xb6, 0x79, 0x19, 0xf3, 0x02, 0xc1, 0x22, 0x7f, 0x99, 0x7f, - 0x12, 0x99, 0xbd, 0xb2, 0xaf, 0x41, 0xb0, 0x75, 0x2d, 0xb1, 0x5e, 0xb9, 0x94, 0x48, 0xda, 0x3a, - 0x16, 0xf7, 0xa7, 0xb7, 0xd9, 0x46, 0x68, 0xf2, 0x9f, 0x15, 0x2f, 0x36, 0xaa, 0xc4, 0xf6, 0xd9, - 0xb0, 0x43, 0x8c, 0xcf, 0xbc, 0xcb, 0xe7, 0x20, 0xd8, 0xb8, 0x37, 0x99, 0x20, 0xa8, 0x8f, 0x74, - 0xdc, 0x5f, 0xb4, 0x80, 0x35, 0x5a, 0x27, 0x4b, 0xd2, 0xde, 0x68, 0x5c, 0x19, 0x8d, 0xc2, 0xae, - 0x53, 0x9d, 0x6d, 0xc2, 0x9c, 0x4d, 0x8a, 0x6a, 0x6f, 0xba, 0x56, 0x3d, 0xed, 0xe9, 0x5f, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x47, 0xf4, 0xa4, 0xe3, 0x9e, 0x02, 0x00, 0x00, + // 343 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x92, 0x4f, 0x4b, 0x33, 0x31, + 0x10, 0x87, 0xe9, 0xcb, 0x8b, 0xc8, 0xaa, 0xa8, 0x11, 0x15, 0xb6, 0x0a, 0x62, 0x4f, 0x15, 0xdd, + 0xb0, 0xf5, 0xe6, 0x59, 0xa9, 0xa2, 0x27, 0xff, 0x9c, 0x97, 0x74, 0x77, 0xda, 0x06, 0x6d, 0x66, + 0x4d, 0xb2, 0x0b, 0x41, 0xf4, 0xe0, 0xcd, 0xb3, 0x78, 0xf5, 0x4b, 0x79, 0xf6, 0xe6, 0x07, 0x91, + 0x66, 0xb3, 0x58, 0xca, 0x56, 0xd6, 0x53, 0x0e, 0xf3, 0xcc, 0x6f, 0x9e, 0x4c, 0xe2, 0xed, 0xdc, + 0x82, 0xd1, 0x92, 0x09, 0x95, 0x32, 0x09, 0x22, 0x36, 0x51, 0x1e, 0x46, 0x0a, 0x64, 0xce, 0x63, + 0x08, 0x52, 0x89, 0x1a, 0x89, 0x3f, 0x45, 0x04, 0x79, 0x18, 0x38, 0xc2, 0x4f, 0x06, 0x5c, 0x0f, + 0xb3, 0x5e, 0x10, 0xe3, 0x88, 0x0e, 0x10, 0x07, 0x77, 0x40, 0xa7, 0x68, 0x1a, 0xa3, 0x04, 0x6a, + 0x93, 0x68, 0xc5, 0x28, 0x6d, 0x52, 0x50, 0x33, 0x0b, 0x85, 0x81, 0xbf, 0xe5, 0xa2, 0x59, 0xca, + 0x29, 0x13, 0x02, 0x35, 0xd3, 0x1c, 0x85, 0xab, 0x76, 0x3e, 0xff, 0x7b, 0x1b, 0xe7, 0x60, 0xae, + 0x27, 0x02, 0xae, 0x0a, 0x3d, 0xf2, 0xe4, 0xcd, 0x77, 0x41, 0x9f, 0x08, 0x2d, 0x0d, 0x69, 0x07, + 0x15, 0xf7, 0x28, 0xa6, 0x94, 0xcc, 0x25, 0xdc, 0x67, 0xa0, 0xb4, 0xbf, 0x57, 0x07, 0x55, 0x29, + 0x0a, 0x05, 0xbb, 0xcd, 0xe7, 0x8f, 0xaf, 0xd7, 0x7f, 0xeb, 0x64, 0x8d, 0xe6, 0x21, 0xcd, 0x14, + 0x48, 0x45, 0x1f, 0xc6, 0x47, 0xc4, 0x93, 0x47, 0xf2, 0xde, 0xf0, 0x56, 0x2e, 0xb8, 0x2a, 0x5a, + 0x4e, 0xb9, 0xd2, 0x28, 0x0d, 0x09, 0x67, 0xa7, 0x4f, 0xb3, 0xa5, 0x50, 0xe7, 0x2f, 0x2d, 0x4e, + 0xac, 0x65, 0xc5, 0xb6, 0x49, 0xb3, 0x42, 0x8c, 0x0e, 0x9d, 0xcb, 0x5b, 0xc3, 0x5b, 0xb8, 0x49, + 0x13, 0xa6, 0xa1, 0x58, 0xd2, 0xfe, 0xec, 0x41, 0x13, 0x58, 0xa9, 0x75, 0x50, 0x93, 0x76, 0x46, + 0x6d, 0x6b, 0xd4, 0xf2, 0xab, 0x56, 0x75, 0xb4, 0x08, 0x63, 0x36, 0xca, 0x6c, 0x1f, 0x79, 0x69, + 0x78, 0x4b, 0x5d, 0xd0, 0xc7, 0x38, 0x62, 0x5c, 0x9c, 0x89, 0x3e, 0x92, 0xe0, 0xd7, 0x37, 0xf9, + 0x01, 0x4b, 0x37, 0x5a, 0x9b, 0x77, 0x76, 0x9b, 0xd6, 0x6e, 0x95, 0x2c, 0x8f, 0xed, 0x12, 0x5b, + 0xa7, 0x5c, 0xf4, 0xb1, 0x37, 0x67, 0xbf, 0xd9, 0xe1, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa0, + 0xc2, 0x1d, 0xdb, 0x2a, 0x03, 0x00, 0x00, } diff --git a/impl/proto/keytransparency_v1_service/keytransparency_v1_service.pb.gw.go b/impl/proto/keytransparency_v1_service/keytransparency_v1_service.pb.gw.go index 6a7ab7eac..8739077e2 100644 --- a/impl/proto/keytransparency_v1_service/keytransparency_v1_service.pb.gw.go +++ b/impl/proto/keytransparency_v1_service/keytransparency_v1_service.pb.gw.go @@ -137,6 +137,15 @@ func request_KeyTransparencyService_UpdateEntry_0(ctx context.Context, marshaler } +func request_KeyTransparencyService_GetDomainInfo_0(ctx context.Context, marshaler runtime.Marshaler, client KeyTransparencyServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq keytransparency_v1_types.GetDomainInfoRequest + var metadata runtime.ServerMetadata + + msg, err := client.GetDomainInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + // RegisterKeyTransparencyServiceHandlerFromEndpoint is same as RegisterKeyTransparencyServiceHandler but // automatically dials to "endpoint" and closes the connection when "ctx" gets done. func RegisterKeyTransparencyServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { @@ -251,6 +260,34 @@ func RegisterKeyTransparencyServiceHandler(ctx context.Context, mux *runtime.Ser }) + mux.Handle("GET", pattern_KeyTransparencyService_GetDomainInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(ctx) + defer cancel() + if cn, ok := w.(http.CloseNotifier); ok { + go func(done <-chan struct{}, closed <-chan bool) { + select { + case <-done: + case <-closed: + cancel() + } + }(ctx.Done(), cn.CloseNotify()) + } + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, req) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + } + resp, md, err := request_KeyTransparencyService_GetDomainInfo_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, outboundMarshaler, w, req, err) + return + } + + forward_KeyTransparencyService_GetDomainInfo_0(ctx, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -260,6 +297,8 @@ var ( pattern_KeyTransparencyService_ListEntryHistory_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"v1", "users", "user_id", "history"}, "")) pattern_KeyTransparencyService_UpdateEntry_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "users", "user_id"}, "")) + + pattern_KeyTransparencyService_GetDomainInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "domain", "info"}, "")) ) var ( @@ -268,4 +307,6 @@ var ( forward_KeyTransparencyService_ListEntryHistory_0 = runtime.ForwardResponseMessage forward_KeyTransparencyService_UpdateEntry_0 = runtime.ForwardResponseMessage + + forward_KeyTransparencyService_GetDomainInfo_0 = runtime.ForwardResponseMessage ) diff --git a/impl/proto/keytransparency_v1_service/keytransparency_v1_service.proto b/impl/proto/keytransparency_v1_service/keytransparency_v1_service.proto index 844230e72..dd9a538a4 100644 --- a/impl/proto/keytransparency_v1_service/keytransparency_v1_service.proto +++ b/impl/proto/keytransparency_v1_service/keytransparency_v1_service.proto @@ -60,4 +60,13 @@ service KeyTransparencyService { body: "entry_update" }; } + + // GetDomainInfo returns all info tied to the specified domain. + // + // This API to get all necessary data needed to verify a particular + // key-server. Data contains for instance the tree-info, like for instance the + // log-/map-id and the corresponding public-keys. + rpc GetDomainInfo(keytransparency.v1.types.GetDomainInfoRequest) returns (keytransparency.v1.types.GetDomainInfoResponse) { + option (google.api.http) = { get: "/v1/domain/info" }; + } } diff --git a/integration/testutil.go b/integration/testutil.go index b045c690d..ab7372048 100644 --- a/integration/testutil.go +++ b/integration/testutil.go @@ -190,9 +190,10 @@ func NewEnv(t *testing.T) *Env { t.Fatalf("SetLeaves(): %v", err) } tlog := fake.NewFakeTrillianLogClient() + tadmin := trillian.NewTrillianAdminClient(nil) - server := keyserver.New(logID, tlog, mapID, mapsvr, commitments, vrfPriv, mutator, - auth, authz, factory, mutations) + server := keyserver.New(logID, tlog, mapID, mapsvr, tadmin, commitments, + vrfPriv, mutator, auth, authz, factory, mutations) s := grpc.NewServer() pb.RegisterKeyTransparencyServiceServer(s, server)