Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Proto Kms
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danet
Proto Kms
Commits
6daa17db
Commit
6daa17db
authored
1 year ago
by
Martin Stiemerling
Browse files
Options
Downloads
Patches
Plain Diff
Add peer via ETSI-alike grpc works
parent
9fd5a5fc
No related branches found
No related tags found
1 merge request
!9
First working draft version
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
kms/kmsetsi.go
+11
-8
11 additions, 8 deletions
kms/kmsetsi.go
main.go
+1
-1
1 addition, 1 deletion
main.go
with
12 additions
and
9 deletions
kms/kmsetsi.go
+
11
−
8
View file @
6daa17db
...
...
@@ -16,9 +16,10 @@ var (
type
etsiServer
struct
{
pb
.
UnimplementedKmsETSIServer
handlingEkms
*
eKMS
}
func
(
km
s
*
etsiServer
)
ETSICapabilities
(
ctx
context
.
Context
,
in
*
pb
.
ETSICapabilitiesRequest
)
(
capReply
*
pb
.
ETSICapabilitiesReply
,
err
error
)
{
func
(
e
s
*
etsiServer
)
ETSICapabilities
(
ctx
context
.
Context
,
in
*
pb
.
ETSICapabilitiesRequest
)
(
capReply
*
pb
.
ETSICapabilitiesReply
,
err
error
)
{
log
.
Printf
(
"Received: %v"
,
in
.
GetMyKmsName
())
return
&
pb
.
ETSICapabilitiesReply
{
...
...
@@ -26,18 +27,18 @@ func (kms *etsiServer) ETSICapabilities(ctx context.Context, in *pb.ETSICapabili
},
nil
}
func
(
km
s
*
etsiServer
)
ETSIAddKMSPeer
(
ctx
context
.
Context
,
in
*
pb
.
ETSIKMSPeerRequest
)
(
*
pb
.
ETSIKMSPeerReply
,
error
)
{
func
(
e
s
*
etsiServer
)
ETSIAddKMSPeer
(
ctx
context
.
Context
,
in
*
pb
.
ETSIKMSPeerRequest
)
(
*
pb
.
ETSIKMSPeerReply
,
error
)
{
//determine the kms structure to call
log
.
Printf
(
"AddKMSPeer called."
)
//etsiServer
.AddPeer(in.GetKmsPeerSocket())
es
.
handlingEkms
.
AddPeer
(
in
.
GetKmsPeerSocket
())
return
&
pb
.
ETSIKMSPeerReply
{
//
KmsPeerName: kms.kmsName,
KmsPeerName
:
es
.
handlingE
kms
.
kmsName
,
},
nil
}
func
(
km
s
*
etsiServer
)
ETSIRemoveKMSPeer
(
ctx
context
.
Context
,
in
*
pb
.
ETSIKMSPeerRequest
)
(
*
pb
.
ETSIKMSPeerReply
,
error
)
{
func
(
e
s
*
etsiServer
)
ETSIRemoveKMSPeer
(
ctx
context
.
Context
,
in
*
pb
.
ETSIKMSPeerRequest
)
(
*
pb
.
ETSIKMSPeerReply
,
error
)
{
//kms.RemovePeer(in.GetKmsPeerSocket())
return
&
pb
.
ETSIKMSPeerReply
{
...
...
@@ -45,7 +46,7 @@ func (kms *etsiServer) ETSIRemoveKMSPeer(ctx context.Context, in *pb.ETSIKMSPeer
},
nil
}
func
(
km
s
*
etsiServer
)
GetEncryptKeys256Bit
(
ctx
context
.
Context
,
in
*
pb
.
ETSIGetEncryptKeys256BitRequest
)
(
*
pb
.
ETSIGetEncryptKeys256BitReply
,
error
)
{
func
(
e
s
*
etsiServer
)
GetEncryptKeys256Bit
(
ctx
context
.
Context
,
in
*
pb
.
ETSIGetEncryptKeys256BitRequest
)
(
*
pb
.
ETSIGetEncryptKeys256BitReply
,
error
)
{
log
.
Printf
(
"Received request for n=%d keys"
,
in
.
GetAmount
())
testBytes
:=
[]
byte
{
120
,
120
,
120
}
...
...
@@ -57,7 +58,7 @@ func (kms *etsiServer) GetEncryptKeys256Bit(ctx context.Context, in *pb.ETSIGetE
},
nil
}
func
StartETSI
(
listenAddr
string
)
{
func
StartETSI
(
listenAddr
string
,
callingKMS
*
eKMS
)
{
flag
.
Parse
()
//lis, err := net.Listen("tcp", fmt.Sprintf(":%d", *etsiPort))
...
...
@@ -66,7 +67,9 @@ func StartETSI(listenAddr string) {
log
.
Fatalf
(
"failed to listen: %v"
,
err
)
}
s
:=
grpc
.
NewServer
()
pb
.
RegisterKmsETSIServer
(
s
,
&
etsiServer
{})
pb
.
RegisterKmsETSIServer
(
s
,
&
etsiServer
{
handlingEkms
:
callingKMS
,
})
log
.
Printf
(
"server listening at %v"
,
lis
.
Addr
())
if
err
:=
s
.
Serve
(
lis
);
err
!=
nil
{
log
.
Fatalf
(
"failed to serve: %v"
,
err
)
...
...
This diff is collapsed.
Click to expand it.
main.go
+
1
−
1
View file @
6daa17db
...
...
@@ -74,7 +74,7 @@ func emulatedKMS(myName string, myUDPAddr string, peerUDPAddr string) {
myQL
.
QuantumElementLink
.
AddPeer
(
*
udpQL2Addr
)
// Start the SDN/management and key retrieval interface
go
kms
.
StartETSI
(
peerUDPAddr
)
go
kms
.
StartETSI
(
peerUDPAddr
,
emuKMS
)
// TODO/XXX catch errors!
emuKMS
.
GlobalKeyHandler
(
7
*
time
.
Second
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment