crypto

package
v0.0.0-...-91e9984 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const V1 byte = 0x1

Variables

View Source
var (
	ErrDecryptionFailed         = errors.New("unable to decrypt the data")
	ErrCipherTextTooShort       = errors.New("cipher text is too short")
	ErrEncryptionKeyWrongLength = errors.New(
		"AES encryption key has a wrong length, expected 32 bytes")
)
View Source
var (
	ErrUnknownAlgorithm = errors.New("unknown algorithm")
)

Functions

func AESDecrypt

func AESDecrypt(data []byte) (string, error)

func AESEncrypt

func AESEncrypt(data string) ([]byte, error)

func NewCertificateSigningRequest

func NewCertificateSigningRequest(commonName string, key *ecdsa.PrivateKey) ([]byte, error)

func NewPrivateKey

func NewPrivateKey() (*ecdsa.PrivateKey, error)

func PrivateKeyToPem

func PrivateKeyToPem(privateKey *ecdsa.PrivateKey) []byte

func SetAESEncryptionFallbackKey

func SetAESEncryptionFallbackKey(key string) error

func SetAESEncryptionKey

func SetAESEncryptionKey(key string) error

Types

type String

type String string

func (*String) MarshalBSON

func (s *String) MarshalBSON() ([]byte, error)

func (*String) MarshalText

func (c *String) MarshalText() ([]byte, error)

func (*String) UnmarshalBSON

func (s *String) UnmarshalBSON(data []byte) error

Jump to

Keyboard shortcuts

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