crypto

package
v0.0.0-...-9516177 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyPair

type KeyPair struct {
	PublicKey  string
	PrivateKey string
	// contains filtered or unexported fields
}

KeyPair represents a public/private key pair

func NewKeyPairFromFile

func NewKeyPairFromFile(privateKeyPEMPath string) (*KeyPair, error)

NewKeyPairFromFile returns a key pair from a PEM encoded private key file in the given path

func NewKeyPairFromString

func NewKeyPairFromString(privateKeyPEM string) (*KeyPair, error)

NewKeyPairFromString returns a key pair from a PEM encoded private key

func NewKeyPairFromv1alpha1

func NewKeyPairFromv1alpha1(keyPair *commonv1alpha1.KeyPair) (*KeyPair, error)

NewKeyPairFromv1alpha1 returns a key pair from a versioned key pair

func NewPrivateKey

func NewPrivateKey(keyBitSize int) (*KeyPair, error)

NewPrivateKey generates a new key pair

func (*KeyPair) Decrypt

func (keyPair *KeyPair) Decrypt(content string) (string, error)

Decrypt decrypts the given base-64 contents using the private key in the key pair

func (*KeyPair) Encrypt

func (keyPair *KeyPair) Encrypt(content string) (string, error)

Encrypt encrypts the given base-64 contents using the public key in the key pair

func (*KeyPair) Export

func (keyPair *KeyPair) Export() *commonv1alpha1.KeyPair

Export exports the key pair to a versioned key pair

func (*KeyPair) Key

func (keyPair *KeyPair) Key() *rsa.PrivateKey

Key returns the RSA private key for this private key pair

type PublicKey

type PublicKey struct {
	PublicKey string
	// contains filtered or unexported fields
}

PublicKey represents a public key

func NewPublicKeyFromFile

func NewPublicKeyFromFile(publicKeyPEMPath string) (*PublicKey, error)

NewPublicKeyFromFile returns a public key from a PEM encoded public key file in the given path

func NewPublicKeyFromString

func NewPublicKeyFromString(publicKeyPEM string) (*PublicKey, error)

NewPublicKeyFromString returns a public key from a PEM encoded public key

func (*PublicKey) Encrypt

func (publicKey *PublicKey) Encrypt(content string) (string, error)

Encrypt encrypts the given content using this public key, producing a base64 result

type SymmetricKey

type SymmetricKey string

SymmetricKey represents a symmetric key

func (SymmetricKey) Decrypt

func (symmetricKey SymmetricKey) Decrypt(content string) (string, error)

Decrypt decrypts the given base-64 contents using this symmetric key

func (SymmetricKey) Encrypt

func (symmetricKey SymmetricKey) Encrypt(content string) (string, error)

Encrypt encrypts the given content using this symmetric key, producing a base64 result

Jump to

Keyboard shortcuts

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