diff --git a/ekms/internal/akmsCkmsServer/akmsCkmsServer.go b/ekms/internal/akmsCkmsServer/akmsCkmsServer.go index 89849402fb00e7437ad3be4e814a07701d7f4020..b7e46a57fc2022e9bd707923d35d7e1d7176de87 100644 --- a/ekms/internal/akmsCkmsServer/akmsCkmsServer.go +++ b/ekms/internal/akmsCkmsServer/akmsCkmsServer.go @@ -60,11 +60,13 @@ func ksaReqHandler(ekms *kms.EKMS) http.HandlerFunc { return } - logrus.Infof("received KSA key request for receiving CKMS %s, request ID %s, and key properties %v", + logrus.Debugf("received KSA key request for receiving CKMS %s, request ID %s, and key properties %v", kmsKeyRequest.ReceivingCKMSID, kmsKeyRequest.RequestID, kmsKeyRequest.KeyProperties) pathId := uuid.New() + logrus.Debugf("created new path id: %s, for incoming KSA key request", pathId) + receiverChan, err := ekms.Receiver.RequestReceiverChannel(pathId) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) 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 8072880f9edda87ae445fb83bff4647af8045248..a5c2c8cccd52870601c6e0b1e0e89093130f1d26 100644 --- a/ekms/internal/api/gen/proto/go/kmsintercom/kmsintercom.pb.go +++ b/ekms/internal/api/gen/proto/go/kmsintercom/kmsintercom.pb.go @@ -488,7 +488,7 @@ type KeyForwardingRequest struct { Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` PathId string `protobuf:"bytes,2,opt,name=pathId,proto3" json:"pathId,omitempty"` ProcessId string `protobuf:"bytes,3,opt,name=processId,proto3" json:"processId,omitempty"` - Key *Key `protobuf:"bytes,4,opt,name=key,proto3" json:"key,omitempty"` //string payload = 3; + Key *Key `protobuf:"bytes,4,opt,name=key,proto3" json:"key,omitempty"` } func (x *KeyForwardingRequest) Reset() { @@ -598,6 +598,124 @@ func (x *KeyForwardingResponse) GetTimestamp() int64 { return 0 } +type AckKeyForwardingRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + PathId string `protobuf:"bytes,2,opt,name=pathId,proto3" json:"pathId,omitempty"` + ProcessId string `protobuf:"bytes,3,opt,name=processId,proto3" json:"processId,omitempty"` + KeyId string `protobuf:"bytes,4,opt,name=KeyId,proto3" json:"KeyId,omitempty"` +} + +func (x *AckKeyForwardingRequest) Reset() { + *x = AckKeyForwardingRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_kmsintercom_kmsintercom_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AckKeyForwardingRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AckKeyForwardingRequest) ProtoMessage() {} + +func (x *AckKeyForwardingRequest) ProtoReflect() protoreflect.Message { + mi := &file_kmsintercom_kmsintercom_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AckKeyForwardingRequest.ProtoReflect.Descriptor instead. +func (*AckKeyForwardingRequest) Descriptor() ([]byte, []int) { + return file_kmsintercom_kmsintercom_proto_rawDescGZIP(), []int{10} +} + +func (x *AckKeyForwardingRequest) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *AckKeyForwardingRequest) GetPathId() string { + if x != nil { + return x.PathId + } + return "" +} + +func (x *AckKeyForwardingRequest) GetProcessId() string { + if x != nil { + return x.ProcessId + } + return "" +} + +func (x *AckKeyForwardingRequest) GetKeyId() string { + if x != nil { + return x.KeyId + } + return "" +} + +type AckKeyForwardingResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` +} + +func (x *AckKeyForwardingResponse) Reset() { + *x = AckKeyForwardingResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_kmsintercom_kmsintercom_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AckKeyForwardingResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AckKeyForwardingResponse) ProtoMessage() {} + +func (x *AckKeyForwardingResponse) ProtoReflect() protoreflect.Message { + mi := &file_kmsintercom_kmsintercom_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use AckKeyForwardingResponse.ProtoReflect.Descriptor instead. +func (*AckKeyForwardingResponse) Descriptor() ([]byte, []int) { + return file_kmsintercom_kmsintercom_proto_rawDescGZIP(), []int{11} +} + +func (x *AckKeyForwardingResponse) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + type KeyIdNotificationRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -611,7 +729,7 @@ type KeyIdNotificationRequest struct { func (x *KeyIdNotificationRequest) Reset() { *x = KeyIdNotificationRequest{} if protoimpl.UnsafeEnabled { - mi := &file_kmsintercom_kmsintercom_proto_msgTypes[10] + mi := &file_kmsintercom_kmsintercom_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -624,7 +742,7 @@ func (x *KeyIdNotificationRequest) String() string { func (*KeyIdNotificationRequest) ProtoMessage() {} func (x *KeyIdNotificationRequest) ProtoReflect() protoreflect.Message { - mi := &file_kmsintercom_kmsintercom_proto_msgTypes[10] + mi := &file_kmsintercom_kmsintercom_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -637,7 +755,7 @@ func (x *KeyIdNotificationRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use KeyIdNotificationRequest.ProtoReflect.Descriptor instead. func (*KeyIdNotificationRequest) Descriptor() ([]byte, []int) { - return file_kmsintercom_kmsintercom_proto_rawDescGZIP(), []int{10} + return file_kmsintercom_kmsintercom_proto_rawDescGZIP(), []int{12} } func (x *KeyIdNotificationRequest) GetTimestamp() int64 { @@ -672,7 +790,7 @@ type KeyIdNotificationResponse struct { func (x *KeyIdNotificationResponse) Reset() { *x = KeyIdNotificationResponse{} if protoimpl.UnsafeEnabled { - mi := &file_kmsintercom_kmsintercom_proto_msgTypes[11] + mi := &file_kmsintercom_kmsintercom_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -685,7 +803,7 @@ func (x *KeyIdNotificationResponse) String() string { func (*KeyIdNotificationResponse) ProtoMessage() {} func (x *KeyIdNotificationResponse) ProtoReflect() protoreflect.Message { - mi := &file_kmsintercom_kmsintercom_proto_msgTypes[11] + mi := &file_kmsintercom_kmsintercom_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -698,7 +816,7 @@ func (x *KeyIdNotificationResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use KeyIdNotificationResponse.ProtoReflect.Descriptor instead. func (*KeyIdNotificationResponse) Descriptor() ([]byte, []int) { - return file_kmsintercom_kmsintercom_proto_rawDescGZIP(), []int{11} + return file_kmsintercom_kmsintercom_proto_rawDescGZIP(), []int{13} } func (x *KeyIdNotificationResponse) GetTimestamp() int64 { @@ -723,7 +841,7 @@ type KeyDeliveryRequest struct { func (x *KeyDeliveryRequest) Reset() { *x = KeyDeliveryRequest{} if protoimpl.UnsafeEnabled { - mi := &file_kmsintercom_kmsintercom_proto_msgTypes[12] + mi := &file_kmsintercom_kmsintercom_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -736,7 +854,7 @@ func (x *KeyDeliveryRequest) String() string { func (*KeyDeliveryRequest) ProtoMessage() {} func (x *KeyDeliveryRequest) ProtoReflect() protoreflect.Message { - mi := &file_kmsintercom_kmsintercom_proto_msgTypes[12] + mi := &file_kmsintercom_kmsintercom_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -749,7 +867,7 @@ func (x *KeyDeliveryRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use KeyDeliveryRequest.ProtoReflect.Descriptor instead. func (*KeyDeliveryRequest) Descriptor() ([]byte, []int) { - return file_kmsintercom_kmsintercom_proto_rawDescGZIP(), []int{12} + return file_kmsintercom_kmsintercom_proto_rawDescGZIP(), []int{14} } func (x *KeyDeliveryRequest) GetTimestamp() int64 { @@ -798,7 +916,7 @@ type KeyDeliveryResponse struct { func (x *KeyDeliveryResponse) Reset() { *x = KeyDeliveryResponse{} if protoimpl.UnsafeEnabled { - mi := &file_kmsintercom_kmsintercom_proto_msgTypes[13] + mi := &file_kmsintercom_kmsintercom_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -811,7 +929,7 @@ func (x *KeyDeliveryResponse) String() string { func (*KeyDeliveryResponse) ProtoMessage() {} func (x *KeyDeliveryResponse) ProtoReflect() protoreflect.Message { - mi := &file_kmsintercom_kmsintercom_proto_msgTypes[13] + mi := &file_kmsintercom_kmsintercom_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -824,7 +942,7 @@ func (x *KeyDeliveryResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use KeyDeliveryResponse.ProtoReflect.Descriptor instead. func (*KeyDeliveryResponse) Descriptor() ([]byte, []int) { - return file_kmsintercom_kmsintercom_proto_rawDescGZIP(), []int{13} + return file_kmsintercom_kmsintercom_proto_rawDescGZIP(), []int{15} } func (x *KeyDeliveryResponse) GetTimestamp() int64 { @@ -847,7 +965,7 @@ type Key struct { func (x *Key) Reset() { *x = Key{} if protoimpl.UnsafeEnabled { - mi := &file_kmsintercom_kmsintercom_proto_msgTypes[14] + mi := &file_kmsintercom_kmsintercom_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -860,7 +978,7 @@ func (x *Key) String() string { func (*Key) ProtoMessage() {} func (x *Key) ProtoReflect() protoreflect.Message { - mi := &file_kmsintercom_kmsintercom_proto_msgTypes[14] + mi := &file_kmsintercom_kmsintercom_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -873,7 +991,7 @@ func (x *Key) ProtoReflect() protoreflect.Message { // Deprecated: Use Key.ProtoReflect.Descriptor instead. func (*Key) Descriptor() ([]byte, []int) { - return file_kmsintercom_kmsintercom_proto_rawDescGZIP(), []int{14} + return file_kmsintercom_kmsintercom_proto_rawDescGZIP(), []int{16} } func (x *Key) GetId() string { @@ -961,6 +1079,18 @@ var file_kmsintercom_kmsintercom_proto_rawDesc = []byte{ 0x65, 0x79, 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, 0x83, 0x01, 0x0a, 0x17, 0x41, 0x63, + 0x6b, 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, 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, 0x70, + 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x49, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x4b, 0x65, 0x79, + 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x4b, 0x65, 0x79, 0x49, 0x64, 0x22, + 0x38, 0x0a, 0x18, 0x41, 0x63, 0x6b, 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, @@ -989,7 +1119,7 @@ var file_kmsintercom_kmsintercom_proto_rawDesc = []byte{ 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x32, 0xd6, 0x05, 0x0a, 0x09, 0x4b, 0x6d, 0x73, 0x54, 0x61, 0x6c, 0x6b, 0x65, + 0x6b, 0x65, 0x79, 0x32, 0xb9, 0x06, 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, @@ -1023,30 +1153,37 @@ var file_kmsintercom_kmsintercom_proto_rawDesc = []byte{ 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, + 0x22, 0x00, 0x12, 0x61, 0x0a, 0x10, 0x41, 0x63, 0x6b, 0x4b, 0x65, 0x79, 0x46, 0x6f, 0x72, 0x77, + 0x61, 0x72, 0x64, 0x69, 0x6e, 0x67, 0x12, 0x24, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, + 0x72, 0x63, 0x6f, 0x6d, 0x2e, 0x41, 0x63, 0x6b, 0x4b, 0x65, 0x79, 0x46, 0x6f, 0x72, 0x77, 0x61, + 0x72, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x6b, + 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x2e, 0x41, 0x63, 0x6b, 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 ( @@ -1061,7 +1198,7 @@ func file_kmsintercom_kmsintercom_proto_rawDescGZIP() []byte { return file_kmsintercom_kmsintercom_proto_rawDescData } -var file_kmsintercom_kmsintercom_proto_msgTypes = make([]protoimpl.MessageInfo, 15) +var file_kmsintercom_kmsintercom_proto_msgTypes = make([]protoimpl.MessageInfo, 17) var file_kmsintercom_kmsintercom_proto_goTypes = []interface{}{ (*InterComCapabilitiesRequest)(nil), // 0: kmsintercom.InterComCapabilitiesRequest (*InterComCapabilitiesReply)(nil), // 1: kmsintercom.InterComCapabilitiesReply @@ -1073,31 +1210,35 @@ var file_kmsintercom_kmsintercom_proto_goTypes = []interface{}{ (*InterComTransportKeyNegotiationResponse)(nil), // 7: kmsintercom.InterComTransportKeyNegotiationResponse (*KeyForwardingRequest)(nil), // 8: kmsintercom.KeyForwardingRequest (*KeyForwardingResponse)(nil), // 9: kmsintercom.KeyForwardingResponse - (*KeyIdNotificationRequest)(nil), // 10: kmsintercom.KeyIdNotificationRequest - (*KeyIdNotificationResponse)(nil), // 11: kmsintercom.KeyIdNotificationResponse - (*KeyDeliveryRequest)(nil), // 12: kmsintercom.KeyDeliveryRequest - (*KeyDeliveryResponse)(nil), // 13: kmsintercom.KeyDeliveryResponse - (*Key)(nil), // 14: kmsintercom.Key + (*AckKeyForwardingRequest)(nil), // 10: kmsintercom.AckKeyForwardingRequest + (*AckKeyForwardingResponse)(nil), // 11: kmsintercom.AckKeyForwardingResponse + (*KeyIdNotificationRequest)(nil), // 12: kmsintercom.KeyIdNotificationRequest + (*KeyIdNotificationResponse)(nil), // 13: kmsintercom.KeyIdNotificationResponse + (*KeyDeliveryRequest)(nil), // 14: kmsintercom.KeyDeliveryRequest + (*KeyDeliveryResponse)(nil), // 15: kmsintercom.KeyDeliveryResponse + (*Key)(nil), // 16: kmsintercom.Key } var file_kmsintercom_kmsintercom_proto_depIdxs = []int32{ - 14, // 0: kmsintercom.KeyForwardingRequest.key:type_name -> kmsintercom.Key - 14, // 1: kmsintercom.KeyDeliveryRequest.key:type_name -> kmsintercom.Key + 16, // 0: kmsintercom.KeyForwardingRequest.key:type_name -> kmsintercom.Key + 16, // 1: kmsintercom.KeyDeliveryRequest.key:type_name -> kmsintercom.Key 0, // 2: kmsintercom.KmsTalker.InterComCapabilities:input_type -> kmsintercom.InterComCapabilitiesRequest 2, // 3: kmsintercom.KmsTalker.SyncQkdBulk:input_type -> kmsintercom.SyncQkdBulkRequest 3, // 4: kmsintercom.KmsTalker.SyncKeyIdsForBulk:input_type -> kmsintercom.SyncKeyIdsForBulkRequest 6, // 5: kmsintercom.KmsTalker.InterComTransportKeyNegotiation:input_type -> kmsintercom.InterComTransportKeyNegotiationRequest 8, // 6: kmsintercom.KmsTalker.KeyForwarding:input_type -> kmsintercom.KeyForwardingRequest - 10, // 7: kmsintercom.KmsTalker.KeyIdNotification:input_type -> kmsintercom.KeyIdNotificationRequest - 12, // 8: kmsintercom.KmsTalker.KeyDelivery:input_type -> kmsintercom.KeyDeliveryRequest - 1, // 9: kmsintercom.KmsTalker.InterComCapabilities:output_type -> kmsintercom.InterComCapabilitiesReply - 5, // 10: kmsintercom.KmsTalker.SyncQkdBulk:output_type -> kmsintercom.SyncQkdBulkResponse - 4, // 11: kmsintercom.KmsTalker.SyncKeyIdsForBulk:output_type -> kmsintercom.SyncKeyIdsForBulkResponse - 7, // 12: kmsintercom.KmsTalker.InterComTransportKeyNegotiation:output_type -> kmsintercom.InterComTransportKeyNegotiationResponse - 9, // 13: kmsintercom.KmsTalker.KeyForwarding:output_type -> kmsintercom.KeyForwardingResponse - 11, // 14: kmsintercom.KmsTalker.KeyIdNotification:output_type -> kmsintercom.KeyIdNotificationResponse - 13, // 15: kmsintercom.KmsTalker.KeyDelivery:output_type -> kmsintercom.KeyDeliveryResponse - 9, // [9:16] is the sub-list for method output_type - 2, // [2:9] is the sub-list for method input_type + 10, // 7: kmsintercom.KmsTalker.AckKeyForwarding:input_type -> kmsintercom.AckKeyForwardingRequest + 12, // 8: kmsintercom.KmsTalker.KeyIdNotification:input_type -> kmsintercom.KeyIdNotificationRequest + 14, // 9: kmsintercom.KmsTalker.KeyDelivery:input_type -> kmsintercom.KeyDeliveryRequest + 1, // 10: kmsintercom.KmsTalker.InterComCapabilities:output_type -> kmsintercom.InterComCapabilitiesReply + 5, // 11: kmsintercom.KmsTalker.SyncQkdBulk:output_type -> kmsintercom.SyncQkdBulkResponse + 4, // 12: kmsintercom.KmsTalker.SyncKeyIdsForBulk:output_type -> kmsintercom.SyncKeyIdsForBulkResponse + 7, // 13: kmsintercom.KmsTalker.InterComTransportKeyNegotiation:output_type -> kmsintercom.InterComTransportKeyNegotiationResponse + 9, // 14: kmsintercom.KmsTalker.KeyForwarding:output_type -> kmsintercom.KeyForwardingResponse + 11, // 15: kmsintercom.KmsTalker.AckKeyForwarding:output_type -> kmsintercom.AckKeyForwardingResponse + 13, // 16: kmsintercom.KmsTalker.KeyIdNotification:output_type -> kmsintercom.KeyIdNotificationResponse + 15, // 17: kmsintercom.KmsTalker.KeyDelivery:output_type -> kmsintercom.KeyDeliveryResponse + 10, // [10:18] is the sub-list for method output_type + 2, // [2:10] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name 2, // [2:2] is the sub-list for extension extendee 0, // [0:2] is the sub-list for field type_name @@ -1230,7 +1371,7 @@ func file_kmsintercom_kmsintercom_proto_init() { } } file_kmsintercom_kmsintercom_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KeyIdNotificationRequest); i { + switch v := v.(*AckKeyForwardingRequest); i { case 0: return &v.state case 1: @@ -1242,7 +1383,7 @@ func file_kmsintercom_kmsintercom_proto_init() { } } file_kmsintercom_kmsintercom_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KeyIdNotificationResponse); i { + switch v := v.(*AckKeyForwardingResponse); i { case 0: return &v.state case 1: @@ -1254,7 +1395,7 @@ func file_kmsintercom_kmsintercom_proto_init() { } } file_kmsintercom_kmsintercom_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KeyDeliveryRequest); i { + switch v := v.(*KeyIdNotificationRequest); i { case 0: return &v.state case 1: @@ -1266,7 +1407,7 @@ func file_kmsintercom_kmsintercom_proto_init() { } } file_kmsintercom_kmsintercom_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*KeyDeliveryResponse); i { + switch v := v.(*KeyIdNotificationResponse); i { case 0: return &v.state case 1: @@ -1278,6 +1419,30 @@ func file_kmsintercom_kmsintercom_proto_init() { } } file_kmsintercom_kmsintercom_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KeyDeliveryRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_kmsintercom_kmsintercom_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KeyDeliveryResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_kmsintercom_kmsintercom_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Key); i { case 0: return &v.state @@ -1296,7 +1461,7 @@ func file_kmsintercom_kmsintercom_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_kmsintercom_kmsintercom_proto_rawDesc, NumEnums: 0, - NumMessages: 15, + NumMessages: 17, NumExtensions: 0, NumServices: 1, }, diff --git a/ekms/internal/api/gen/proto/go/kmsintercom/kmsintercom_grpc.pb.go b/ekms/internal/api/gen/proto/go/kmsintercom/kmsintercom_grpc.pb.go index f913de9ac26bfae9bc1d9977cd37ef367fa8ba1e..32a2d9c941b222de7152b493e8bce4efb44b21d3 100644 --- a/ekms/internal/api/gen/proto/go/kmsintercom/kmsintercom_grpc.pb.go +++ b/ekms/internal/api/gen/proto/go/kmsintercom/kmsintercom_grpc.pb.go @@ -24,6 +24,7 @@ const ( KmsTalker_SyncKeyIdsForBulk_FullMethodName = "/kmsintercom.KmsTalker/SyncKeyIdsForBulk" KmsTalker_InterComTransportKeyNegotiation_FullMethodName = "/kmsintercom.KmsTalker/InterComTransportKeyNegotiation" KmsTalker_KeyForwarding_FullMethodName = "/kmsintercom.KmsTalker/KeyForwarding" + KmsTalker_AckKeyForwarding_FullMethodName = "/kmsintercom.KmsTalker/AckKeyForwarding" KmsTalker_KeyIdNotification_FullMethodName = "/kmsintercom.KmsTalker/KeyIdNotification" KmsTalker_KeyDelivery_FullMethodName = "/kmsintercom.KmsTalker/KeyDelivery" ) @@ -37,6 +38,7 @@ type KmsTalkerClient interface { SyncKeyIdsForBulk(ctx context.Context, in *SyncKeyIdsForBulkRequest, opts ...grpc.CallOption) (*SyncKeyIdsForBulkResponse, error) InterComTransportKeyNegotiation(ctx context.Context, in *InterComTransportKeyNegotiationRequest, opts ...grpc.CallOption) (*InterComTransportKeyNegotiationResponse, error) KeyForwarding(ctx context.Context, in *KeyForwardingRequest, opts ...grpc.CallOption) (*KeyForwardingResponse, error) + AckKeyForwarding(ctx context.Context, in *AckKeyForwardingRequest, opts ...grpc.CallOption) (*AckKeyForwardingResponse, error) // KeyIDNotification is used for ETSI GS QKD 014 KeyIdNotification(ctx context.Context, in *KeyIdNotificationRequest, opts ...grpc.CallOption) (*KeyIdNotificationResponse, error) KeyDelivery(ctx context.Context, in *KeyDeliveryRequest, opts ...grpc.CallOption) (*KeyDeliveryResponse, error) @@ -95,6 +97,15 @@ func (c *kmsTalkerClient) KeyForwarding(ctx context.Context, in *KeyForwardingRe return out, nil } +func (c *kmsTalkerClient) AckKeyForwarding(ctx context.Context, in *AckKeyForwardingRequest, opts ...grpc.CallOption) (*AckKeyForwardingResponse, error) { + out := new(AckKeyForwardingResponse) + err := c.cc.Invoke(ctx, KmsTalker_AckKeyForwarding_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *kmsTalkerClient) KeyIdNotification(ctx context.Context, in *KeyIdNotificationRequest, opts ...grpc.CallOption) (*KeyIdNotificationResponse, error) { out := new(KeyIdNotificationResponse) err := c.cc.Invoke(ctx, KmsTalker_KeyIdNotification_FullMethodName, in, out, opts...) @@ -122,6 +133,7 @@ type KmsTalkerServer interface { SyncKeyIdsForBulk(context.Context, *SyncKeyIdsForBulkRequest) (*SyncKeyIdsForBulkResponse, error) InterComTransportKeyNegotiation(context.Context, *InterComTransportKeyNegotiationRequest) (*InterComTransportKeyNegotiationResponse, error) KeyForwarding(context.Context, *KeyForwardingRequest) (*KeyForwardingResponse, error) + AckKeyForwarding(context.Context, *AckKeyForwardingRequest) (*AckKeyForwardingResponse, error) // KeyIDNotification is used for ETSI GS QKD 014 KeyIdNotification(context.Context, *KeyIdNotificationRequest) (*KeyIdNotificationResponse, error) KeyDelivery(context.Context, *KeyDeliveryRequest) (*KeyDeliveryResponse, error) @@ -147,6 +159,9 @@ func (UnimplementedKmsTalkerServer) InterComTransportKeyNegotiation(context.Cont func (UnimplementedKmsTalkerServer) KeyForwarding(context.Context, *KeyForwardingRequest) (*KeyForwardingResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method KeyForwarding not implemented") } +func (UnimplementedKmsTalkerServer) AckKeyForwarding(context.Context, *AckKeyForwardingRequest) (*AckKeyForwardingResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AckKeyForwarding not implemented") +} func (UnimplementedKmsTalkerServer) KeyIdNotification(context.Context, *KeyIdNotificationRequest) (*KeyIdNotificationResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method KeyIdNotification not implemented") } @@ -256,6 +271,24 @@ func _KmsTalker_KeyForwarding_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _KmsTalker_AckKeyForwarding_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(AckKeyForwardingRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KmsTalkerServer).AckKeyForwarding(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: KmsTalker_AckKeyForwarding_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KmsTalkerServer).AckKeyForwarding(ctx, req.(*AckKeyForwardingRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _KmsTalker_KeyIdNotification_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(KeyIdNotificationRequest) if err := dec(in); err != nil { @@ -319,6 +352,10 @@ var KmsTalker_ServiceDesc = grpc.ServiceDesc{ MethodName: "KeyForwarding", Handler: _KmsTalker_KeyForwarding_Handler, }, + { + MethodName: "AckKeyForwarding", + Handler: _KmsTalker_AckKeyForwarding_Handler, + }, { MethodName: "KeyIdNotification", Handler: _KmsTalker_KeyIdNotification_Handler, diff --git a/ekms/internal/api/kmsintercom/kmsintercom/kmsintercom.proto b/ekms/internal/api/kmsintercom/kmsintercom/kmsintercom.proto index 5f1d78fa77a722c7c3ce3a66b8206d2bbcdcd604..8316bb561d082e96e612ef6dba0c27a4c8d09db4 100644 --- a/ekms/internal/api/kmsintercom/kmsintercom/kmsintercom.proto +++ b/ekms/internal/api/kmsintercom/kmsintercom/kmsintercom.proto @@ -9,6 +9,7 @@ service KmsTalker { rpc SyncKeyIdsForBulk(SyncKeyIdsForBulkRequest) returns (SyncKeyIdsForBulkResponse) {} rpc InterComTransportKeyNegotiation(InterComTransportKeyNegotiationRequest) returns (InterComTransportKeyNegotiationResponse) {} rpc KeyForwarding(KeyForwardingRequest) returns (KeyForwardingResponse) {} + rpc AckKeyForwarding(AckKeyForwardingRequest) returns (AckKeyForwardingResponse) {} // KeyIDNotification is used for ETSI GS QKD 014 rpc KeyIdNotification(KeyIdNotificationRequest) returns (KeyIdNotificationResponse) {} rpc KeyDelivery(KeyDeliveryRequest) returns (KeyDeliveryResponse) {} @@ -66,13 +67,23 @@ message KeyForwardingRequest { string pathId = 2; string processId = 3; Key key = 4; - //string payload = 3; } message KeyForwardingResponse { int64 timestamp = 1; } +message AckKeyForwardingRequest { + int64 timestamp = 1; + string pathId = 2; + string processId = 3; + string KeyId = 4; +} + +message AckKeyForwardingResponse { + int64 timestamp = 1; +} + message KeyIdNotificationRequest { int64 timestamp = 1; string kmsId = 2; diff --git a/ekms/internal/kms/kms.go b/ekms/internal/kms/kms.go index be0babf2c8823790405a1207636c6e0a9c9d8d48..600f7521ebff69d48150c465eb8c2ae7826a395e 100644 --- a/ekms/internal/kms/kms.go +++ b/ekms/internal/kms/kms.go @@ -283,34 +283,33 @@ func (kms *EKMS) AssignForwardingRoute(pId, pHop, nHop string, remoteKMS *Remote // generate process id processId := uuid.New() - err = tmpRoute.Next.SendInitialPayloadBasedOnGRPCClient(pk, tmpRoute.PathId, processId, kms.kmsUUID.String(), remoteKMS.Address) - if err != nil { - log.Error(err) - return err - } - // update PKStore kms.PKStoreMutex.Lock() keys, ok := kms.PKStore[tmpRoute.RemoteKMS.Id] if !ok { kms.PKStore[tmpRoute.RemoteKMS.Id] = map[uuid.UUID]*PlatformKey{ - pk.ID: { + pathId: { Id: pk.ID, Value: pk.Key, ProcessId: processId.String(), }, } } else { - keys[pk.ID] = &PlatformKey{ + keys[pathId] = &PlatformKey{ Id: pk.ID, Value: pk.Key, ProcessId: processId.String(), } } + log.Debug("Current PKSTORE: ", kms.PKStore) kms.PKStoreMutex.Unlock() - } - log.Debug("Current PKSTORE: ", kms.PKStore) + err = tmpRoute.Next.SendInitialPayloadBasedOnGRPCClient(pk, tmpRoute.PathId, processId, kms.kmsUUID.String(), remoteKMS.Address) + if err != nil { + log.Error(err) + return err + } + } return nil } diff --git a/ekms/internal/kms/kmsintercom.go b/ekms/internal/kms/kmsintercom.go index 1f56243c0eee518ab9706908ffedc4c9c3f36369..1cbbdbec79ff26757c541aaf49d2c5e46c5438c9 100644 --- a/ekms/internal/kms/kmsintercom.go +++ b/ekms/internal/kms/kmsintercom.go @@ -14,7 +14,10 @@ import ( pb "code.fbi.h-da.de/danet/quant/ekms/internal/api/gen/proto/go/kmsintercom" "code.fbi.h-da.de/danet/quant/ekms/internal/kms/crypto" "code.fbi.h-da.de/danet/quant/ekms/internal/kms/event" + "google.golang.org/grpc" "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/peer" "google.golang.org/grpc/status" ) @@ -261,33 +264,74 @@ func (s *kmsTalkerServer) KeyForwarding(ctx context.Context, in *pb.KeyForwardin keys, ok := s.eKMS.PKStore[route.RemoteKMS.Id] if !ok { s.eKMS.PKStore[route.RemoteKMS.Id] = map[uuid.UUID]*PlatformKey{ - pathId: { + keyID: { Id: keyID, Value: decryptedKey, ProcessId: in.GetProcessId(), }, } } else { - keys[pathId] = &PlatformKey{ + keys[keyID] = &PlatformKey{ Id: keyID, Value: decryptedKey, ProcessId: in.GetProcessId(), } } - // push to channel key received - if err := s.eKMS.Receiver.InformReceiver(pathId); err != nil { - log.Debugf("%s", err) - return nil, status.Errorf(codes.Internal, "%s", err) - } - log.Debug("Current PKSTORE: ", s.eKMS.PKStore) s.eKMS.PKStoreMutex.Unlock() + + var gRPCTransportCreds credentials.TransportCredentials + if s.eKMS.tlsData.TLS { + gRPCTransportCreds, err = generateGRPCClientTransportCredsWithTLS(s.eKMS.tlsData.CaFile, s.eKMS.tlsData.CertFile, s.eKMS.tlsData.KeyFile) + if err != nil { + log.Fatalf("unable to generate TLS creds: %v", err) + } + } else { + gRPCTransportCreds = insecure.NewCredentials() + } + + newPeerConn, err := grpc.Dial(route.RemoteKMS.Address, grpc.WithTransportCredentials(gRPCTransportCreds)) + if err != nil { + return nil, err + } + + // inform about successful key forwarding + client := pb.NewKmsTalkerClient(newPeerConn) + + _, err = client.AckKeyForwarding(ctx, &pb.AckKeyForwardingRequest{ + Timestamp: time.Now().Unix(), + PathId: in.PathId, + ProcessId: in.ProcessId, + KeyId: keyID.String(), + }) + if err != nil { + return nil, err + } } return &pb.KeyForwardingResponse{Timestamp: time.Now().Unix()}, nil } +func (s *kmsTalkerServer) AckKeyForwarding(ctx context.Context, in *pb.AckKeyForwardingRequest) (capReply *pb.AckKeyForwardingResponse, err error) { + pathId, err := uuid.Parse(in.GetPathId()) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "") + } + + // TODO: additional checks, like e.g.: + // - Did this kms initiate the key forwarding? + // - Are pathId and processId valid? + // - Is the keyId valid? + + err = s.eKMS.Receiver.InformReceiver(pathId) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "Failed while informing Receiver; err: %v", err) + } + + return &pb.AckKeyForwardingResponse{Timestamp: time.Now().Unix()}, nil +} + func (s *kmsTalkerServer) KeyDelivery(ctx context.Context, in *pb.KeyDeliveryRequest) (*pb.KeyDeliveryResponse, error) { // parse path id keyId, err := uuid.Parse(in.GetKeyId()) diff --git a/integration-tests/code/getKSAKeyTest/getKSA_key_test.go b/integration-tests/code/getKSAKeyTest/getKSA_key_test.go index c179683a8577cfa54fc19820467162a52f4b18f1..f042522a074f9fedeacf26582d626ba8be7a4a7e 100644 --- a/integration-tests/code/getKSAKeyTest/getKSA_key_test.go +++ b/integration-tests/code/getKSAKeyTest/getKSA_key_test.go @@ -13,6 +13,7 @@ import ( "time" integration_test_utils "code.fbi.h-da.de/danet/quant/integration-tests/code/integrationTestUtils" + "github.com/google/uuid" "github.com/stretchr/testify/assert" ) @@ -79,10 +80,12 @@ func TestGetKSAKey(t *testing.T) { //nolint:gocyclo logFileURL2 = logFileURL_ENV2 } + requestId := uuid.New().String() + url := fmt.Sprintf("http://%s/api/v1/keys/ksa_key_req", kms1AkmsURL) data := RequestData{ ReceivingCKMSID: "5e41c291-6121-4335-84f6-41e04b8bdaa2", - RequestID: "request_ID-1234", + RequestID: requestId, KeyProperties: KeyProperties{ Number: 1, KeyLength: 256, @@ -128,15 +131,15 @@ func TestGetKSAKey(t *testing.T) { //nolint:gocyclo JSON: fmt.Sprintf(`{"path-id": "%s"}`, output), }, { - Path: fmt.Sprint(path, "/prev-hop"), + Path: fmt.Sprint(path, "/next-hop"), JSON: fmt.Sprintf(`{"node-id": "%s"}`, "5e41c291-6121-4335-84f6-41e04b8bdaa2"), }, { - Path: fmt.Sprint(path, "/prev-hop"), + Path: fmt.Sprint(path, "/next-hop"), JSON: fmt.Sprintf(`{"hostname": "%s"}`, "kms_2"), }, { - Path: fmt.Sprint(path, "/prev-hop"), + Path: fmt.Sprint(path, "/next-hop"), JSON: fmt.Sprintf(`{"port": %d}`, 50910), }, { @@ -159,15 +162,15 @@ func TestGetKSAKey(t *testing.T) { //nolint:gocyclo JSON: fmt.Sprintf(`{"path-id": "%s"}`, output), }, { - Path: fmt.Sprint(path, "/next-hop"), + Path: fmt.Sprint(path, "/prev-hop"), JSON: fmt.Sprintf(`{"node-id": "%s"}`, "0ff33c82-7fe1-482b-a0ca-67565806ee4b"), }, { - Path: fmt.Sprint(path, "/next-hop"), + Path: fmt.Sprint(path, "/prev-hop"), JSON: fmt.Sprintf(`{"hostname": "%s"}`, "kms_1"), }, { - Path: fmt.Sprint(path, "/next-hop"), + Path: fmt.Sprint(path, "/prev-hop"), JSON: fmt.Sprintf(`{"port": %d}`, 50910), }, { @@ -194,12 +197,12 @@ func TestGetKSAKey(t *testing.T) { //nolint:gocyclo argsKMS2 = append(argsKMS2, "--update-path", update.Path, "--update-value", update.JSON) } - output, err = integration_test_utils.GnmicCommand(kms1URL, argsKMS1...) + output, err = integration_test_utils.GnmicCommand(kms2URL, argsKMS2...) if err != nil { t.Errorf("Error setting routing-session: %s; %s", err, output) } - output, err = integration_test_utils.GnmicCommand(kms2URL, argsKMS2...) + output, err = integration_test_utils.GnmicCommand(kms1URL, argsKMS1...) if err != nil { t.Errorf("Error setting routing-session: %s; %s", err, output) } @@ -227,7 +230,7 @@ func TestGetKSAKey(t *testing.T) { //nolint:gocyclo return } assert.NotNil(t, logFile.Source) - assert.Equal(t, "request_ID-1234", logFile.Body.RequestID) + assert.Equal(t, requestId, logFile.Body.RequestID) assert.NotNil(t, logFile.Body.ProcessID) assert.Equal(t, 1, len(logFile.Body.KSAKeys)) assert.NotNil(t, logFile.Body.KSAKeys[0].KeyID) @@ -253,7 +256,7 @@ func TestGetKSAKey(t *testing.T) { //nolint:gocyclo return } assert.NotNil(t, logFile2.Source) - assert.Equal(t, "request_ID-1234", logFile2.Body.RequestID) + assert.Equal(t, requestId, logFile2.Body.RequestID) assert.NotNil(t, logFile2.Body.ProcessID) assert.Equal(t, 1, len(logFile2.Body.KSAKeys)) assert.NotNil(t, logFile2.Body.KSAKeys[0].KeyID)