kms

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2022 License: Apache-2.0 Imports: 5 Imported by: 3 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package kms defines the interface and the GRPC implementation for kms plugins. KMS plugins allow to encrypt/decrypt sensitive data.

Index

Constants

View Source
const (
	// PluginName defines the name for a kms plugin
	PluginName = "kms"
)

Variables

View Source
var Handshake = plugin.HandshakeConfig{
	ProtocolVersion:  1,
	MagicCookieKey:   "SFTPGO_PLUGIN_KMS",
	MagicCookieValue: "223e3571-7ed2-4b96-b4b3-c7eb87d7ca1d",
}

Handshake is a common handshake that is shared by plugin and host.

View Source
var PluginMap = map[string]plugin.Plugin{
	PluginName: &Plugin{},
}

PluginMap is the map of plugins we can dispense.

Functions

This section is empty.

Types

type GRPCClient

type GRPCClient struct {
	// contains filtered or unexported fields
}

GRPCClient is an implementation of KMS interface that talks over RPC.

func (*GRPCClient) Decrypt

func (c *GRPCClient) Decrypt(payload, key, additionalData string, mode int, URL, masterKey string) (string, error)

Decrypt implements the KMSService interface

func (*GRPCClient) Encrypt

func (c *GRPCClient) Encrypt(payload, additionalData, URL, masterKey string) (string, string, int32, error)

Encrypt implements the KMSService interface

type GRPCServer

type GRPCServer struct {
	Impl Service
}

GRPCServer defines the gRPC server that GRPCClient talks to.

func (*GRPCServer) Decrypt

Decrypt implements the serve side decrypt method

func (*GRPCServer) Encrypt

Encrypt implements the serve side encrypt method

type Plugin

type Plugin struct {
	plugin.Plugin
	Impl Service
}

Plugin defines the implementation to serve/connect to a notifier plugin

func (*Plugin) GRPCClient

func (p *Plugin) GRPCClient(ctx context.Context, broker *plugin.GRPCBroker, c *grpc.ClientConn) (interface{}, error)

GRPCClient defines the GRPC client implementation for this plugin

func (*Plugin) GRPCServer

func (p *Plugin) GRPCServer(broker *plugin.GRPCBroker, s *grpc.Server) error

GRPCServer defines the GRPC server implementation for this plugin

type Service

type Service interface {
	Encrypt(payload, additionalData, URL, masterKey string) (string, string, int32, error)
	Decrypt(payload, key, additionalData string, mode int, URL, masterKey string) (string, error)
}

Service defines the interface for kms plugins

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL