Skip to content
Snippets Groups Projects
Select Git revision
  • 6e044c118fb554eea9015d3c51a51fe4f88003de
  • master default protected
  • renovate/rabbitmq-4.x
  • renovate/mongo-8.x
  • renovate/golangci-golangci-lint-2.x
  • renovate/google.golang.org-protobuf-1.x
  • renovate/google.golang.org-grpc-1.x
  • renovate/golang.org-x-sys-0.x
  • renovate/github.com-openconfig-goyang-1.x
  • renovate/github.com-oapi-codegen-runtime-1.x
  • renovate/google.golang.org-genproto-googleapis-api-digest
  • renovate/code.fbi.h-da.de-danet-gnmi-target-digest
  • 57-ping-utility-for-etsi-20-testing
  • enhance-ping-utility
  • 54-ecoc-infrastructure-setup
  • kai_masterthesis
  • martin-quipsec
  • request-health-checks-for-peers
  • 44-block-incoming-keys-if-exceeding-max-key-fill-level
  • add-inventory-manager
  • extend-intercom-with-aes-auth-tag
  • tud-testing-1
22 results

kms.go

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    kms.go 6.44 KiB
    // This package kms implements a simplistic key managment system (kms) for
    // Quantum Key Distribution Networks (QKDN) which is a simple emulated KMS. x
    // It relies on the emulated quantum link out of the quantumlayer package
    
    package kms
    
    import (
    	"fmt"
    	"io"
    	"net"
    	"sync"
    
    	log "github.com/sirupsen/logrus"
    	"google.golang.org/grpc"
    	"google.golang.org/grpc/health"
    	healthpb "google.golang.org/grpc/health/grpc_health_v1"
    
    	pbETSI "code.fbi.h-da.de/danet/proto-kms/api/gen/proto/go/kmsetsi"
    	pbIC "code.fbi.h-da.de/danet/proto-kms/api/gen/proto/go/kmsintercom"
    	pbQS "code.fbi.h-da.de/danet/quipsec/gen/go/quipsec"
    	"github.com/google/uuid"
    )
    
    //type Qkdnkms interface {
    //	//AddExternalNotifierGeneral(chan bool)   // used to indicate unspecific changes
    //	AddExternalNotifierQLE(chan uint32)     // used to indicate changes to specific Quantum Link Element (QLE)
    //	AddExternalNotifierKMSPeer(chan string) // used to indicate changes to specific KMSPeer
    //	AddQuantumElement() *EmulatedQuantumModule
    //	GlobalKeyHandler(time.Duration) error
    //	AddPeer(kmsPeerSocket string, servingQLE *EmulatedQuantumModule)
    //	RemovePeer(kmsPeerSocket string)
    //	FindPeerUuid(uuid.UUID) *kmsPeer
    //}
    
    type Route struct {
    	Previous *kmsPeer
    	Next     *kmsPeer
    }
    
    type BitKeyLength string
    
    const (
    	BitKeyLen128 BitKeyLength = "128"
    	BitKeyLen256 BitKeyLength = "256"
    	BitKeyLen512 BitKeyLength = "512"
    )
    
    // The general emulated KMS
    type EKMS struct {
    	kmsName             string
    	kmsUUID             uuid.UUID
    	interComAddr        string
    	qleMapMutex         sync.Mutex
    	quantumModules      map[string]QuantumModule
    	quantumModulesMutex sync.RWMutex
    	externalNotifierQLE chan uint32
    	kmsPeersMutex       sync.Mutex
    	// TODO(maba): find a better name for this
    	// TODO: add mutex
    	keysForPathId           map[uuid.UUID]string
    	routingTable            map[uuid.UUID]*Route
    	KmsPeers                map[string]*kmsPeer
    	externalNotifierKMSPeer chan string
    	pbETSI.UnimplementedKmsETSIServer
    	pbIC.UnimplementedKmsTalkerServer
    	supportedKeyLengths map[BitKeyLength]bool
    }
    
    // Will keep information about the quantum elements that this EKMS is talking to
    // This actually constitutes a quantum element with only a single link