crypto

package
v0.1.17 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidCredentialOptions = errors.New("unknown credential options")
View Source
var ErrInvalidPasswordLength = errors.New("invalid password length")
View Source
var ErrInvalidPublicKey = errors.New("invalid public key")

Functions

func GenKey

func GenKey() (*ecdsa.PrivateKey, *jose.JSONWebKey)

GenKey generates a new ecdsa keypair and returns the private key and public key JWK It panics on any error.

func GeneratePassword

func GeneratePassword(credentialOptions *v2.CredentialOptions) (string, error)

func GenerateRandomPassword

func GenerateRandomPassword(randomPassword *v2.CredentialOptions_RandomPassword) (string, error)

func NewEncryptor

func NewEncryptor(pubKey *jose.JSONWebKey) (jose.Encrypter, error)

func ParsePublicKey

func ParsePublicKey(input []byte) (*jose.JSONWebKey, error)

ParsePublicKey parses a public ecdsa JWK, all other key types return errors.

Types

type EncryptionManager

type EncryptionManager interface {
	Encrypt(cred *PlaintextCredential) ([]*v2.EncryptedData, error)
}

type PlaintextCredential

type PlaintextCredential struct {
	Name        string
	Description string
	Schema      string
	Bytes       []byte
}

type PubKeyEncryptionManager

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

func NewPubKeyEncryptionManager

func NewPubKeyEncryptionManager(co *v2.CredentialOptions, ec []*v2.EncryptionConfig) (*PubKeyEncryptionManager, error)

func (*PubKeyEncryptionManager) Encrypt

Jump to

Keyboard shortcuts

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