diff --git a/internal/README.md b/internal/README.md index a37c72472d3c450beeda8327c8c31dface106215..247549ac6f2c84df69958518ea276193cf2317a1 100644 --- a/internal/README.md +++ b/internal/README.md @@ -28,6 +28,28 @@ First, rand is used to generate the amount of random numbers `numRands`and then A quantum layer link peer is the communication partner on a point-to-point link. One has to generate a new peer in the quantum layer in order to communicate with the peer. +# Interfaces to the proto-kms + +## Interface to the Quantum Layer + +This interface is solely a go API within the proto-kms. + +## Inter-KMS Communication + +This interface is required for the communication between the peering KMS in order to coordinate their actions for key selection and key forwardwing path configuration. This is in *interkmsproto*. + +## ETSI-Interfaces + +There are basically two ETSI interfaces, i.e., + - ETSI QKD GS 14 for retrieval of keys by an external entity from the kms + - ETSI QKD GS 15 for the configuration of the key forwarding process and peers of the kms + + However, at this point of this, both interfaces are lumped together in one gRPC interface *kmsetsiproto*. + +### Encryption Key Retrieval Interface + +### SDN Controller (ETSI GS QKD 15) + diff --git a/internal/kms/grpcurl-sheet.md b/internal/kms/grpcurl-sheet.md new file mode 100644 index 0000000000000000000000000000000000000000..3b05e860c964906a21fd95bd374568d8aece9412 --- /dev/null +++ b/internal/kms/grpcurl-sheet.md @@ -0,0 +1,10 @@ +# Info for testing with grpcurl + +https://github.com/fullstorydev/grpcurl + +### + +'grpcurl -d '{"myKmsName" : "grpcurl"}' --import-path ./kmsetsiproto --proto kmsetsiproto.proto --plaintext localhost:50900 kmsetsiproto.KmsETSI.ETSICapabilities +{ "peerKmsName": "whatever"}' + +'grpcurl -d '{"kmsPeerSocket" : "127.0.0.1:59090"}' --import-path ./kmsetsiproto --proto kmsetsiproto.proto --plaintext localhost:50900 kmsetsiproto.KmsETSI.ETSIAddKMSPeer' \ No newline at end of file diff --git a/internal/kms/kms.go b/internal/kms/kms.go index 90d3f558bafc6e1eb57bbb2672c8aa6839805ea7..ff45825f1a88015686d384315fbf97391171a676 100644 --- a/internal/kms/kms.go +++ b/internal/kms/kms.go @@ -18,6 +18,8 @@ import ( type Qkdnkms interface { AddQuantumElement() *QuantumElement GlobalKeyHandler(time.Duration) error + AddPeer(kmsPeerSocket string) + RemovePeer(kmsPeerSocket string) } type qlElementId uint64 @@ -29,6 +31,7 @@ type eKMS struct { kmsUUID uuid.UUID qleMapMutex sync.Mutex QuantumElements map[qlElementId]*QuantumElement + KmsPeers map[string]*kmsPeer } // Will keep information about the quantum elements that this eKMS is talking to diff --git a/internal/kms/kmsetsi.go b/internal/kms/kmsetsi.go new file mode 100644 index 0000000000000000000000000000000000000000..ce121a29c30c5793afc62fa7fad23050932e12a8 --- /dev/null +++ b/internal/kms/kmsetsi.go @@ -0,0 +1,63 @@ +package kms + +import ( + "context" + "flag" + "fmt" + "log" + "net" + + pb "code.fbi.h-da.de/m.stiemerling/proto-kms/kmsetsiproto" + "google.golang.org/grpc" +) + +var ( + etsiPort = flag.Int("port", 50900, "The server port") +) + +type etsiServer struct { + pb.UnimplementedKmsETSIServer +} + +func (s *etsiServer) Capabilities(ctx context.Context, in *pb.CapabilitiesRequest) (capReply *pb.CapabilitiesReply, err error) { + log.Printf("Received: %v", in.GetMyKmsName()) + + return &pb.CapabilitiesReply{ + PeerKmsName: "whatever", + }, nil +} + +func (s *etsiServer) AddKMSPeer(ctx context.Context, in *pb.KMSPeerRequest) (*pb.KMSPeerReply, error) { + return nil, nil +} + +func (s *etsiServer) RemoveKMSPeer(ctx context.Context, in *pb.KMSPeerRequest) (*pb.KMSPeerReply, error) { + return nil, nil +} + +func (s *etsiServer) GetEncryptKeys256Bit(ctx context.Context, in *pb.GetEncryptKeys256BitRequest) (*pb.GetEncryptKeys256BitReply, error) { + log.Printf("Received request for n=%d keys", in.GetAmount()) + + testBytes := []byte{120, 120, 120} + + // Construct any response + return &pb.GetEncryptKeys256BitReply{ + KeyID: "2", + Key: testBytes, + }, nil +} + +func StartETSI() { + flag.Parse() + + lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *etsiPort)) + if err != nil { + log.Fatalf("failed to listen: %v", err) + } + s := grpc.NewServer() + pb.RegisterKmsETSIServer(s, &etsiServer{}) + log.Printf("server listening at %v", lis.Addr()) + if err := s.Serve(lis); err != nil { + log.Fatalf("failed to serve: %v", err) + } +} diff --git a/internal/kms/kmsintercom.go b/internal/kms/kmsintercom.go index 326ee5c8d6037daf855d547052e8e11fa69cb9ee..ca2ea00e18b2966fca8dbb8b6c1757060bfa27fd 100644 --- a/internal/kms/kmsintercom.go +++ b/internal/kms/kmsintercom.go @@ -11,10 +11,6 @@ import ( "google.golang.org/grpc" ) -var ( - port = flag.Int("port", 50900, "The server port") -) - type intercomServer struct { pb.UnimplementedKmsTalkerServer } @@ -27,22 +23,10 @@ func (s *intercomServer) Capabilities(ctx context.Context, in *pb.CapabilitiesRe }, nil } -func (s *intercomServer) GetEncryptKeys256Bit(ctx context.Context, in *pb.GetEncryptKeys256BitRequest) (*pb.GetEncryptKeys256BitReply, error) { - log.Printf("Received request for n=%d keys", in.GetAmount()) - - testBytes := []byte{120, 120, 120} - - // Construct any response - return &pb.GetEncryptKeys256BitReply{ - KeyID: "2", - Key: testBytes, - }, nil -} - -func StartInterComm() { +func StartInterComm(interComPort int) { flag.Parse() - lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *port)) + lis, err := net.Listen("tcp", fmt.Sprintf(":%d", interComPort)) if err != nil { log.Fatalf("failed to listen: %v", err) } diff --git a/internal/kms/kmspeers.go b/internal/kms/kmspeers.go new file mode 100644 index 0000000000000000000000000000000000000000..d14f031e733b3e1f46c65f6a4f594feb7bf4d92a --- /dev/null +++ b/internal/kms/kmspeers.go @@ -0,0 +1,61 @@ +package kms + +import ( + "context" + "log" + "net" + "time" + + pb "code.fbi.h-da.de/m.stiemerling/proto-kms/kmsetsiproto" + "github.com/google/uuid" + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" +) + +type kmsPeerInfo interface { +} + +type kmsPeer struct { + tcpSocket net.TCPAddr // the IP address and TCP port (aka socket) of the kms peer + tcpSocketStr string // string rep. of tcpSocket + name string // the name of the kms peer + id uuid.UUID // uuid of the peer +} + +func NewKmsPeer() (peer *kmsPeer) { + return &kmsPeer{} +} + +// TODO/XXX error handling +func (kms *eKMS) AddPeer(kmsPeerSocket string) { + //check if peer exists + if _, there := kms.KmsPeers[kmsPeerSocket]; there { + log.Fatalf("Trying to add existing peer %s", kmsPeerSocket) + } + peer := NewKmsPeer() + peer.tcpSocketStr = kmsPeerSocket + + // contact peer + newPeerConn, err := grpc.Dial(kmsPeerSocket, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + log.Fatalf("did not connect: %v", err) + } + defer newPeerConn.Close() + + c := pb.NewKmsETSIClient(newPeerConn) + + // Contact the server and print out its response. + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + r, err := c.Capabilities(ctx, &pb.CapabilitiesRequest{MyKmsName: kms.kmsName}) + if err != nil { + log.Fatalf("could not greet: %v", err) + } + log.Printf("Greeting: %s", r.GetPeerKmsName()) + +} + +// TODO/XXX error handling +func (kms *eKMS) RemovePeer(kmsPeerSocket string) { + +} diff --git a/internal/kmsetsiproto/kmsetsiproto.go b/internal/kmsetsiproto/kmsetsiproto.go new file mode 100644 index 0000000000000000000000000000000000000000..dfa3e2b2680d117a51734e64f4f57af38f854f95 --- /dev/null +++ b/internal/kmsetsiproto/kmsetsiproto.go @@ -0,0 +1 @@ +package kmsetsiproto diff --git a/internal/kmsetsiproto/kmsetsiproto.pb.go b/internal/kmsetsiproto/kmsetsiproto.pb.go new file mode 100644 index 0000000000000000000000000000000000000000..f91f574b1fef951b7675f6014fa1277119158db1 --- /dev/null +++ b/internal/kmsetsiproto/kmsetsiproto.pb.go @@ -0,0 +1,504 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.28.1 +// protoc v3.19.4 +// source: kmsetsiproto.proto + +package kmsetsiproto + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +// The request message containing the user's name. +type CapabilitiesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + MyKmsName string `protobuf:"bytes,1,opt,name=myKmsName,proto3" json:"myKmsName,omitempty"` +} + +func (x *CapabilitiesRequest) Reset() { + *x = CapabilitiesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_kmsetsiproto_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CapabilitiesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CapabilitiesRequest) ProtoMessage() {} + +func (x *CapabilitiesRequest) ProtoReflect() protoreflect.Message { + mi := &file_kmsetsiproto_proto_msgTypes[0] + 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 CapabilitiesRequest.ProtoReflect.Descriptor instead. +func (*CapabilitiesRequest) Descriptor() ([]byte, []int) { + return file_kmsetsiproto_proto_rawDescGZIP(), []int{0} +} + +func (x *CapabilitiesRequest) GetMyKmsName() string { + if x != nil { + return x.MyKmsName + } + return "" +} + +// The response message containing the greetings +type CapabilitiesReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PeerKmsName string `protobuf:"bytes,1,opt,name=peerKmsName,proto3" json:"peerKmsName,omitempty"` +} + +func (x *CapabilitiesReply) Reset() { + *x = CapabilitiesReply{} + if protoimpl.UnsafeEnabled { + mi := &file_kmsetsiproto_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CapabilitiesReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CapabilitiesReply) ProtoMessage() {} + +func (x *CapabilitiesReply) ProtoReflect() protoreflect.Message { + mi := &file_kmsetsiproto_proto_msgTypes[1] + 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 CapabilitiesReply.ProtoReflect.Descriptor instead. +func (*CapabilitiesReply) Descriptor() ([]byte, []int) { + return file_kmsetsiproto_proto_rawDescGZIP(), []int{1} +} + +func (x *CapabilitiesReply) GetPeerKmsName() string { + if x != nil { + return x.PeerKmsName + } + return "" +} + +type KMSPeerRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + KmsPeerSocket string `protobuf:"bytes,1,opt,name=kmsPeerSocket,proto3" json:"kmsPeerSocket,omitempty"` +} + +func (x *KMSPeerRequest) Reset() { + *x = KMSPeerRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_kmsetsiproto_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KMSPeerRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KMSPeerRequest) ProtoMessage() {} + +func (x *KMSPeerRequest) ProtoReflect() protoreflect.Message { + mi := &file_kmsetsiproto_proto_msgTypes[2] + 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 KMSPeerRequest.ProtoReflect.Descriptor instead. +func (*KMSPeerRequest) Descriptor() ([]byte, []int) { + return file_kmsetsiproto_proto_rawDescGZIP(), []int{2} +} + +func (x *KMSPeerRequest) GetKmsPeerSocket() string { + if x != nil { + return x.KmsPeerSocket + } + return "" +} + +type KMSPeerReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + KmsPeerName string `protobuf:"bytes,1,opt,name=kmsPeerName,proto3" json:"kmsPeerName,omitempty"` +} + +func (x *KMSPeerReply) Reset() { + *x = KMSPeerReply{} + if protoimpl.UnsafeEnabled { + mi := &file_kmsetsiproto_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *KMSPeerReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*KMSPeerReply) ProtoMessage() {} + +func (x *KMSPeerReply) ProtoReflect() protoreflect.Message { + mi := &file_kmsetsiproto_proto_msgTypes[3] + 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 KMSPeerReply.ProtoReflect.Descriptor instead. +func (*KMSPeerReply) Descriptor() ([]byte, []int) { + return file_kmsetsiproto_proto_rawDescGZIP(), []int{3} +} + +func (x *KMSPeerReply) GetKmsPeerName() string { + if x != nil { + return x.KmsPeerName + } + return "" +} + +type GetEncryptKeys256BitRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Amount int64 `protobuf:"varint,1,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (x *GetEncryptKeys256BitRequest) Reset() { + *x = GetEncryptKeys256BitRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_kmsetsiproto_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetEncryptKeys256BitRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetEncryptKeys256BitRequest) ProtoMessage() {} + +func (x *GetEncryptKeys256BitRequest) ProtoReflect() protoreflect.Message { + mi := &file_kmsetsiproto_proto_msgTypes[4] + 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 GetEncryptKeys256BitRequest.ProtoReflect.Descriptor instead. +func (*GetEncryptKeys256BitRequest) Descriptor() ([]byte, []int) { + return file_kmsetsiproto_proto_rawDescGZIP(), []int{4} +} + +func (x *GetEncryptKeys256BitRequest) GetAmount() int64 { + if x != nil { + return x.Amount + } + return 0 +} + +type GetEncryptKeys256BitReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + KeyID string `protobuf:"bytes,1,opt,name=keyID,proto3" json:"keyID,omitempty"` + Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` +} + +func (x *GetEncryptKeys256BitReply) Reset() { + *x = GetEncryptKeys256BitReply{} + if protoimpl.UnsafeEnabled { + mi := &file_kmsetsiproto_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetEncryptKeys256BitReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetEncryptKeys256BitReply) ProtoMessage() {} + +func (x *GetEncryptKeys256BitReply) ProtoReflect() protoreflect.Message { + mi := &file_kmsetsiproto_proto_msgTypes[5] + 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 GetEncryptKeys256BitReply.ProtoReflect.Descriptor instead. +func (*GetEncryptKeys256BitReply) Descriptor() ([]byte, []int) { + return file_kmsetsiproto_proto_rawDescGZIP(), []int{5} +} + +func (x *GetEncryptKeys256BitReply) GetKeyID() string { + if x != nil { + return x.KeyID + } + return "" +} + +func (x *GetEncryptKeys256BitReply) GetKey() []byte { + if x != nil { + return x.Key + } + return nil +} + +var File_kmsetsiproto_proto protoreflect.FileDescriptor + +var file_kmsetsiproto_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x6b, 0x6d, 0x73, 0x65, 0x74, 0x73, 0x69, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x6b, 0x6d, 0x73, 0x65, 0x74, 0x73, 0x69, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0x33, 0x0a, 0x13, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, + 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x79, 0x4b, + 0x6d, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x79, + 0x4b, 0x6d, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x35, 0x0a, 0x11, 0x43, 0x61, 0x70, 0x61, 0x62, + 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x20, 0x0a, 0x0b, + 0x70, 0x65, 0x65, 0x72, 0x4b, 0x6d, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x70, 0x65, 0x65, 0x72, 0x4b, 0x6d, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x36, + 0x0a, 0x0e, 0x4b, 0x4d, 0x53, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x24, 0x0a, 0x0d, 0x6b, 0x6d, 0x73, 0x50, 0x65, 0x65, 0x72, 0x53, 0x6f, 0x63, 0x6b, 0x65, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6b, 0x6d, 0x73, 0x50, 0x65, 0x65, 0x72, + 0x53, 0x6f, 0x63, 0x6b, 0x65, 0x74, 0x22, 0x30, 0x0a, 0x0c, 0x4b, 0x4d, 0x53, 0x50, 0x65, 0x65, + 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x6b, 0x6d, 0x73, 0x50, 0x65, 0x65, + 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x6b, 0x6d, 0x73, + 0x50, 0x65, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x35, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x45, + 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x32, 0x35, 0x36, 0x42, 0x69, 0x74, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, + 0x43, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x4b, 0x65, 0x79, + 0x73, 0x32, 0x35, 0x36, 0x42, 0x69, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x6b, 0x65, 0x79, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, 0x65, 0x79, + 0x49, 0x44, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, + 0x03, 0x6b, 0x65, 0x79, 0x32, 0xe4, 0x02, 0x0a, 0x07, 0x4b, 0x6d, 0x73, 0x45, 0x54, 0x53, 0x49, + 0x12, 0x54, 0x0a, 0x0c, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, + 0x12, 0x21, 0x2e, 0x6b, 0x6d, 0x73, 0x65, 0x74, 0x73, 0x69, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6b, 0x6d, 0x73, 0x65, 0x74, 0x73, 0x69, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2e, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x48, 0x0a, 0x0a, 0x41, 0x64, 0x64, 0x4b, 0x4d, 0x53, + 0x50, 0x65, 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x6b, 0x6d, 0x73, 0x65, 0x74, 0x73, 0x69, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x4d, 0x53, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x6b, 0x6d, 0x73, 0x65, 0x74, 0x73, 0x69, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x2e, 0x4b, 0x4d, 0x53, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, + 0x12, 0x4b, 0x0a, 0x0d, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4b, 0x4d, 0x53, 0x50, 0x65, 0x65, + 0x72, 0x12, 0x1c, 0x2e, 0x6b, 0x6d, 0x73, 0x65, 0x74, 0x73, 0x69, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x4b, 0x4d, 0x53, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1a, 0x2e, 0x6b, 0x6d, 0x73, 0x65, 0x74, 0x73, 0x69, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, + 0x4d, 0x53, 0x50, 0x65, 0x65, 0x72, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x6c, 0x0a, + 0x14, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x32, + 0x35, 0x36, 0x42, 0x69, 0x74, 0x12, 0x29, 0x2e, 0x6b, 0x6d, 0x73, 0x65, 0x74, 0x73, 0x69, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x4b, + 0x65, 0x79, 0x73, 0x32, 0x35, 0x36, 0x42, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x27, 0x2e, 0x6b, 0x6d, 0x73, 0x65, 0x74, 0x73, 0x69, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, + 0x47, 0x65, 0x74, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x32, 0x35, + 0x36, 0x42, 0x69, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x37, 0x5a, 0x35, 0x63, + 0x6f, 0x64, 0x65, 0x2e, 0x66, 0x62, 0x69, 0x2e, 0x68, 0x2d, 0x64, 0x61, 0x2e, 0x64, 0x65, 0x2f, + 0x6d, 0x2e, 0x73, 0x74, 0x69, 0x65, 0x6d, 0x65, 0x72, 0x6c, 0x69, 0x6e, 0x67, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2d, 0x6b, 0x6d, 0x73, 0x2f, 0x6b, 0x6d, 0x73, 0x65, 0x74, 0x73, 0x69, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_kmsetsiproto_proto_rawDescOnce sync.Once + file_kmsetsiproto_proto_rawDescData = file_kmsetsiproto_proto_rawDesc +) + +func file_kmsetsiproto_proto_rawDescGZIP() []byte { + file_kmsetsiproto_proto_rawDescOnce.Do(func() { + file_kmsetsiproto_proto_rawDescData = protoimpl.X.CompressGZIP(file_kmsetsiproto_proto_rawDescData) + }) + return file_kmsetsiproto_proto_rawDescData +} + +var file_kmsetsiproto_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_kmsetsiproto_proto_goTypes = []interface{}{ + (*CapabilitiesRequest)(nil), // 0: kmsetsiproto.CapabilitiesRequest + (*CapabilitiesReply)(nil), // 1: kmsetsiproto.CapabilitiesReply + (*KMSPeerRequest)(nil), // 2: kmsetsiproto.KMSPeerRequest + (*KMSPeerReply)(nil), // 3: kmsetsiproto.KMSPeerReply + (*GetEncryptKeys256BitRequest)(nil), // 4: kmsetsiproto.GetEncryptKeys256BitRequest + (*GetEncryptKeys256BitReply)(nil), // 5: kmsetsiproto.GetEncryptKeys256BitReply +} +var file_kmsetsiproto_proto_depIdxs = []int32{ + 0, // 0: kmsetsiproto.KmsETSI.Capabilities:input_type -> kmsetsiproto.CapabilitiesRequest + 2, // 1: kmsetsiproto.KmsETSI.AddKMSPeer:input_type -> kmsetsiproto.KMSPeerRequest + 2, // 2: kmsetsiproto.KmsETSI.RemoveKMSPeer:input_type -> kmsetsiproto.KMSPeerRequest + 4, // 3: kmsetsiproto.KmsETSI.GetEncryptKeys256Bit:input_type -> kmsetsiproto.GetEncryptKeys256BitRequest + 1, // 4: kmsetsiproto.KmsETSI.Capabilities:output_type -> kmsetsiproto.CapabilitiesReply + 3, // 5: kmsetsiproto.KmsETSI.AddKMSPeer:output_type -> kmsetsiproto.KMSPeerReply + 3, // 6: kmsetsiproto.KmsETSI.RemoveKMSPeer:output_type -> kmsetsiproto.KMSPeerReply + 5, // 7: kmsetsiproto.KmsETSI.GetEncryptKeys256Bit:output_type -> kmsetsiproto.GetEncryptKeys256BitReply + 4, // [4:8] is the sub-list for method output_type + 0, // [0:4] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_kmsetsiproto_proto_init() } +func file_kmsetsiproto_proto_init() { + if File_kmsetsiproto_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_kmsetsiproto_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CapabilitiesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_kmsetsiproto_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CapabilitiesReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_kmsetsiproto_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KMSPeerRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_kmsetsiproto_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*KMSPeerReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_kmsetsiproto_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetEncryptKeys256BitRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_kmsetsiproto_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetEncryptKeys256BitReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_kmsetsiproto_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_kmsetsiproto_proto_goTypes, + DependencyIndexes: file_kmsetsiproto_proto_depIdxs, + MessageInfos: file_kmsetsiproto_proto_msgTypes, + }.Build() + File_kmsetsiproto_proto = out.File + file_kmsetsiproto_proto_rawDesc = nil + file_kmsetsiproto_proto_goTypes = nil + file_kmsetsiproto_proto_depIdxs = nil +} diff --git a/internal/kmsetsiproto/kmsetsiproto.proto b/internal/kmsetsiproto/kmsetsiproto.proto new file mode 100644 index 0000000000000000000000000000000000000000..c129e5956d7fa93ce4ba0c5328bc161a0c9eddbc --- /dev/null +++ b/internal/kmsetsiproto/kmsetsiproto.proto @@ -0,0 +1,52 @@ +syntax = "proto3"; + +option go_package = "code.fbi.h-da.de/m.stiemerling/proto-kms/kmsetsiproto"; + +package kmsetsiproto; + +service KmsETSI { + // Sends a greeting + rpc Capabilities (CapabilitiesRequest) returns (CapabilitiesReply) {} + rpc AddKMSPeer(KMSPeerRequest) returns (KMSPeerReply) {} + rpc RemoveKMSPeer(KMSPeerRequest) returns (KMSPeerReply) {} + rpc GetEncryptKeys256Bit (GetEncryptKeys256BitRequest) returns (GetEncryptKeys256BitReply) {} + } + + // The request message containing the user's name. +message CapabilitiesRequest { + string myKmsName = 1; + } + + // The response message containing the greetings + message CapabilitiesReply { + string peerKmsName= 1; + } + +message KMSPeerRequest { + string kmsPeerSocket = 1; +} + +message KMSPeerReply { + string kmsPeerName = 1; +} + + +message GetEncryptKeys256BitRequest { + int64 amount = 1; +} + + +/* out kms-keystore.go + * type kmsKSElement struct { + * keyID string + * key []byte // a 256 bit key + * } + */ + +message GetEncryptKeys256BitReply { + string keyID = 1; + bytes key = 2; +} + + + diff --git a/internal/kmsetsiproto/kmsetsiproto_grpc.pb.go b/internal/kmsetsiproto/kmsetsiproto_grpc.pb.go new file mode 100644 index 0000000000000000000000000000000000000000..d4e0fb12530c1bc9004def37b9217d2507f91f49 --- /dev/null +++ b/internal/kmsetsiproto/kmsetsiproto_grpc.pb.go @@ -0,0 +1,215 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.19.4 +// source: kmsetsiproto.proto + +package kmsetsiproto + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// KmsETSIClient is the client API for KmsETSI service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type KmsETSIClient interface { + // Sends a greeting + Capabilities(ctx context.Context, in *CapabilitiesRequest, opts ...grpc.CallOption) (*CapabilitiesReply, error) + AddKMSPeer(ctx context.Context, in *KMSPeerRequest, opts ...grpc.CallOption) (*KMSPeerReply, error) + RemoveKMSPeer(ctx context.Context, in *KMSPeerRequest, opts ...grpc.CallOption) (*KMSPeerReply, error) + GetEncryptKeys256Bit(ctx context.Context, in *GetEncryptKeys256BitRequest, opts ...grpc.CallOption) (*GetEncryptKeys256BitReply, error) +} + +type kmsETSIClient struct { + cc grpc.ClientConnInterface +} + +func NewKmsETSIClient(cc grpc.ClientConnInterface) KmsETSIClient { + return &kmsETSIClient{cc} +} + +func (c *kmsETSIClient) Capabilities(ctx context.Context, in *CapabilitiesRequest, opts ...grpc.CallOption) (*CapabilitiesReply, error) { + out := new(CapabilitiesReply) + err := c.cc.Invoke(ctx, "/kmsetsiproto.KmsETSI/Capabilities", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *kmsETSIClient) AddKMSPeer(ctx context.Context, in *KMSPeerRequest, opts ...grpc.CallOption) (*KMSPeerReply, error) { + out := new(KMSPeerReply) + err := c.cc.Invoke(ctx, "/kmsetsiproto.KmsETSI/AddKMSPeer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *kmsETSIClient) RemoveKMSPeer(ctx context.Context, in *KMSPeerRequest, opts ...grpc.CallOption) (*KMSPeerReply, error) { + out := new(KMSPeerReply) + err := c.cc.Invoke(ctx, "/kmsetsiproto.KmsETSI/RemoveKMSPeer", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *kmsETSIClient) GetEncryptKeys256Bit(ctx context.Context, in *GetEncryptKeys256BitRequest, opts ...grpc.CallOption) (*GetEncryptKeys256BitReply, error) { + out := new(GetEncryptKeys256BitReply) + err := c.cc.Invoke(ctx, "/kmsetsiproto.KmsETSI/GetEncryptKeys256Bit", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// KmsETSIServer is the server API for KmsETSI service. +// All implementations must embed UnimplementedKmsETSIServer +// for forward compatibility +type KmsETSIServer interface { + // Sends a greeting + Capabilities(context.Context, *CapabilitiesRequest) (*CapabilitiesReply, error) + AddKMSPeer(context.Context, *KMSPeerRequest) (*KMSPeerReply, error) + RemoveKMSPeer(context.Context, *KMSPeerRequest) (*KMSPeerReply, error) + GetEncryptKeys256Bit(context.Context, *GetEncryptKeys256BitRequest) (*GetEncryptKeys256BitReply, error) + mustEmbedUnimplementedKmsETSIServer() +} + +// UnimplementedKmsETSIServer must be embedded to have forward compatible implementations. +type UnimplementedKmsETSIServer struct { +} + +func (UnimplementedKmsETSIServer) Capabilities(context.Context, *CapabilitiesRequest) (*CapabilitiesReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method Capabilities not implemented") +} +func (UnimplementedKmsETSIServer) AddKMSPeer(context.Context, *KMSPeerRequest) (*KMSPeerReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddKMSPeer not implemented") +} +func (UnimplementedKmsETSIServer) RemoveKMSPeer(context.Context, *KMSPeerRequest) (*KMSPeerReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveKMSPeer not implemented") +} +func (UnimplementedKmsETSIServer) GetEncryptKeys256Bit(context.Context, *GetEncryptKeys256BitRequest) (*GetEncryptKeys256BitReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetEncryptKeys256Bit not implemented") +} +func (UnimplementedKmsETSIServer) mustEmbedUnimplementedKmsETSIServer() {} + +// UnsafeKmsETSIServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to KmsETSIServer will +// result in compilation errors. +type UnsafeKmsETSIServer interface { + mustEmbedUnimplementedKmsETSIServer() +} + +func RegisterKmsETSIServer(s grpc.ServiceRegistrar, srv KmsETSIServer) { + s.RegisterService(&KmsETSI_ServiceDesc, srv) +} + +func _KmsETSI_Capabilities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CapabilitiesRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KmsETSIServer).Capabilities(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kmsetsiproto.KmsETSI/Capabilities", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KmsETSIServer).Capabilities(ctx, req.(*CapabilitiesRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _KmsETSI_AddKMSPeer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KMSPeerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KmsETSIServer).AddKMSPeer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kmsetsiproto.KmsETSI/AddKMSPeer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KmsETSIServer).AddKMSPeer(ctx, req.(*KMSPeerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _KmsETSI_RemoveKMSPeer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KMSPeerRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KmsETSIServer).RemoveKMSPeer(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kmsetsiproto.KmsETSI/RemoveKMSPeer", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KmsETSIServer).RemoveKMSPeer(ctx, req.(*KMSPeerRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _KmsETSI_GetEncryptKeys256Bit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetEncryptKeys256BitRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(KmsETSIServer).GetEncryptKeys256Bit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kmsetsiproto.KmsETSI/GetEncryptKeys256Bit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(KmsETSIServer).GetEncryptKeys256Bit(ctx, req.(*GetEncryptKeys256BitRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// KmsETSI_ServiceDesc is the grpc.ServiceDesc for KmsETSI service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var KmsETSI_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "kmsetsiproto.KmsETSI", + HandlerType: (*KmsETSIServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Capabilities", + Handler: _KmsETSI_Capabilities_Handler, + }, + { + MethodName: "AddKMSPeer", + Handler: _KmsETSI_AddKMSPeer_Handler, + }, + { + MethodName: "RemoveKMSPeer", + Handler: _KmsETSI_RemoveKMSPeer_Handler, + }, + { + MethodName: "GetEncryptKeys256Bit", + Handler: _KmsETSI_GetEncryptKeys256Bit_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "kmsetsiproto.proto", +} diff --git a/internal/kmsintercomproto/kmsintercom.pb.go b/internal/kmsintercomproto/kmsintercom.pb.go index c0d596e187ead505b1d1da8125894c631bfa2808..968e7263bbe8c001cf47d4caf65affcf3df18625 100644 --- a/internal/kmsintercomproto/kmsintercom.pb.go +++ b/internal/kmsintercomproto/kmsintercom.pb.go @@ -20,7 +20,8 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// The request message containing the user's name. +// Capabilities +// The request message containing the requesting kms' name. type CapabilitiesRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -68,7 +69,7 @@ func (x *CapabilitiesRequest) GetMyKmsName() string { return "" } -// The response message containing the greetings +// The response message containing the replying kms' name. type CapabilitiesReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -116,16 +117,18 @@ func (x *CapabilitiesReply) GetPeerKmsName() string { return "" } -type GetEncryptKeys256BitRequest struct { +// KeyTransportSessionHandling +// The request message containing the requesting kms' name. +type KeyTransportSessionHandlingRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Amount int64 `protobuf:"varint,1,opt,name=amount,proto3" json:"amount,omitempty"` + MyKmsName string `protobuf:"bytes,1,opt,name=myKmsName,proto3" json:"myKmsName,omitempty"` } -func (x *GetEncryptKeys256BitRequest) Reset() { - *x = GetEncryptKeys256BitRequest{} +func (x *KeyTransportSessionHandlingRequest) Reset() { + *x = KeyTransportSessionHandlingRequest{} if protoimpl.UnsafeEnabled { mi := &file_kmsintercom_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -133,13 +136,13 @@ func (x *GetEncryptKeys256BitRequest) Reset() { } } -func (x *GetEncryptKeys256BitRequest) String() string { +func (x *KeyTransportSessionHandlingRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetEncryptKeys256BitRequest) ProtoMessage() {} +func (*KeyTransportSessionHandlingRequest) ProtoMessage() {} -func (x *GetEncryptKeys256BitRequest) ProtoReflect() protoreflect.Message { +func (x *KeyTransportSessionHandlingRequest) ProtoReflect() protoreflect.Message { mi := &file_kmsintercom_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -151,29 +154,29 @@ func (x *GetEncryptKeys256BitRequest) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetEncryptKeys256BitRequest.ProtoReflect.Descriptor instead. -func (*GetEncryptKeys256BitRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use KeyTransportSessionHandlingRequest.ProtoReflect.Descriptor instead. +func (*KeyTransportSessionHandlingRequest) Descriptor() ([]byte, []int) { return file_kmsintercom_proto_rawDescGZIP(), []int{2} } -func (x *GetEncryptKeys256BitRequest) GetAmount() int64 { +func (x *KeyTransportSessionHandlingRequest) GetMyKmsName() string { if x != nil { - return x.Amount + return x.MyKmsName } - return 0 + return "" } -type GetEncryptKeys256BitReply struct { +// The response message containing the replying kms' name. +type KeyTransportSessionHandlingReply struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - KeyID string `protobuf:"bytes,1,opt,name=keyID,proto3" json:"keyID,omitempty"` - Key []byte `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + PeerKmsName string `protobuf:"bytes,1,opt,name=peerKmsName,proto3" json:"peerKmsName,omitempty"` } -func (x *GetEncryptKeys256BitReply) Reset() { - *x = GetEncryptKeys256BitReply{} +func (x *KeyTransportSessionHandlingReply) Reset() { + *x = KeyTransportSessionHandlingReply{} if protoimpl.UnsafeEnabled { mi := &file_kmsintercom_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -181,13 +184,13 @@ func (x *GetEncryptKeys256BitReply) Reset() { } } -func (x *GetEncryptKeys256BitReply) String() string { +func (x *KeyTransportSessionHandlingReply) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetEncryptKeys256BitReply) ProtoMessage() {} +func (*KeyTransportSessionHandlingReply) ProtoMessage() {} -func (x *GetEncryptKeys256BitReply) ProtoReflect() protoreflect.Message { +func (x *KeyTransportSessionHandlingReply) ProtoReflect() protoreflect.Message { mi := &file_kmsintercom_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -199,25 +202,18 @@ func (x *GetEncryptKeys256BitReply) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -// Deprecated: Use GetEncryptKeys256BitReply.ProtoReflect.Descriptor instead. -func (*GetEncryptKeys256BitReply) Descriptor() ([]byte, []int) { +// Deprecated: Use KeyTransportSessionHandlingReply.ProtoReflect.Descriptor instead. +func (*KeyTransportSessionHandlingReply) Descriptor() ([]byte, []int) { return file_kmsintercom_proto_rawDescGZIP(), []int{3} } -func (x *GetEncryptKeys256BitReply) GetKeyID() string { +func (x *KeyTransportSessionHandlingReply) GetPeerKmsName() string { if x != nil { - return x.KeyID + return x.PeerKmsName } return "" } -func (x *GetEncryptKeys256BitReply) GetKey() []byte { - if x != nil { - return x.Key - } - return nil -} - var File_kmsintercom_proto protoreflect.FileDescriptor var file_kmsintercom_proto_rawDesc = []byte{ @@ -230,33 +226,35 @@ var file_kmsintercom_proto_rawDesc = []byte{ 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x65, 0x65, 0x72, 0x4b, 0x6d, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x65, 0x65, 0x72, 0x4b, 0x6d, 0x73, 0x4e, 0x61, 0x6d, - 0x65, 0x22, 0x35, 0x0a, 0x1b, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x4b, - 0x65, 0x79, 0x73, 0x32, 0x35, 0x36, 0x42, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x43, 0x0a, 0x19, 0x47, 0x65, 0x74, 0x45, - 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x32, 0x35, 0x36, 0x42, 0x69, 0x74, - 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x44, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6b, 0x65, 0x79, 0x49, 0x44, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x32, 0xdf, 0x01, - 0x0a, 0x09, 0x4b, 0x6d, 0x73, 0x54, 0x61, 0x6c, 0x6b, 0x65, 0x72, 0x12, 0x5c, 0x0a, 0x0c, 0x43, - 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x25, 0x2e, 0x6b, 0x6d, - 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, - 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, - 0x65, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x74, 0x0a, 0x14, 0x47, 0x65, 0x74, - 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x4b, 0x65, 0x79, 0x73, 0x32, 0x35, 0x36, 0x42, 0x69, - 0x74, 0x12, 0x2d, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x4b, - 0x65, 0x79, 0x73, 0x32, 0x35, 0x36, 0x42, 0x69, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x2b, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x2e, 0x47, 0x65, 0x74, 0x45, 0x6e, 0x63, 0x72, 0x79, 0x70, 0x74, 0x4b, 0x65, - 0x79, 0x73, 0x32, 0x35, 0x36, 0x42, 0x69, 0x74, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, - 0x3b, 0x5a, 0x39, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x66, 0x62, 0x69, 0x2e, 0x68, 0x2d, 0x64, 0x61, - 0x2e, 0x64, 0x65, 0x2f, 0x6d, 0x2e, 0x73, 0x74, 0x69, 0x65, 0x6d, 0x65, 0x72, 0x6c, 0x69, 0x6e, - 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2d, 0x6b, 0x6d, 0x73, 0x2f, 0x6b, 0x6d, 0x73, 0x69, - 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x22, 0x42, 0x0a, 0x22, 0x4b, 0x65, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, + 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x69, 0x6e, 0x67, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x6d, 0x79, 0x4b, 0x6d, 0x73, + 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x79, 0x4b, 0x6d, + 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x44, 0x0a, 0x20, 0x4b, 0x65, 0x79, 0x54, 0x72, 0x61, 0x6e, + 0x73, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x6e, 0x64, + 0x6c, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x65, 0x65, + 0x72, 0x4b, 0x6d, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, + 0x70, 0x65, 0x65, 0x72, 0x4b, 0x6d, 0x73, 0x4e, 0x61, 0x6d, 0x65, 0x32, 0xf5, 0x01, 0x0a, 0x09, + 0x4b, 0x6d, 0x73, 0x54, 0x61, 0x6c, 0x6b, 0x65, 0x72, 0x12, 0x5c, 0x0a, 0x0c, 0x43, 0x61, 0x70, + 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x25, 0x2e, 0x6b, 0x6d, 0x73, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x61, 0x70, + 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x23, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x61, 0x70, 0x61, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x69, 0x65, 0x73, + 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x89, 0x01, 0x0a, 0x1b, 0x4b, 0x65, 0x79, 0x54, + 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, + 0x61, 0x6e, 0x64, 0x6c, 0x69, 0x6e, 0x67, 0x12, 0x34, 0x2e, 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, + 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4b, 0x65, 0x79, 0x54, 0x72, + 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x61, + 0x6e, 0x64, 0x6c, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x32, 0x2e, + 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2e, 0x4b, 0x65, 0x79, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x53, 0x65, 0x73, + 0x73, 0x69, 0x6f, 0x6e, 0x48, 0x61, 0x6e, 0x64, 0x6c, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x70, 0x6c, + 0x79, 0x22, 0x00, 0x42, 0x3b, 0x5a, 0x39, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x66, 0x62, 0x69, 0x2e, + 0x68, 0x2d, 0x64, 0x61, 0x2e, 0x64, 0x65, 0x2f, 0x6d, 0x2e, 0x73, 0x74, 0x69, 0x65, 0x6d, 0x65, + 0x72, 0x6c, 0x69, 0x6e, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2d, 0x6b, 0x6d, 0x73, 0x2f, + 0x6b, 0x6d, 0x73, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x63, 0x6f, 0x6d, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -273,16 +271,16 @@ func file_kmsintercom_proto_rawDescGZIP() []byte { var file_kmsintercom_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_kmsintercom_proto_goTypes = []interface{}{ - (*CapabilitiesRequest)(nil), // 0: kmsintercomproto.CapabilitiesRequest - (*CapabilitiesReply)(nil), // 1: kmsintercomproto.CapabilitiesReply - (*GetEncryptKeys256BitRequest)(nil), // 2: kmsintercomproto.GetEncryptKeys256BitRequest - (*GetEncryptKeys256BitReply)(nil), // 3: kmsintercomproto.GetEncryptKeys256BitReply + (*CapabilitiesRequest)(nil), // 0: kmsintercomproto.CapabilitiesRequest + (*CapabilitiesReply)(nil), // 1: kmsintercomproto.CapabilitiesReply + (*KeyTransportSessionHandlingRequest)(nil), // 2: kmsintercomproto.KeyTransportSessionHandlingRequest + (*KeyTransportSessionHandlingReply)(nil), // 3: kmsintercomproto.KeyTransportSessionHandlingReply } var file_kmsintercom_proto_depIdxs = []int32{ 0, // 0: kmsintercomproto.KmsTalker.Capabilities:input_type -> kmsintercomproto.CapabilitiesRequest - 2, // 1: kmsintercomproto.KmsTalker.GetEncryptKeys256Bit:input_type -> kmsintercomproto.GetEncryptKeys256BitRequest + 2, // 1: kmsintercomproto.KmsTalker.KeyTransportSessionHandling:input_type -> kmsintercomproto.KeyTransportSessionHandlingRequest 1, // 2: kmsintercomproto.KmsTalker.Capabilities:output_type -> kmsintercomproto.CapabilitiesReply - 3, // 3: kmsintercomproto.KmsTalker.GetEncryptKeys256Bit:output_type -> kmsintercomproto.GetEncryptKeys256BitReply + 3, // 3: kmsintercomproto.KmsTalker.KeyTransportSessionHandling:output_type -> kmsintercomproto.KeyTransportSessionHandlingReply 2, // [2:4] is the sub-list for method output_type 0, // [0:2] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name @@ -321,7 +319,7 @@ func file_kmsintercom_proto_init() { } } file_kmsintercom_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetEncryptKeys256BitRequest); i { + switch v := v.(*KeyTransportSessionHandlingRequest); i { case 0: return &v.state case 1: @@ -333,7 +331,7 @@ func file_kmsintercom_proto_init() { } } file_kmsintercom_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetEncryptKeys256BitReply); i { + switch v := v.(*KeyTransportSessionHandlingReply); i { case 0: return &v.state case 1: diff --git a/internal/kmsintercomproto/kmsintercom.proto b/internal/kmsintercomproto/kmsintercom.proto index f008505c109e847580ea96eac4110770a21a46da..782d6b3a91538948ec112f89adf58a9aeab8a09f 100644 --- a/internal/kmsintercomproto/kmsintercom.proto +++ b/internal/kmsintercomproto/kmsintercom.proto @@ -7,35 +7,28 @@ package kmsintercomproto; service KmsTalker { // Sends a greeting rpc Capabilities (CapabilitiesRequest) returns (CapabilitiesReply) {} - rpc GetEncryptKeys256Bit (GetEncryptKeys256BitRequest) returns (GetEncryptKeys256BitReply) {} + rpc KeyTransportSessionHandling(KeyTransportSessionHandlingRequest) returns (KeyTransportSessionHandlingReply) {} } - // The request message containing the user's name. +// Capabilities +// The request message containing the requesting kms' name. message CapabilitiesRequest { string myKmsName = 1; } - // The response message containing the greetings - message CapabilitiesReply { +// The response message containing the replying kms' name. +message CapabilitiesReply { string peerKmsName= 1; - } - -message GetEncryptKeys256BitRequest { - int64 amount = 1; } - -/* out kms-keystore.go - * type kmsKSElement struct { - * keyID string - * key []byte // a 256 bit key - * } - */ - -message GetEncryptKeys256BitReply { - string keyID = 1; - bytes key = 2; +// KeyTransportSessionHandling +// The request message containing the requesting kms' name. +message KeyTransportSessionHandlingRequest { + string myKmsName = 1; + } + +// The response message containing the replying kms' name. +message KeyTransportSessionHandlingReply { + string peerKmsName= 1; } - - diff --git a/internal/kmsintercomproto/kmsintercom_grpc.pb.go b/internal/kmsintercomproto/kmsintercom_grpc.pb.go index 382d25ec51ebca21853cfba180dbb323a925fb60..3f9ada5a40b09228a1713cda3f536ddb16e1f6b9 100644 --- a/internal/kmsintercomproto/kmsintercom_grpc.pb.go +++ b/internal/kmsintercomproto/kmsintercom_grpc.pb.go @@ -24,7 +24,7 @@ const _ = grpc.SupportPackageIsVersion7 type KmsTalkerClient interface { // Sends a greeting Capabilities(ctx context.Context, in *CapabilitiesRequest, opts ...grpc.CallOption) (*CapabilitiesReply, error) - GetEncryptKeys256Bit(ctx context.Context, in *GetEncryptKeys256BitRequest, opts ...grpc.CallOption) (*GetEncryptKeys256BitReply, error) + KeyTransportSessionHandling(ctx context.Context, in *KeyTransportSessionHandlingRequest, opts ...grpc.CallOption) (*KeyTransportSessionHandlingReply, error) } type kmsTalkerClient struct { @@ -44,9 +44,9 @@ func (c *kmsTalkerClient) Capabilities(ctx context.Context, in *CapabilitiesRequ return out, nil } -func (c *kmsTalkerClient) GetEncryptKeys256Bit(ctx context.Context, in *GetEncryptKeys256BitRequest, opts ...grpc.CallOption) (*GetEncryptKeys256BitReply, error) { - out := new(GetEncryptKeys256BitReply) - err := c.cc.Invoke(ctx, "/kmsintercomproto.KmsTalker/GetEncryptKeys256Bit", in, out, opts...) +func (c *kmsTalkerClient) KeyTransportSessionHandling(ctx context.Context, in *KeyTransportSessionHandlingRequest, opts ...grpc.CallOption) (*KeyTransportSessionHandlingReply, error) { + out := new(KeyTransportSessionHandlingReply) + err := c.cc.Invoke(ctx, "/kmsintercomproto.KmsTalker/KeyTransportSessionHandling", in, out, opts...) if err != nil { return nil, err } @@ -59,7 +59,7 @@ func (c *kmsTalkerClient) GetEncryptKeys256Bit(ctx context.Context, in *GetEncry type KmsTalkerServer interface { // Sends a greeting Capabilities(context.Context, *CapabilitiesRequest) (*CapabilitiesReply, error) - GetEncryptKeys256Bit(context.Context, *GetEncryptKeys256BitRequest) (*GetEncryptKeys256BitReply, error) + KeyTransportSessionHandling(context.Context, *KeyTransportSessionHandlingRequest) (*KeyTransportSessionHandlingReply, error) mustEmbedUnimplementedKmsTalkerServer() } @@ -70,8 +70,8 @@ type UnimplementedKmsTalkerServer struct { func (UnimplementedKmsTalkerServer) Capabilities(context.Context, *CapabilitiesRequest) (*CapabilitiesReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Capabilities not implemented") } -func (UnimplementedKmsTalkerServer) GetEncryptKeys256Bit(context.Context, *GetEncryptKeys256BitRequest) (*GetEncryptKeys256BitReply, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetEncryptKeys256Bit not implemented") +func (UnimplementedKmsTalkerServer) KeyTransportSessionHandling(context.Context, *KeyTransportSessionHandlingRequest) (*KeyTransportSessionHandlingReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method KeyTransportSessionHandling not implemented") } func (UnimplementedKmsTalkerServer) mustEmbedUnimplementedKmsTalkerServer() {} @@ -104,20 +104,20 @@ func _KmsTalker_Capabilities_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } -func _KmsTalker_GetEncryptKeys256Bit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetEncryptKeys256BitRequest) +func _KmsTalker_KeyTransportSessionHandling_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(KeyTransportSessionHandlingRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(KmsTalkerServer).GetEncryptKeys256Bit(ctx, in) + return srv.(KmsTalkerServer).KeyTransportSessionHandling(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/kmsintercomproto.KmsTalker/GetEncryptKeys256Bit", + FullMethod: "/kmsintercomproto.KmsTalker/KeyTransportSessionHandling", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(KmsTalkerServer).GetEncryptKeys256Bit(ctx, req.(*GetEncryptKeys256BitRequest)) + return srv.(KmsTalkerServer).KeyTransportSessionHandling(ctx, req.(*KeyTransportSessionHandlingRequest)) } return interceptor(ctx, in, info, handler) } @@ -134,8 +134,8 @@ var KmsTalker_ServiceDesc = grpc.ServiceDesc{ Handler: _KmsTalker_Capabilities_Handler, }, { - MethodName: "GetEncryptKeys256Bit", - Handler: _KmsTalker_GetEncryptKeys256Bit_Handler, + MethodName: "KeyTransportSessionHandling", + Handler: _KmsTalker_KeyTransportSessionHandling_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/internal/main.go b/internal/main.go index ca4dd1e1882eafc382780b30ae73bf7f906ca5f9..88af133932812e9d5ef6487b9610304e181c828a 100644 --- a/internal/main.go +++ b/internal/main.go @@ -1,6 +1,7 @@ package main // go generate protoc --proto_path=kmsintercomproto --go_out=kmsintercomproto --go_opt=paths=source_relative --go-grpc_out=kmsintercomproto --go-grpc_opt=paths=source_relative kmsintercom.proto +// go generate protoc --proto_path=kmsetsiproto --go_out=kmsetsiproto --go_opt=paths=source_relative --go-grpc_out=kmsetsiproto --go-grpc_opt=paths=source_relative kmsetsiproto.proto import ( "flag" @@ -45,7 +46,8 @@ func main() { log.Println("Welcome to the proto-kms called: ", ql1Name) - go kms.StartInterComm() + // Start the SDN/management and key retrieval interface + go kms.StartETSI() if selfTesting == true { log.Printf("%s in self-testing mode", ql1Name) diff --git a/internal/proto-kms b/internal/proto-kms new file mode 100755 index 0000000000000000000000000000000000000000..7ca26b53bdbf8e25639b41a49841f93b9e5ca211 Binary files /dev/null and b/internal/proto-kms differ