Documentation
¶
Index ¶
- Variables
- func RegisterKeyManager(name string, f KeyManager) error
- type KeyManager
- type KeyManagerLocal
- func (kml *KeyManagerLocal) Decrypt(proto string, namespace string, data []byte) ([]byte, error)
- func (kml *KeyManagerLocal) GetPublicKey(proto string, namespace string) ([]byte, error)
- func (kml *KeyManagerLocal) New(uri string) (KeyManager, error)
- func (kml *KeyManagerLocal) Sign(proto string, namespace string, data []byte) ([]byte, error)
- func (kml *KeyManagerLocal) Supported(uri string) bool
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrorsKMNotSupported occurs when the km type is not supported ErrorsKMNotSupported = errors.New("key manager type is not supported") )
Functions ¶
func RegisterKeyManager ¶
func RegisterKeyManager(name string, f KeyManager) error
RegisterKeyManager provides a way to dynamically register an implementation of a key manager type.
If RegisterKeyManager is called twice with the same name if 'key manager type' is nil, or if the name is blank, it panics.
Types ¶
type KeyManager ¶
type KeyManager interface { // `url` is the database address or local directory (for example: /tmp/cache) New(url string) (KeyManager, error) Supported(url string) bool // proto: 'app/v1' for example // namespace : namespace GetPublicKey(proto string, namespace string) ([]byte, error) // proto: 'app/v1' for example // namespace : namespace Sign(proto string, namespace string, data []byte) ([]byte, error) // proto: 'app/v1' for example // namespace : namespace Decrypt(proto string, namespace string, data []byte) ([]byte, error) }
KeyManager should be seperate from dockyard Now only assume that keys are existed in the backend key manager. It is up to each implementation to decide whether provides a way
to generate key pair automatically.
func NewKeyManager ¶
func NewKeyManager(url string) (KeyManager, error)
NewKeyManager create a key manager by a url
type KeyManagerLocal ¶
type KeyManagerLocal struct {
Path string
}
func (*KeyManagerLocal) GetPublicKey ¶
func (kml *KeyManagerLocal) GetPublicKey(proto string, namespace string) ([]byte, error)
GetPublicKey gets the public key data of a namespace
func (*KeyManagerLocal) New ¶
func (kml *KeyManagerLocal) New(uri string) (KeyManager, error)
New returns a keymanager by a uri
func (*KeyManagerLocal) Supported ¶
func (kml *KeyManagerLocal) Supported(uri string) bool
Supported checks if a uri is local path
Click to show internal directories.
Click to hide internal directories.