Skip to content
Snippets Groups Projects
Commit 3b1e6b28 authored by Neil-Jocelyn Schark's avatar Neil-Jocelyn Schark
Browse files

Ckms akms v2

See merge request !46
parent 073d7694
No related branches found
No related tags found
1 merge request!46Ckms akms v2
Pipeline #186797 passed
......@@ -14,28 +14,24 @@ gnmic -a "172.100.20.10:7030" -u admin -p admin --insecure -e JSON_IETF set --up
sleep 2
# initiating a key request from kms01
curl -X POST -H "Content-Type: application/json" -d '{
"local_CKMS_ID": "172.100.20.13:50910",
"receiving_CKMS_ID": "172.100.20.13:50910",
"request_ID": "request_ID-1234",
"key_properties": [
{
"key_properties": {
"number": 1,
"key_length": 256,
"timeout": 20,
"TTL": 24
}
]
}' 'http://172.100.20.10:9696/api/v1/keys/ksa_key_req'
# initiating a key request from kms04
curl -X POST -H "Content-Type: application/json" -d '{
"local_CKMS_ID": "172.100.20.10:50910",
"receiving_CKMS_ID": "172.100.20.10:50910",
"request_ID": "request_ID-1234",
"key_properties": [
{
"number": 5,
"key_properties": {
"number": 1,
"key_length": 256,
"timeout": 20,
"TTL": 24
}
]
}' 'http://172.100.20.13:9696/api/v1/keys/ksa_key_req'
......@@ -43,9 +43,9 @@ type KeyProperties struct {
}
type KMSKeyRequest struct {
LocalCKMSID string `json:"local_CKMS_ID"`
RequestID string `json:"request_ID"`
KeyProperties []KeyProperties `json:"key_properties"`
ReceivingCKMSID string `json:"receiving_CKMS_ID"`
RequestID string `json:"request_ID"`
KeyProperties KeyProperties `json:"key_properties"`
}
func ksaReqHandler(ekms *kms.EKMS) http.HandlerFunc {
......@@ -58,11 +58,14 @@ func ksaReqHandler(ekms *kms.EKMS) http.HandlerFunc {
return
}
logrus.Infof("received KSA key request for local CKMS %s, request ID %s, and key properties %v",
kmsKeyRequest.LocalCKMSID, kmsKeyRequest.RequestID, kmsKeyRequest.KeyProperties)
logrus.Infof("received KSA key request for receiving CKMS %s, request ID %s, and key properties %v",
kmsKeyRequest.ReceivingCKMSID, kmsKeyRequest.RequestID, kmsKeyRequest.KeyProperties)
for _, keyProperties := range kmsKeyRequest.KeyProperties {
go ekms.GenerateAndSendKSAKey(kmsKeyRequest.LocalCKMSID, kmsKeyRequest.RequestID, keyProperties.Number) //nolint:errcheck
err = ekms.GenerateAndSendKSAKey(kmsKeyRequest.ReceivingCKMSID, kmsKeyRequest.RequestID, kmsKeyRequest.KeyProperties.Number) //nolint:errcheck
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
logrus.Errorf("error generating and sending KSA key: %s", err)
return
}
logrus.Info("requested all keys")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment