Skip to content
Snippets Groups Projects

Draft: Akms ckms api implementation

Closed Neil-Jocelyn Schark requested to merge akms-ckms-api-implementation into master
4 files
+ 19
6
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -61,7 +61,11 @@ func (s *kmsTalkerServer) KeyIdNotification(ctx context.Context, in *pb.KeyIdNot
@@ -61,7 +61,11 @@ func (s *kmsTalkerServer) KeyIdNotification(ctx context.Context, in *pb.KeyIdNot
return nil, err
return nil, err
}
}
defer resp.Body.Close()
defer func() {
 
if closeError := resp.Body.Close(); closeError != nil {
 
log.Errorf("KeyIdNotification: response closing failure: %s", err)
 
}
 
}()
// TODO: add proper status code handling
// TODO: add proper status code handling
if resp.StatusCode != 200 {
if resp.StatusCode != 200 {
@@ -226,8 +230,12 @@ func (s *kmsTalkerServer) KeyForwarding(ctx context.Context, in *pb.KeyForwardin
@@ -226,8 +230,12 @@ func (s *kmsTalkerServer) KeyForwarding(ctx context.Context, in *pb.KeyForwardin
log.Infof("%s received a payload: %s, from %s", s.eKMS.kmsName, decryptedPayload, route.Previous.tcpSocketStr)
log.Infof("%s received a payload: %s, from %s", s.eKMS.kmsName, decryptedPayload, route.Previous.tcpSocketStr)
if route.Next != nil {
if route.Next != nil {
log.Infof("%s forwards payload to : %s", s.eKMS.kmsName, route.Next.tcpSocketStr)
log.Infof("%s is trying to forward payload to : %s", s.eKMS.kmsName, route.Next.tcpSocketStr)
go route.Next.SendPayload(decryptedPayload, pathId)
err := route.Next.SendPayload(decryptedPayload, pathId)
 
if err != nil {
 
return nil, status.Errorf(codes.Internal, "%s", err)
 
}
 
log.Infof("%s forwarded the payload to : %s successfully", s.eKMS.kmsName, route.Next.tcpSocketStr)
} else {
} else {
log.Infof("%s received the final payload: %s", s.eKMS.kmsName, string(decryptedPayload))
log.Infof("%s received the final payload: %s", s.eKMS.kmsName, string(decryptedPayload))
}
}
Loading