storage

package
v6.0.15 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//
	// KeyLength is the exact key length accepted by NewSymmetricEncryptStorage
	//
	KeyLength = 32
)

Variables

View Source
var (
	ErrorKeyAlreadyExists = errors.New("key already exists")
	ErrorKeyNotFound      = errors.New("key not found")
)
View Source
var (
	ErrEncryptedDataInvalid = errors.New("encrypt data invalid")
)

Functions

This section is empty.

Types

type FileStorage

type FileStorage struct {
	RootDir string
}

func (*FileStorage) Delete

func (s *FileStorage) Delete(name string) error

func (*FileStorage) Exists

func (s *FileStorage) Exists(name string) bool

func (*FileStorage) Load

func (s *FileStorage) Load(name string) ([]byte, error)

func (*FileStorage) Store

func (s *FileStorage) Store(key string, val []byte) error

type PrivateKeyExporter

type PrivateKeyExporter interface {
	ExportPrivateKey(privateKey crypto.PrivateKey) ([]byte, error)
	ImportPrivateKey(data []byte) (privateKey crypto.PrivateKey, err error)
}
var (
	// DefaultPrivateKeyExporter is private key exporter is used by default
	DefaultPrivateKeyExporter PrivateKeyExporter = &crypto.Crypto{}
)

type PrivateKeyExporterOption

type PrivateKeyExporterOption func(s *VirgilPrivateKeyStorage)

type Storage

type Storage interface {
	Store(key string, val []byte) error
	Load(key string) ([]byte, error)
	Exists(key string) bool
	Delete(key string) error
}

type SymmetricEncryptStorage

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

func NewSymmetricEncryptStorage

func NewSymmetricEncryptStorage(key [KeyLength]byte, storage Storage) *SymmetricEncryptStorage

func (*SymmetricEncryptStorage) Delete

func (s *SymmetricEncryptStorage) Delete(key string) error

func (*SymmetricEncryptStorage) Exists

func (s *SymmetricEncryptStorage) Exists(key string) bool

func (*SymmetricEncryptStorage) Load

func (s *SymmetricEncryptStorage) Load(key string) ([]byte, error)

func (*SymmetricEncryptStorage) Store

func (s *SymmetricEncryptStorage) Store(key string, val []byte) error

type VirgilPrivateKeyStorage

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

func NewVirgilPrivateKeyStorage

func NewVirgilPrivateKeyStorage(storage Storage, options ...PrivateKeyExporterOption) *VirgilPrivateKeyStorage

func (*VirgilPrivateKeyStorage) Delete

func (v *VirgilPrivateKeyStorage) Delete(name string) error

func (*VirgilPrivateKeyStorage) Load

func (v *VirgilPrivateKeyStorage) Load(name string) (privateKey crypto.PrivateKey, meta map[string]string, err error)

func (*VirgilPrivateKeyStorage) Store

func (v *VirgilPrivateKeyStorage) Store(privateKey crypto.PrivateKey, name string, meta map[string]string) error

func (*VirgilPrivateKeyStorage) Validate

func (v *VirgilPrivateKeyStorage) Validate() error

Jump to

Keyboard shortcuts

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