crypto

package
v0.0.0-...-bb6ce45 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBits2048 = 2048
)

Variables

This section is empty.

Functions

func BytesToEcdsaPrivateKey

func BytesToEcdsaPrivateKey(priv []byte) (*ecdsa.PrivateKey, error)

BytesToEcdsaPrivateKey bytes to private key

func BytesToEcdsaPublicKey

func BytesToEcdsaPublicKey(pub []byte) (*ecdsa.PublicKey, error)

BytesToEcdsaPublicKey bytes to public key

func BytesToEd25519PrivateKey

func BytesToEd25519PrivateKey(priv []byte) (*ed25519.PrivateKey, error)

BytesToEd25519PrivateKey bytes to private key

func BytesToEd25519PublicKey

func BytesToEd25519PublicKey(pub []byte) (*ed25519.PublicKey, error)

BytesToEd25519PublicKey bytes to public key

func BytesToRsaPrivateKey

func BytesToRsaPrivateKey(priv []byte) (*rsa.PrivateKey, error)

BytesToRsaPrivateKey bytes to private key

func BytesToRsaPublicKey

func BytesToRsaPublicKey(pub []byte) (*rsa.PublicKey, error)

BytesToRsaPublicKey bytes to public key

func DecryptWithKms

func DecryptWithKms(ctx context.Context,
	data []byte, project, location, keyring, key string) ([]byte, error)

DecryptWithKms decrypts input data using Google KMS. You must have a service account referenced by env. var. GOOGLE_APPLICATION_CREDENTIALS

func EcdsaPrivateKeyToBytes

func EcdsaPrivateKeyToBytes(priv *ecdsa.PrivateKey) ([]byte, error)

EcdsaPrivateKeyToBytes private key to bytes

func EcdsaPublicKeyToBytes

func EcdsaPublicKeyToBytes(pub *ecdsa.PublicKey) ([]byte, error)

EcdsaPublicKeyToBytes public key to bytes

func Ed25519PrivateKeyToBytes

func Ed25519PrivateKeyToBytes(priv *ed25519.PrivateKey) ([]byte, error)

Ed25519PrivateKeyToBytes private key to bytes

func Ed25519PublicKeyToBytes

func Ed25519PublicKeyToBytes(pub *ed25519.PublicKey) ([]byte, error)

Ed25519PublicKeyToBytes public key to bytes

func EncryptWithKms

func EncryptWithKms(ctx context.Context,
	data []byte, project, location, keyring, key string) ([]byte, error)

EncryptWithKms encrypts input data using Google KMS. You must have a service account referenced by env. var. GOOGLE_APPLICATION_CREDENTIALS

func NewAesKey

func NewAesKey() ([]byte, error)

NewAesKey generates new AES key

func NewEcdsaKeyPair

func NewEcdsaKeyPair(pubkeyCurve elliptic.Curve) (*ecdsa.PrivateKey, *ecdsa.PublicKey, error)

NewEcdsaKeyPair generates a new ECDSA key pair

func NewEd25519KeyPair

func NewEd25519KeyPair() (*ed25519.PrivateKey, *ed25519.PublicKey, error)

NewEd25519KeyPair generates a new Ed25519 key pair

func NewRsaKeyPair

func NewRsaKeyPair(bits int) (*rsa.PrivateKey, *rsa.PublicKey, error)

NewRsaKeyPair generates a new RSA key pair

func RsaPrivateKeyToBytes

func RsaPrivateKeyToBytes(priv *rsa.PrivateKey) []byte

RsaPrivateKeyToBytes private key to bytes

func RsaPublicKeyToBytes

func RsaPublicKeyToBytes(pub *rsa.PublicKey) ([]byte, error)

RsaPublicKeyToBytes public key to bytes

Types

This section is empty.

Jump to

Keyboard shortcuts

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