From 45caf28d964a0ac638abd813b9bee4d0df832f7d Mon Sep 17 00:00:00 2001 From: Malte Bauch <malte.bauch@stud.h-da.de> Date: Wed, 6 Mar 2024 15:59:35 +0000 Subject: [PATCH] Identifier for peer map changed to peer kms id See merge request danet/quant!55 --- config/ekms/example01.yaml | 36 +-- config/ekms/example02.yaml | 36 +-- config/ekms/example03.yaml | 36 +-- config/ekms/example04.yaml | 36 +-- ekms/etsiqkdnclient/etsi-qkdn-client.go | 31 +- .../handlers/danet/assignForwardingHandler.go | 15 +- .../danet/keyRoutingSessionsHandler.go | 4 +- .../gen/proto/go/kmsetsi/kmsetsiproto.pb.go | 2 +- .../proto/go/kmsintercom/kmsintercom.pb.go | 277 +++++++++--------- .../kmsintercom/kmsintercom/kmsintercom.proto | 6 +- ekms/internal/kms/kms.go | 12 +- ekms/internal/kms/kmsetsi.go | 2 +- ekms/internal/kms/kmsintercom.go | 12 +- ekms/internal/kms/kmspeers.go | 19 +- ekms/internal/kms/module.go | 30 +- 15 files changed, 286 insertions(+), 268 deletions(-) diff --git a/config/ekms/example01.yaml b/config/ekms/example01.yaml index f37d14fb..829a4eb2 100644 --- a/config/ekms/example01.yaml +++ b/config/ekms/example01.yaml @@ -1,23 +1,25 @@ -Id: '0ff33c82-7fe1-482b-a0ca-67565806ee4b' +Id: "0ff33c82-7fe1-482b-a0ca-67565806ee4b" Name: ekms01 InterComAddr: 172.100.20.10:50910 GRPCAddr: 172.100.20.10:50900 AkmsURL: "http://172.100.20.22:4444/api/v1/keys/push_ksa_key" AkmsCkmsServerPort: "9696" Peers: - # peer to ekms02 - - PeerId: '5e41c291-6121-4335-84f6-41e04b8bdaa2' - PeerInterComAddr: 172.100.20.11:50910 - Sync: true - # quantum module of type emulated at the given address - QuantumModule: - Type: emulated - Address: 172.100.20.14 - # peer to ekms03 - - PeerId: 'f80db2c0-2480-46b9-b7d1-b63f954e8227' - PeerInterComAddr: 172.100.20.12:50910 - Sync: false - # quantum module of type emulated at the given address - QuantumModule: - Type: emulated - Address: 172.100.20.18 + # peer to ekms02 + - PeerId: "5e41c291-6121-4335-84f6-41e04b8bdaa2" + PeerInterComAddr: 172.100.20.11:50910 + Sync: true + Type: danet + # quantum module of type emulated at the given address + QuantumModule: + Type: emulated + Address: 172.100.20.14 + # peer to ekms03 + - PeerId: "f80db2c0-2480-46b9-b7d1-b63f954e8227" + PeerInterComAddr: 172.100.20.12:50910 + Sync: false + Type: danet + # quantum module of type emulated at the given address + QuantumModule: + Type: emulated + Address: 172.100.20.18 diff --git a/config/ekms/example02.yaml b/config/ekms/example02.yaml index 00a57a04..c6d8c761 100644 --- a/config/ekms/example02.yaml +++ b/config/ekms/example02.yaml @@ -1,21 +1,23 @@ -Id: '5e41c291-6121-4335-84f6-41e04b8bdaa2' +Id: "5e41c291-6121-4335-84f6-41e04b8bdaa2" Name: ekms02 InterComAddr: 172.100.20.11:50910 GRPCAddr: 172.100.20.11:50900 Peers: - # peer to ekms01 - - PeerId: '0ff33c82-7fe1-482b-a0ca-67565806ee4b' - PeerInterComAddr: 172.100.20.10:50910 - Sync: false - # quantum module of type emulated at the given address - QuantumModule: - Type: emulated - Address: 172.100.20.15 - # peer to ekms04 - - PeerId: '968fd594-b0e7-41f0-ba4b-de259047a933' - PeerInterComAddr: 172.100.20.13:50910 - Sync: true - # quantum module of type emulated at the given address - QuantumModule: - Type: emulated - Address: 172.100.20.16 + # peer to ekms01 + - PeerId: "0ff33c82-7fe1-482b-a0ca-67565806ee4b" + PeerInterComAddr: 172.100.20.10:50910 + Sync: false + Type: danet + # quantum module of type emulated at the given address + QuantumModule: + Type: emulated + Address: 172.100.20.15 + # peer to ekms04 + - PeerId: "968fd594-b0e7-41f0-ba4b-de259047a933" + PeerInterComAddr: 172.100.20.13:50910 + Sync: true + Type: danet + # quantum module of type emulated at the given address + QuantumModule: + Type: emulated + Address: 172.100.20.16 diff --git a/config/ekms/example03.yaml b/config/ekms/example03.yaml index c9d5c75c..d211db6e 100644 --- a/config/ekms/example03.yaml +++ b/config/ekms/example03.yaml @@ -1,21 +1,23 @@ -Id: 'f80db2c0-2480-46b9-b7d1-b63f954e8227' +Id: "f80db2c0-2480-46b9-b7d1-b63f954e8227" Name: ekms03 InterComAddr: 172.100.20.12:50910 GRPCAddr: 172.100.20.12:50900 Peers: - # peer to ekms01 - - PeerId: '0ff33c82-7fe1-482b-a0ca-67565806ee4b' - PeerInterComAddr: 172.100.20.10:50910 - Sync: true - # quantum module of type emulated at the given address - QuantumModule: - Type: emulated - Address: 172.100.20.19 - # peer to ekms04 - - PeerId: '968fd594-b0e7-41f0-ba4b-de259047a933' - PeerInterComAddr: 172.100.20.13:50910 - Sync: true - # quantum module of type emulated at the given address - QuantumModule: - Type: emulated - Address: 172.100.20.20 + # peer to ekms01 + - PeerId: "0ff33c82-7fe1-482b-a0ca-67565806ee4b" + PeerInterComAddr: 172.100.20.10:50910 + Sync: true + Type: danet + # quantum module of type emulated at the given address + QuantumModule: + Type: emulated + Address: 172.100.20.19 + # peer to ekms04 + - PeerId: "968fd594-b0e7-41f0-ba4b-de259047a933" + PeerInterComAddr: 172.100.20.13:50910 + Sync: true + Type: danet + # quantum module of type emulated at the given address + QuantumModule: + Type: emulated + Address: 172.100.20.20 diff --git a/config/ekms/example04.yaml b/config/ekms/example04.yaml index 4363de21..4d72dfa8 100644 --- a/config/ekms/example04.yaml +++ b/config/ekms/example04.yaml @@ -1,23 +1,25 @@ -Id: '968fd594-b0e7-41f0-ba4b-de259047a933' +Id: "968fd594-b0e7-41f0-ba4b-de259047a933" Name: ekms04 InterComAddr: 172.100.20.13:50910 GRPCAddr: 172.100.20.13:50900 AkmsURL: "http://172.100.20.23:4444/api/v1/keys/push_ksa_key" AkmsCkmsServerPort: "9696" Peers: - # peer to ekms02 - - PeerId: '5e41c291-6121-4335-84f6-41e04b8bdaa2' - PeerInterComAddr: 172.100.20.11:50910 - Sync: false - # quantum module of type emulated at the given address - QuantumModule: - Type: emulated - Address: 172.100.20.17 - # peer to ekms03 - - PeerId: 'f80db2c0-2480-46b9-b7d1-b63f954e8227' - PeerInterComAddr: 172.100.20.12:50910 - Sync: false - # quantum module of type emulated at the given address - QuantumModule: - Type: emulated - Address: 172.100.20.21 + # peer to ekms02 + - PeerId: "5e41c291-6121-4335-84f6-41e04b8bdaa2" + PeerInterComAddr: 172.100.20.11:50910 + Sync: false + Type: danet + # quantum module of type emulated at the given address + QuantumModule: + Type: emulated + Address: 172.100.20.17 + # peer to ekms03 + - PeerId: "f80db2c0-2480-46b9-b7d1-b63f954e8227" + PeerInterComAddr: 172.100.20.12:50910 + Sync: false + Type: danet + # quantum module of type emulated at the given address + QuantumModule: + Type: emulated + Address: 172.100.20.21 diff --git a/ekms/etsiqkdnclient/etsi-qkdn-client.go b/ekms/etsiqkdnclient/etsi-qkdn-client.go index 53537318..c735e731 100644 --- a/ekms/etsiqkdnclient/etsi-qkdn-client.go +++ b/ekms/etsiqkdnclient/etsi-qkdn-client.go @@ -6,19 +6,15 @@ import ( "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "code.fbi.h-da.de/danet/quant/ekms/internal/akmsCkmsServer" + pbIC "code.fbi.h-da.de/danet/quant/ekms/internal/api/gen/proto/go/kmsintercom" "code.fbi.h-da.de/danet/quant/ekms/internal/kms" "github.com/google/uuid" ) -type QuantumModuleType int - -const ( - EmulatedQuantumModule QuantumModuleType = iota - ETSIQuantumModule -) - // Example of a valid config.yaml // // Name: kms02 @@ -29,6 +25,7 @@ const ( // Peers: // - PeerInterComAddr: 172.20.10.14:50910 // Sync: false +// Type: danet // QuantumModule: // UDPAddr: 172.20.10.15:50915 // PeerUDPAddr: 172.20.10.14:50915 @@ -57,6 +54,7 @@ type Config struct { PeerId string `yaml:"PeerId"` PeerInterComAddr string `yaml:"PeerInterComAddr"` Sync bool `yaml:"Sync"` + Type string `yaml:"Type"` QuantumModule QuantumModule `yaml:"QuantumModule"` } `yaml:"Peers"` } @@ -139,9 +137,9 @@ func emulatedKMS(config *Config, id uuid.UUID, peerChannel chan string) *kms.EKM pqm := peer.QuantumModule switch qmt := peer.QuantumModule.QmType; qmt { case "emulated": - qm = kms.NewEmulatedQuantumModule(pqm.Address) + qm = kms.NewEmulatedQuantumModule(pqm.Address, config.Id) case "etsi": - qm, err = kms.NewETSI014HTTPQuantumModule(pqm.Address, pqm.SlaveSAEID, pqm.MasterSAEID, pqm.MasterMode) + qm, err = kms.NewETSI014HTTPQuantumModule(pqm.Address, config.Id, pqm.SlaveSAEID, pqm.MasterSAEID, pqm.MasterMode) if err != nil { log.Fatalf("Failed to create ETSI QKD module: %s", err) return nil @@ -157,12 +155,25 @@ func emulatedKMS(config *Config, id uuid.UUID, peerChannel chan string) *kms.EKM return nil } - p, err := emuKMS.AddPeer(peer.PeerId, peer.PeerInterComAddr, qm) + newPeerConn, err := grpc.Dial(peer.PeerInterComAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + return nil + } + + client := &kms.GRPCClient{} + switch pt := peer.Type; pt { + case "danet": + client.KmsTalkerClient = pbIC.NewKmsTalkerClient(newPeerConn) + } + + p, err := emuKMS.AddPeer(peer.PeerId, peer.PeerInterComAddr, qm, client) if err != nil { log.Fatalf("Failed to create a peer: %s", err) return nil } + // TODO: check again; we might want to use this based on the quantum + // module in use. if peer.Sync { go func() { time.Sleep(time.Second * 32) diff --git a/ekms/handlers/danet/assignForwardingHandler.go b/ekms/handlers/danet/assignForwardingHandler.go index b10d6c78..5e08c078 100644 --- a/ekms/handlers/danet/assignForwardingHandler.go +++ b/ekms/handlers/danet/assignForwardingHandler.go @@ -48,18 +48,19 @@ func (yh *AssignForwardingHandler) Update(c ygot.ValidatedGoStruct, jobs []*gnmi forwarding := config.GetOrCreateAssignForwarding() - nextHop := forwarding.GetOrCreateNextHop() - prevHop := forwarding.GetOrCreatePrevHop() + pathId := forwarding.GetPathId() + nextHop := forwarding.GetNextHop() + prevHop := forwarding.GetPrevHop() var nextHopString string var prevHopString string var initiatingKmsAddressString string - if nextHop.IpAddress != nil { - nextHopString = fmt.Sprintf("%s:%d", nextHop.GetIpAddress(), nextHop.GetPort()) + if nextHop != nil { + nextHopString = nextHop.GetNodeId() } - if prevHop.IpAddress != nil { - prevHopString = fmt.Sprintf("%s:%d", prevHop.GetIpAddress(), prevHop.GetPort()) + if prevHop != nil { + prevHopString = prevHop.GetNodeId() } // check if initiating kms address is set @@ -67,7 +68,7 @@ func (yh *AssignForwardingHandler) Update(c ygot.ValidatedGoStruct, jobs []*gnmi initiatingKmsAddressString = fmt.Sprintf("%s:%d", initiatingKmsAddress.GetInitiatingKmsIp(), initiatingKmsAddress.GetInitiatingKmsPort()) } - if err := yh.ekmsClient.Ekms().AssignForwardingRoute(forwarding.GetPathId(), prevHopString, nextHopString, initiatingKmsAddressString); err != nil { + if err := yh.ekmsClient.Ekms().AssignForwardingRoute(pathId, prevHopString, nextHopString, initiatingKmsAddressString); err != nil { return err } diff --git a/ekms/handlers/danet/keyRoutingSessionsHandler.go b/ekms/handlers/danet/keyRoutingSessionsHandler.go index 74897626..993ee656 100644 --- a/ekms/handlers/danet/keyRoutingSessionsHandler.go +++ b/ekms/handlers/danet/keyRoutingSessionsHandler.go @@ -91,10 +91,10 @@ func (yh *KeyRoutingSessionHandler) Update(c ygot.ValidatedGoStruct, jobs []*gnm var prevHopString string var initiatingKmsAddressString string if nextHop != nil { - nextHopString = fmt.Sprintf("%s:%d", nextHop.GetIpAddress(), nextHop.GetPort()) + nextHopString = nextHop.GetNodeId() } if prevHop != nil { - prevHopString = fmt.Sprintf("%s:%d", prevHop.GetIpAddress(), prevHop.GetPort()) + prevHopString = prevHop.GetNodeId() } // check if initiating kms address is set diff --git a/ekms/internal/api/gen/proto/go/kmsetsi/kmsetsiproto.pb.go b/ekms/internal/api/gen/proto/go/kmsetsi/kmsetsiproto.pb.go index 10de0b92..ecece3c0 100644 --- a/ekms/internal/api/gen/proto/go/kmsetsi/kmsetsiproto.pb.go +++ b/ekms/internal/api/gen/proto/go/kmsetsi/kmsetsiproto.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.32.0 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: kmsetsi/kmsetsiproto.proto diff --git a/ekms/internal/api/gen/proto/go/kmsintercom/kmsintercom.pb.go b/ekms/internal/api/gen/proto/go/kmsintercom/kmsintercom.pb.go index 7a9816cf..94693704 100644 --- a/ekms/internal/api/gen/proto/go/kmsintercom/kmsintercom.pb.go +++ b/ekms/internal/api/gen/proto/go/kmsintercom/kmsintercom.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.32.0 +// protoc-gen-go v1.33.0 // protoc (unknown) // source: kmsintercom/kmsintercom.proto @@ -138,9 +138,9 @@ type SyncQkdBulkRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - InterComAddr string `protobuf:"bytes,2,opt,name=interComAddr,proto3" json:"interComAddr,omitempty"` - BulkId []int64 `protobuf:"varint,3,rep,packed,name=bulkId,proto3" json:"bulkId,omitempty"` //string bulkHash = 4; + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + KmsId string `protobuf:"bytes,2,opt,name=kmsId,proto3" json:"kmsId,omitempty"` + BulkId []int64 `protobuf:"varint,3,rep,packed,name=bulkId,proto3" json:"bulkId,omitempty"` //string bulkHash = 4; } func (x *SyncQkdBulkRequest) Reset() { @@ -182,9 +182,9 @@ func (x *SyncQkdBulkRequest) GetTimestamp() int64 { return 0 } -func (x *SyncQkdBulkRequest) GetInterComAddr() string { +func (x *SyncQkdBulkRequest) GetKmsId() string { if x != nil { - return x.InterComAddr + return x.KmsId } return "" } @@ -201,10 +201,10 @@ type SyncKeyIdsForBulkRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - InterComAddr string `protobuf:"bytes,2,opt,name=interComAddr,proto3" json:"interComAddr,omitempty"` - BulkId int64 `protobuf:"varint,3,opt,name=bulkId,proto3" json:"bulkId,omitempty"` - KeyId []string `protobuf:"bytes,4,rep,name=keyId,proto3" json:"keyId,omitempty"` + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + KmsId string `protobuf:"bytes,2,opt,name=kmsId,proto3" json:"kmsId,omitempty"` + BulkId int64 `protobuf:"varint,3,opt,name=bulkId,proto3" json:"bulkId,omitempty"` + KeyId []string `protobuf:"bytes,4,rep,name=keyId,proto3" json:"keyId,omitempty"` } func (x *SyncKeyIdsForBulkRequest) Reset() { @@ -246,9 +246,9 @@ func (x *SyncKeyIdsForBulkRequest) GetTimestamp() int64 { return 0 } -func (x *SyncKeyIdsForBulkRequest) GetInterComAddr() string { +func (x *SyncKeyIdsForBulkRequest) GetKmsId() string { if x != nil { - return x.InterComAddr + return x.KmsId } return "" } @@ -595,9 +595,9 @@ type KeyIdNotificationRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - InterComAddr string `protobuf:"bytes,2,opt,name=interComAddr,proto3" json:"interComAddr,omitempty"` - KeyIds []string `protobuf:"bytes,3,rep,name=keyIds,proto3" json:"keyIds,omitempty"` + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + KmsId string `protobuf:"bytes,2,opt,name=kmsId,proto3" json:"kmsId,omitempty"` + KeyIds []string `protobuf:"bytes,3,rep,name=keyIds,proto3" json:"keyIds,omitempty"` } func (x *KeyIdNotificationRequest) Reset() { @@ -639,9 +639,9 @@ func (x *KeyIdNotificationRequest) GetTimestamp() int64 { return 0 } -func (x *KeyIdNotificationRequest) GetInterComAddr() string { +func (x *KeyIdNotificationRequest) GetKmsId() string { if x != nil { - return x.InterComAddr + return x.KmsId } return "" } @@ -890,137 +890,134 @@ var file_kmsintercom_kmsintercom_proto_rawDesc = []byte{ 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x65, 0x65, 0x72, 0x4b, 0x6d, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x65, 0x65, 0x72, 0x4b, 0x6d, 0x73, - 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x6e, 0x0a, 0x12, 0x53, 0x79, 0x6e, 0x63, 0x51, 0x6b, 0x64, 0x42, + 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x60, 0x0a, 0x12, 0x53, 0x79, 0x6e, 0x63, 0x51, 0x6b, 0x64, 0x42, 0x75, 0x6c, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, - 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x43, 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, 0x12, 0x16, 0x0a, 0x06, - 0x62, 0x75, 0x6c, 0x6b, 0x49, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, 0x62, 0x75, - 0x6c, 0x6b, 0x49, 0x64, 0x22, 0x8a, 0x01, 0x0a, 0x18, 0x53, 0x79, 0x6e, 0x63, 0x4b, 0x65, 0x79, - 0x49, 0x64, 0x73, 0x46, 0x6f, 0x72, 0x42, 0x75, 0x6c, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, - 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x41, - 0x64, 0x64, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x6c, 0x6b, 0x49, 0x64, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x06, 0x62, 0x75, 0x6c, 0x6b, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6b, - 0x65, 0x79, 0x49, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, - 0x64, 0x22, 0x39, 0x0a, 0x19, 0x53, 0x79, 0x6e, 0x63, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x73, 0x46, - 0x6f, 0x72, 0x42, 0x75, 0x6c, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, - 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x4b, 0x0a, 0x13, - 0x53, 0x79, 0x6e, 0x63, 0x51, 0x6b, 0x64, 0x42, 0x75, 0x6c, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x6c, 0x6b, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x03, 0x52, 0x06, 0x62, 0x75, 0x6c, 0x6b, 0x49, 0x64, 0x22, 0x7a, 0x0a, 0x26, 0x49, 0x6e, 0x74, - 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x4b, 0x65, - 0x79, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x74, 0x68, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x70, 0x61, 0x74, 0x68, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, 0x6b, 0x65, 0x79, - 0x54, 0x6f, 0x55, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6b, 0x65, 0x79, - 0x54, 0x6f, 0x55, 0x73, 0x65, 0x22, 0x47, 0x0a, 0x27, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x43, 0x6f, - 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x4b, 0x65, 0x79, 0x4e, 0x65, 0x67, - 0x6f, 0x74, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x66, - 0x0a, 0x14, 0x4b, 0x65, 0x79, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x52, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x6b, 0x6d, 0x73, 0x49, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, 0x6d, 0x73, 0x49, 0x64, 0x12, 0x16, + 0x0a, 0x06, 0x62, 0x75, 0x6c, 0x6b, 0x49, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x03, 0x52, 0x06, + 0x62, 0x75, 0x6c, 0x6b, 0x49, 0x64, 0x22, 0x7c, 0x0a, 0x18, 0x53, 0x79, 0x6e, 0x63, 0x4b, 0x65, + 0x79, 0x49, 0x64, 0x73, 0x46, 0x6f, 0x72, 0x42, 0x75, 0x6c, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x12, 0x14, 0x0a, 0x05, 0x6b, 0x6d, 0x73, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x6b, 0x6d, 0x73, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x6c, 0x6b, 0x49, 0x64, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x62, 0x75, 0x6c, 0x6b, 0x49, 0x64, 0x12, 0x14, + 0x0a, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x05, 0x6b, + 0x65, 0x79, 0x49, 0x64, 0x22, 0x39, 0x0a, 0x19, 0x53, 0x79, 0x6e, 0x63, 0x4b, 0x65, 0x79, 0x49, + 0x64, 0x73, 0x46, 0x6f, 0x72, 0x42, 0x75, 0x6c, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, + 0x4b, 0x0a, 0x13, 0x53, 0x79, 0x6e, 0x63, 0x51, 0x6b, 0x64, 0x42, 0x75, 0x6c, 0x6b, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, + 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x62, 0x75, 0x6c, 0x6b, 0x49, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x62, 0x75, 0x6c, 0x6b, 0x49, 0x64, 0x22, 0x7a, 0x0a, 0x26, + 0x49, 0x6e, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, + 0x74, 0x4b, 0x65, 0x79, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, - 0x74, 0x61, 0x6d, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x74, 0x68, 0x49, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x74, 0x68, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, - 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, - 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x35, 0x0a, 0x15, 0x4b, 0x65, 0x79, 0x46, 0x6f, 0x72, - 0x77, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x74, 0x0a, - 0x18, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, - 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, + 0x74, 0x61, 0x6d, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x74, 0x68, 0x49, 0x44, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x74, 0x68, 0x49, 0x44, 0x12, 0x1a, 0x0a, 0x08, + 0x6b, 0x65, 0x79, 0x54, 0x6f, 0x55, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, + 0x6b, 0x65, 0x79, 0x54, 0x6f, 0x55, 0x73, 0x65, 0x22, 0x47, 0x0a, 0x27, 0x49, 0x6e, 0x74, 0x65, + 0x72, 0x43, 0x6f, 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x4b, 0x65, 0x79, + 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x22, 0x66, 0x0a, 0x14, 0x4b, 0x65, 0x79, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x69, + 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, - 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x22, 0x0a, 0x0c, 0x69, 0x6e, 0x74, 0x65, 0x72, - 0x43, 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x69, - 0x6e, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x41, 0x64, 0x64, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x6b, - 0x65, 0x79, 0x49, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x06, 0x6b, 0x65, 0x79, - 0x49, 0x64, 0x73, 0x22, 0x39, 0x0a, 0x19, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x4e, 0x6f, 0x74, 0x69, - 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x8c, - 0x01, 0x0a, 0x12, 0x4b, 0x65, 0x79, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x74, 0x68, 0x49, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x74, 0x68, 0x49, 0x64, 0x12, + 0x18, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x35, 0x0a, 0x15, 0x4b, 0x65, 0x79, + 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, + 0x22, 0x66, 0x0a, 0x18, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, + 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, + 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x14, 0x0a, 0x05, 0x6b, 0x6d, + 0x73, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, 0x6d, 0x73, 0x49, 0x64, + 0x12, 0x16, 0x0a, 0x06, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x06, 0x6b, 0x65, 0x79, 0x49, 0x64, 0x73, 0x22, 0x39, 0x0a, 0x19, 0x4b, 0x65, 0x79, 0x49, + 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, - 0x61, 0x6d, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x74, 0x68, 0x49, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x74, 0x68, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x63, 0x6f, 0x6d, 0x2e, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x22, 0x33, 0x0a, - 0x13, 0x4b, 0x65, 0x79, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x22, 0x27, 0x0a, 0x03, 0x4b, 0x65, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x32, 0xd6, 0x05, 0x0a, 0x09, - 0x4b, 0x6d, 0x73, 0x54, 0x61, 0x6c, 0x6b, 0x65, 0x72, 0x12, 0x6a, 0x0a, 0x14, 0x49, 0x6e, 0x74, - 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, - 0x73, 0x12, 0x28, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x2e, - 0x49, 0x6e, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, - 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6b, 0x6d, - 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x43, - 0x6f, 0x6d, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x0b, 0x53, 0x79, 0x6e, 0x63, 0x51, 0x6b, 0x64, - 0x42, 0x75, 0x6c, 0x6b, 0x12, 0x1f, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, - 0x6f, 0x6d, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x51, 0x6b, 0x64, 0x42, 0x75, 0x6c, 0x6b, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, - 0x63, 0x6f, 0x6d, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x51, 0x6b, 0x64, 0x42, 0x75, 0x6c, 0x6b, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x64, 0x0a, 0x11, 0x53, 0x79, 0x6e, - 0x63, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x73, 0x46, 0x6f, 0x72, 0x42, 0x75, 0x6c, 0x6b, 0x12, 0x25, - 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x2e, 0x53, 0x79, 0x6e, - 0x63, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x73, 0x46, 0x6f, 0x72, 0x42, 0x75, 0x6c, 0x6b, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, - 0x63, 0x6f, 0x6d, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x73, 0x46, 0x6f, - 0x72, 0x42, 0x75, 0x6c, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x8e, 0x01, 0x0a, 0x1f, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x54, 0x72, 0x61, 0x6e, - 0x73, 0x70, 0x6f, 0x72, 0x74, 0x4b, 0x65, 0x79, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, - 0x6d, 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, - 0x6f, 0x72, 0x74, 0x4b, 0x65, 0x79, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, + 0x61, 0x6d, 0x70, 0x22, 0x8c, 0x01, 0x0a, 0x12, 0x4b, 0x65, 0x79, 0x44, 0x65, 0x6c, 0x69, 0x76, + 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, + 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x74, 0x68, + 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x74, 0x68, 0x49, 0x64, + 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x49, 0x64, 0x12, 0x22, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x6b, 0x6d, + 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x2e, 0x4b, 0x65, 0x79, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x22, 0x33, 0x0a, 0x13, 0x4b, 0x65, 0x79, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, + 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x27, 0x0a, 0x03, 0x4b, 0x65, 0x79, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x32, 0xd6, 0x05, 0x0a, 0x09, 0x4b, 0x6d, 0x73, 0x54, 0x61, 0x6c, 0x6b, 0x65, 0x72, 0x12, 0x6a, + 0x0a, 0x14, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, + 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x28, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x63, 0x6f, 0x6d, 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x43, 0x61, 0x70, + 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x26, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x2e, 0x49, + 0x6e, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, + 0x69, 0x65, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x0b, 0x53, 0x79, + 0x6e, 0x63, 0x51, 0x6b, 0x64, 0x42, 0x75, 0x6c, 0x6b, 0x12, 0x1f, 0x2e, 0x6b, 0x6d, 0x73, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x51, 0x6b, 0x64, 0x42, + 0x75, 0x6c, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6b, 0x6d, 0x73, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x51, 0x6b, 0x64, + 0x42, 0x75, 0x6c, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x64, + 0x0a, 0x11, 0x53, 0x79, 0x6e, 0x63, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x73, 0x46, 0x6f, 0x72, 0x42, + 0x75, 0x6c, 0x6b, 0x12, 0x25, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, + 0x6d, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x73, 0x46, 0x6f, 0x72, 0x42, + 0x75, 0x6c, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6b, 0x6d, 0x73, + 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x4b, 0x65, 0x79, + 0x49, 0x64, 0x73, 0x46, 0x6f, 0x72, 0x42, 0x75, 0x6c, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x8e, 0x01, 0x0a, 0x1f, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x43, 0x6f, + 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x4b, 0x65, 0x79, 0x4e, 0x65, 0x67, + 0x6f, 0x74, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x33, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x2e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x43, 0x6f, 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x4b, 0x65, 0x79, 0x4e, 0x65, 0x67, 0x6f, 0x74, - 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x12, 0x58, 0x0a, 0x0d, 0x4b, 0x65, 0x79, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x69, 0x6e, - 0x67, 0x12, 0x21, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x2e, - 0x4b, 0x65, 0x79, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, - 0x6f, 0x6d, 0x2e, 0x4b, 0x65, 0x79, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x64, 0x0a, 0x11, 0x4b, 0x65, - 0x79, 0x49, 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, - 0x25, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x2e, 0x4b, 0x65, - 0x79, 0x49, 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x63, 0x6f, 0x6d, 0x2e, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x12, 0x52, 0x0a, 0x0b, 0x4b, 0x65, 0x79, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x12, - 0x1f, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x2e, 0x4b, 0x65, - 0x79, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x20, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x2e, 0x4b, - 0x65, 0x79, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x42, 0xb7, 0x01, 0x0a, 0x0f, 0x63, 0x6f, 0x6d, 0x2e, 0x6b, 0x6d, 0x73, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x42, 0x10, 0x4b, 0x6d, 0x73, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x46, 0x63, 0x6f, - 0x64, 0x65, 0x2e, 0x66, 0x62, 0x69, 0x2e, 0x68, 0x2d, 0x64, 0x61, 0x2e, 0x64, 0x65, 0x2f, 0x64, - 0x65, 0x6d, 0x6f, 0x71, 0x75, 0x61, 0x6e, 0x64, 0x74, 0x2f, 0x65, 0x6b, 0x6d, 0x73, 0x2f, 0x69, - 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x6b, 0x6d, 0x73, 0x2f, 0x67, 0x65, 0x6e, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x63, 0x6f, 0x6d, 0xa2, 0x02, 0x03, 0x4b, 0x58, 0x58, 0xaa, 0x02, 0x0b, 0x4b, 0x6d, 0x73, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0xca, 0x02, 0x0b, 0x4b, 0x6d, 0x73, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0xe2, 0x02, 0x17, 0x4b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, - 0x72, 0x63, 0x6f, 0x6d, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x0b, 0x4b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, + 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x2e, 0x49, 0x6e, 0x74, 0x65, + 0x72, 0x43, 0x6f, 0x6d, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x4b, 0x65, 0x79, + 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x58, 0x0a, 0x0d, 0x4b, 0x65, 0x79, 0x46, 0x6f, 0x72, 0x77, + 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x21, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x63, 0x6f, 0x6d, 0x2e, 0x4b, 0x65, 0x79, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x69, + 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x6b, 0x6d, 0x73, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x2e, 0x4b, 0x65, 0x79, 0x46, 0x6f, 0x72, 0x77, 0x61, + 0x72, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x64, 0x0a, 0x11, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x25, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, + 0x6f, 0x6d, 0x2e, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x6b, 0x6d, + 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x2e, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x4e, + 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x0b, 0x4b, 0x65, 0x79, 0x44, 0x65, 0x6c, 0x69, + 0x76, 0x65, 0x72, 0x79, 0x12, 0x1f, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, + 0x6f, 0x6d, 0x2e, 0x4b, 0x65, 0x79, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x63, 0x6f, 0x6d, 0x2e, 0x4b, 0x65, 0x79, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x79, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0xb7, 0x01, 0x0a, 0x0f, 0x63, 0x6f, + 0x6d, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x42, 0x10, 0x4b, + 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, + 0x01, 0x5a, 0x46, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x66, 0x62, 0x69, 0x2e, 0x68, 0x2d, 0x64, 0x61, + 0x2e, 0x64, 0x65, 0x2f, 0x64, 0x65, 0x6d, 0x6f, 0x71, 0x75, 0x61, 0x6e, 0x64, 0x74, 0x2f, 0x65, + 0x6b, 0x6d, 0x73, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x6b, 0x6d, 0x73, + 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x6b, 0x6d, + 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0xa2, 0x02, 0x03, 0x4b, 0x58, 0x58, 0xaa, + 0x02, 0x0b, 0x4b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0xca, 0x02, 0x0b, + 0x4b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0xe2, 0x02, 0x17, 0x4b, 0x6d, + 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0b, 0x4b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, + 0x63, 0x6f, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/ekms/internal/api/kmsintercom/kmsintercom/kmsintercom.proto b/ekms/internal/api/kmsintercom/kmsintercom/kmsintercom.proto index 2a28ce94..1690178b 100644 --- a/ekms/internal/api/kmsintercom/kmsintercom/kmsintercom.proto +++ b/ekms/internal/api/kmsintercom/kmsintercom/kmsintercom.proto @@ -29,14 +29,14 @@ message InterComCapabilitiesReply { message SyncQkdBulkRequest { int64 timestamp = 1; - string interComAddr = 2; + string kmsId = 2; repeated int64 bulkId = 3; //string bulkHash = 4; } message SyncKeyIdsForBulkRequest { int64 timestamp = 1; - string interComAddr = 2; + string kmsId = 2; int64 bulkId = 3; repeated string keyId = 4; } @@ -73,7 +73,7 @@ message KeyForwardingResponse { message KeyIdNotificationRequest { int64 timestamp = 1; - string interComAddr = 2; + string kmsId = 2; repeated string keyIds = 3; } diff --git a/ekms/internal/kms/kms.go b/ekms/internal/kms/kms.go index 04b3702b..4b26db99 100644 --- a/ekms/internal/kms/kms.go +++ b/ekms/internal/kms/kms.go @@ -157,20 +157,20 @@ func (kms *EKMS) AddQuantumElement(qm QuantumModule) error { return nil } -func (kms *EKMS) AddPeer(peerKmsId string, kmsPeerSocket string, servingQLE QuantumModule) (*kmsPeer, error) { +func (kms *EKMS) AddPeer(peerKmsId string, kmsPeerSocket string, servingQLE QuantumModule, client *GRPCClient) (*kmsPeer, error) { // check if peer exists - if _, there := kms.KmsPeers[kmsPeerSocket]; there { - log.Errorf("Trying to add existing peer %s", kmsPeerSocket) - return nil, fmt.Errorf("Trying to add existing peer %s", kmsPeerSocket) + if _, there := kms.KmsPeers[peerKmsId]; there { + log.Errorf("Trying to add existing peer %s, with KMS ID %s", kmsPeerSocket, peerKmsId) + return nil, fmt.Errorf("Trying to add existing peer %s, with KMS ID %s", kmsPeerSocket, peerKmsId) } - peer, err := NewKmsPeer(peerKmsId, servingQLE, kmsPeerSocket, kms.interComAddr, kms.eventBus) + peer, err := NewKmsPeer(peerKmsId, servingQLE, kmsPeerSocket, kms.interComAddr, client, kms.eventBus) if err != nil { return nil, err } peer.tcpSocketStr = kmsPeerSocket kms.kmsPeersMutex.Lock() - kms.KmsPeers[kmsPeerSocket] = peer + kms.KmsPeers[peerKmsId] = peer kms.kmsPeersMutex.Unlock() // go peer.PeerHandler(kms.kmsName) diff --git a/ekms/internal/kms/kmsetsi.go b/ekms/internal/kms/kmsetsi.go index 205e9d3a..81619e9b 100644 --- a/ekms/internal/kms/kmsetsi.go +++ b/ekms/internal/kms/kmsetsi.go @@ -63,7 +63,7 @@ func (es *etsiServer) ETSIAddKMSPeer(ctx context.Context, in *pb.ETSIKMSPeerRequ } // TODO: remove hardcoded id - _, err := es.handlingEkms.AddPeer("default", in.GetKmsPeerSocket(), servingQLE) + _, err := es.handlingEkms.AddPeer("default", in.GetKmsPeerSocket(), servingQLE, nil) if err != nil { return nil, err } diff --git a/ekms/internal/kms/kmsintercom.go b/ekms/internal/kms/kmsintercom.go index 2104d5b4..1be07fd1 100644 --- a/ekms/internal/kms/kmsintercom.go +++ b/ekms/internal/kms/kmsintercom.go @@ -4,7 +4,7 @@ import ( "context" "encoding/base64" "fmt" - "io/ioutil" + "io" "net" "time" @@ -43,7 +43,7 @@ func (s *kmsTalkerServer) InterComCapabilities(ctx context.Context, in *pb.Inter func (s *kmsTalkerServer) KeyIdNotification(ctx context.Context, in *pb.KeyIdNotificationRequest) (*pb.KeyIdNotificationResponse, error) { // check if a peer exists - peer, ok := s.eKMS.KmsPeers[in.GetInterComAddr()] + peer, ok := s.eKMS.KmsPeers[in.GetKmsId()] if !ok { // TODO: proper error message return nil, status.Error(codes.Internal, "peer does not exist") @@ -74,7 +74,7 @@ func (s *kmsTalkerServer) KeyIdNotification(ctx context.Context, in *pb.KeyIdNot // TODO: add proper status code handling if resp.StatusCode != 200 { - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) if err != nil { return nil, err } @@ -97,7 +97,7 @@ func (s *kmsTalkerServer) SyncQkdBulk(ctx context.Context, in *pb.SyncQkdBulkReq // NOTE: with "google.golang.org/grpc/peer" it would be possible to get the client ip directly // check if a peer exists - peer, ok := s.eKMS.KmsPeers[in.GetInterComAddr()] + peer, ok := s.eKMS.KmsPeers[in.GetKmsId()] if !ok { // TODO: proper error message return nil, status.Errorf(codes.Internal, "peer does not exist") @@ -121,9 +121,9 @@ func (s *kmsTalkerServer) SyncQkdBulk(ctx context.Context, in *pb.SyncQkdBulkReq } func (s *kmsTalkerServer) SyncKeyIdsForBulk(ctx context.Context, in *pb.SyncKeyIdsForBulkRequest) (*pb.SyncKeyIdsForBulkResponse, error) { - peer, ok := s.eKMS.KmsPeers[in.GetInterComAddr()] + peer, ok := s.eKMS.KmsPeers[in.GetKmsId()] if !ok { - return nil, status.Errorf(codes.Internal, "For address: %s, no peer exists", in.GetInterComAddr()) + return nil, status.Errorf(codes.Internal, "For KMS id: %s, no peer exists", in.GetKmsId()) } eqm, ok := peer.servingQuantumModul.(*EmulatedQuantumModule) diff --git a/ekms/internal/kms/kmspeers.go b/ekms/internal/kms/kmspeers.go index d46a607c..75fd97b1 100644 --- a/ekms/internal/kms/kmspeers.go +++ b/ekms/internal/kms/kmspeers.go @@ -12,8 +12,6 @@ import ( "code.fbi.h-da.de/danet/quant/ekms/internal/kms/event" "github.com/google/uuid" log "github.com/sirupsen/logrus" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" ) type KmsPeerStatus int16 @@ -33,8 +31,12 @@ const ( // KmsPeerKeyInit() // } +type GRPCClient struct { + pbIC.KmsTalkerClient +} + type kmsPeer struct { - peerClient pbIC.KmsTalkerClient + peerClient *GRPCClient peerStatus KmsPeerStatus peerKmsId uuid.UUID // NOTE: might be changed in the future interComAddr string @@ -49,7 +51,8 @@ type kmsPeer struct { eventBus *event.EventBus } -func NewKmsPeer(peerKmsId string, servQM QuantumModule, tcpSocketStr string, interComAddr string, eventBus *event.EventBus) (*kmsPeer, error) { +// TODO: check intercomaddr -> remove? +func NewKmsPeer(peerKmsId string, servQM QuantumModule, tcpSocketStr string, interComAddr string, client *GRPCClient, eventBus *event.EventBus) (*kmsPeer, error) { if servQM.Peer() != nil { return nil, fmt.Errorf("QuantumModule with ID: %s, already has a peer", servQM.ID()) } @@ -58,12 +61,6 @@ func NewKmsPeer(peerKmsId string, servQM QuantumModule, tcpSocketStr string, int if err != nil { return nil, err } - newPeerConn, err := grpc.Dial(tcpSocketStr, grpc.WithTransportCredentials(insecure.NewCredentials())) - if err != nil { - return nil, err - } - - peerClient := pbIC.NewKmsTalkerClient(newPeerConn) tcpSocket, err := net.ResolveTCPAddr("tcp", tcpSocketStr) if err != nil { @@ -74,7 +71,7 @@ func NewKmsPeer(peerKmsId string, servQM QuantumModule, tcpSocketStr string, int // NOTE It could be a good idea to turn client and status into its own // struct (and additional information) e.g. a link // We need multiple peer clients! - peerClient: peerClient, + peerClient: client, // TODO: change this, only for demo purposes peerStatus: KmsPeerUp, peerKmsId: peerKmsIdUUID, diff --git a/ekms/internal/kms/module.go b/ekms/internal/kms/module.go index 9046b0f8..fe915b9e 100644 --- a/ekms/internal/kms/module.go +++ b/ekms/internal/kms/module.go @@ -32,7 +32,8 @@ type QuantumModule interface { } type EmulatedQuantumModule struct { - QlID uuid.UUID + QlID uuid.UUID + kmsId string // QuantumElementLink *quantumlayer.QuantumlayerEmuPRNG // contains information about the quantum links // key stores of unchopped bulk keys go here addr string @@ -42,10 +43,11 @@ type EmulatedQuantumModule struct { peer *kmsPeer } -func NewEmulatedQuantumModule(kmsUDPAddr string) *EmulatedQuantumModule { +func NewEmulatedQuantumModule(kmsUDPAddr string, kmsId string) *EmulatedQuantumModule { return &EmulatedQuantumModule{ QlID: uuid.New(), // QuantumElementLink: ql, + kmsId: kmsId, addr: kmsUDPAddr, rawBulkKeys: make(map[int64]*quantumlayer.QuantumLayerBulkKey), keyStore: NewKmsKeyStore(256), @@ -74,9 +76,9 @@ func (eqe *EmulatedQuantumModule) Sync() error { ctx, cancel := context.WithTimeout(context.Background(), time.Second) defer cancel() initialPeerSetupResponse, err := eqe.peer.peerClient.SyncQkdBulk(ctx, &pbIC.SyncQkdBulkRequest{ - Timestamp: time.Now().Unix(), - InterComAddr: eqe.peer.interComAddr, - BulkId: rawBulkKeyIds, + Timestamp: time.Now().Unix(), + KmsId: eqe.kmsId, + BulkId: rawBulkKeyIds, }) if err != nil { return err @@ -98,10 +100,10 @@ func (eqe *EmulatedQuantumModule) Sync() error { } _, err = eqe.peer.peerClient.SyncKeyIdsForBulk(ctx, &pbIC.SyncKeyIdsForBulkRequest{ - Timestamp: time.Now().Unix(), - InterComAddr: eqe.peer.interComAddr, - BulkId: initialPeerSetupResponse.BulkId, - KeyId: keyIds, + Timestamp: time.Now().Unix(), + KmsId: eqe.kmsId, + BulkId: initialPeerSetupResponse.BulkId, + KeyId: keyIds, }) if err != nil { return err @@ -205,6 +207,7 @@ func (eqe *EmulatedQuantumModule) KeyChopper(bulkKey *quantumlayer.QuantumLayerB type ETSI014HTTPQuantumModule struct { id uuid.UUID + kmsId string addr string keyStore *kmsKeyStore peer *kmsPeer @@ -214,7 +217,7 @@ type ETSI014HTTPQuantumModule struct { master bool } -func NewETSI014HTTPQuantumModule(addr, slaveSAEID, masterSAEID string, master bool) (*ETSI014HTTPQuantumModule, error) { +func NewETSI014HTTPQuantumModule(addr, kmsId, slaveSAEID, masterSAEID string, master bool) (*ETSI014HTTPQuantumModule, error) { parsedUrl, err := url.Parse("http://" + addr) if err != nil { return nil, err @@ -244,6 +247,7 @@ func NewETSI014HTTPQuantumModule(addr, slaveSAEID, masterSAEID string, master bo return &ETSI014HTTPQuantumModule{ id: uuid.New(), + kmsId: kmsId, addr: addr, keyStore: NewKmsKeyStore(256), peer: nil, @@ -282,9 +286,9 @@ func (eqe *ETSI014HTTPQuantumModule) Initialize() error { _, err = eqe.peer.peerClient.KeyIdNotification(context.Background(), &pbIC.KeyIdNotificationRequest{ - Timestamp: time.Now().Unix(), - InterComAddr: eqe.peer.interComAddr, - KeyIds: keyIds, + Timestamp: time.Now().Unix(), + KmsId: eqe.kmsId, + KeyIds: keyIds, }) if err != nil { log.Error(err) -- GitLab