Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
quant
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
quant
Commits
b76f3f1e
Commit
b76f3f1e
authored
5 months ago
by
Martin Stiemerling
Browse files
Options
Downloads
Patches
Plain Diff
First attempt to fix failed integration test and clean-up/separatation ETSI 20.
parent
a916d6a2
No related branches found
No related tags found
1 merge request
!237
Adding initial ETSI 20 border node protocol and mechanics
Pipeline
#234374
passed
5 months ago
Stage: build
Stage: build-integration-test
Stage: test
Stage: analyze
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
goKMS/kms/kms.go
+38
-4
38 additions, 4 deletions
goKMS/kms/kms.go
with
38 additions
and
4 deletions
goKMS/kms/kms.go
+
38
−
4
View file @
b76f3f1e
...
@@ -477,7 +477,7 @@ func (kms *KMS) GenerateAndSendKSAKey(remoteKMSId string, pathId uuid.UUID, requ
...
@@ -477,7 +477,7 @@ func (kms *KMS) GenerateAndSendKSAKey(remoteKMSId string, pathId uuid.UUID, requ
remoteKMSAdrress
:=
fmt
.
Sprintf
(
"%s:%d"
,
remoteKMS
.
Address
,
remoteKMS
.
Port
)
remoteKMSAdrress
:=
fmt
.
Sprintf
(
"%s:%d"
,
remoteKMS
.
Address
,
remoteKMS
.
Port
)
err
=
kms
.
sendKSAKeysToPlatformKmsPeer
(
remoteKMSAdrress
,
platformKey
.
Id
.
String
(),
requestID
,
ksaKeys
,
""
,
nil
)
err
=
kms
.
sendKSAKeysToPlatformKmsPeer
(
remoteKMSAdrress
,
platformKey
.
Id
.
String
(),
requestID
,
ksaKeys
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
err
)
log
.
Error
(
err
)
return
err
return
err
...
@@ -630,7 +630,41 @@ func encryptKSAKey(cryptoAlgo crypto.CryptoAlgorithm, platformKeyValue []byte, k
...
@@ -630,7 +630,41 @@ func encryptKSAKey(cryptoAlgo crypto.CryptoAlgorithm, platformKeyValue []byte, k
return
ksaKeyToSend
,
nil
return
ksaKeyToSend
,
nil
}
}
func
(
kms
*
KMS
)
sendKSAKeysToPlatformKmsPeer
(
kmsPeerAddress
,
platformKeyID
,
requestID
string
,
ksaKeys
[]
*
pbIC
.
Key
,
initSaeID
string
,
targetSaeIDs
[]
string
)
error
{
// This is the standard way of sending KSA keys to the platform KMS peer.
func
(
kms
*
KMS
)
sendKSAKeysToPlatformKmsPeer
(
kmsPeerAddress
,
platformKeyID
,
requestID
string
,
ksaKeys
[]
*
pbIC
.
Key
)
error
{
gRPCTransportCreds
,
err
:=
kmstls
.
GenerateGRPCClientTransportCredsBasedOnTLSFlag
(
kms
.
tlsConfig
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"unable to generate gRPC transport creds: %w"
,
err
)
}
remoteConn
,
err
:=
grpc
.
NewClient
(
kmsPeerAddress
,
grpc
.
WithTransportCredentials
(
gRPCTransportCreds
))
if
err
!=
nil
{
log
.
Error
(
err
)
return
err
}
remoteClient
:=
pbIC
.
NewKmsTalkerClient
(
remoteConn
)
ctx
,
cancel
:=
context
.
WithTimeout
(
context
.
Background
(),
kms
.
gRPCTimeout
)
// create a new context with some metadata
md
:=
metadata
.
Pairs
(
"hostname"
,
kms
.
kmsName
)
ctx
=
metadata
.
NewOutgoingContext
(
ctx
,
md
)
defer
cancel
()
_
,
err
=
remoteClient
.
KeyDelivery
(
ctx
,
&
pbIC
.
KeyDeliveryRequest
{
KeyId
:
platformKeyID
,
RequestId
:
requestID
,
KmsId
:
kms
.
kmsUUID
.
String
(),
Keys
:
ksaKeys
,
})
if
err
!=
nil
{
log
.
Error
(
err
)
return
err
}
return
nil
}
// This is the ETSI20 way of sending KSA keys to the platform KMS peer.
func
(
kms
*
KMS
)
sendKSAKeysToPlatformKmsPeerForETSI20
(
kmsPeerAddress
,
platformKeyID
,
requestID
string
,
ksaKeys
[]
*
pbIC
.
Key
,
initSaeID
string
,
targetSaeIDs
[]
string
)
error
{
gRPCTransportCreds
,
err
:=
kmstls
.
GenerateGRPCClientTransportCredsBasedOnTLSFlag
(
kms
.
tlsConfig
)
gRPCTransportCreds
,
err
:=
kmstls
.
GenerateGRPCClientTransportCredsBasedOnTLSFlag
(
kms
.
tlsConfig
)
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"unable to generate gRPC transport creds: %w"
,
err
)
return
fmt
.
Errorf
(
"unable to generate gRPC transport creds: %w"
,
err
)
...
@@ -775,7 +809,7 @@ func (kms *KMS) generateAndReturnKsaKey(receivingCKMSID, pathID uuid.UUID, numbe
...
@@ -775,7 +809,7 @@ func (kms *KMS) generateAndReturnKsaKey(receivingCKMSID, pathID uuid.UUID, numbe
remoteKMSAdrress
:=
fmt
.
Sprintf
(
"%s:%d"
,
remoteKMS
.
Address
,
remoteKMS
.
Port
)
remoteKMSAdrress
:=
fmt
.
Sprintf
(
"%s:%d"
,
remoteKMS
.
Address
,
remoteKMS
.
Port
)
err
=
kms
.
sendKSAKeysToPlatformKmsPeer
(
remoteKMSAdrress
,
platformKey
.
Id
.
String
(),
requestID
,
ksaKeysToSendToRemoteKMS
,
""
,
nil
)
err
=
kms
.
sendKSAKeysToPlatformKmsPeer
(
remoteKMSAdrress
,
platformKey
.
Id
.
String
(),
requestID
,
ksaKeysToSendToRemoteKMS
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
err
)
log
.
Error
(
err
)
return
nil
,
err
return
nil
,
err
...
@@ -808,7 +842,7 @@ func (kms *KMS) shipKSAKeytoPlatformKmsPeer(receivingCKMSID, pathID uuid.UUID, r
...
@@ -808,7 +842,7 @@ func (kms *KMS) shipKSAKeytoPlatformKmsPeer(receivingCKMSID, pathID uuid.UUID, r
}
}
remoteKMSAdrress
:=
fmt
.
Sprintf
(
"%s:%d"
,
remoteKMS
.
Address
,
remoteKMS
.
Port
)
remoteKMSAdrress
:=
fmt
.
Sprintf
(
"%s:%d"
,
remoteKMS
.
Address
,
remoteKMS
.
Port
)
err
=
kms
.
sendKSAKeysToPlatformKmsPeer
(
remoteKMSAdrress
,
platformKey
.
Id
.
String
(),
requestID
,
ksaKeysToSendToRemoteKMS
,
initSaedID
,
targetSaedIDs
)
err
=
kms
.
sendKSAKeysToPlatformKmsPeer
ForETSI20
(
remoteKMSAdrress
,
platformKey
.
Id
.
String
(),
requestID
,
ksaKeysToSendToRemoteKMS
,
initSaedID
,
targetSaedIDs
)
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Error
(
err
)
log
.
Error
(
err
)
return
err
return
err
...
...
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