algorithms

package
v1.0.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AES256CBC

type AES256CBC struct {
	Algorithm
	Block cipher.Block
}

func NewAES256CBC

func NewAES256CBC(key []byte) (*AES256CBC, error)

NewAES256CBC creates instance of AES256CBC with passed key

func (*AES256CBC) Decrypt

func (algo *AES256CBC) Decrypt(ciphertext []byte) ([]byte, error)

Decrypt decrypts data with key

func (*AES256CBC) Encrypt

func (algo *AES256CBC) Encrypt(msg []byte) ([]byte, error)

Encrypt encrypts data with key

type AES256GCM

type AES256GCM struct {
	Algorithm
	AEAD cipher.AEAD
}

func NewAES deprecated

func NewAES(key []byte) (*AES256GCM, error)

Deprecated: NewAES creates instance of AES256GCM with passed key (should be replaced with NewAES256GCM)

func NewAES256GCM

func NewAES256GCM(key []byte) (*AES256GCM, error)

NewAES256GCM creates instance of AES256GCM with passed key

func (*AES256GCM) Decrypt

func (algo *AES256GCM) Decrypt(ciphertext []byte) ([]byte, error)

Decrypt decrypts data with key

func (*AES256GCM) Encrypt

func (algo *AES256GCM) Encrypt(msg []byte) ([]byte, error)

Encrypt encrypts data with key

type Algorithm

type Algorithm interface {
	Encrypt(msg []byte) ([]byte, error)
	Decrypt(ciphertext []byte) ([]byte, error)
}

type RSA

type RSA struct {
	Algorithm
	PrivateKey *rsa.PrivateKey
	PublicKey  *rsa.PublicKey
}

func NewRSA

func NewRSA(privateKey *rsa.PrivateKey, publicKey *rsa.PublicKey) *RSA

func (*RSA) Decrypt

func (algo *RSA) Decrypt(ciphertext []byte) ([]byte, error)

Decrypt decrypts data with private key

func (*RSA) Encrypt

func (algo *RSA) Encrypt(msg []byte) ([]byte, error)

Encrypt encrypts data with public key

Jump to

Keyboard shortcuts

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