cryptography

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(data []byte) []byte

func HashString

func HashString(data string) []byte

Types

type EllipticCurve

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

func NewEllipticCurve

func NewEllipticCurve(curve elliptic.Curve) *EllipticCurve

func (*EllipticCurve) DecodePrivate

func (ec *EllipticCurve) DecodePrivate(pemEncodedPriv string) (*ecdsa.PrivateKey, error)

func (*EllipticCurve) DecodePublic

func (ec *EllipticCurve) DecodePublic(pemEncodedPub string) (*ecdsa.PublicKey, error)

func (*EllipticCurve) EncodePrivate

func (ec *EllipticCurve) EncodePrivate(privKey *ecdsa.PrivateKey) (string, error)

func (*EllipticCurve) EncodePublic

func (ec *EllipticCurve) EncodePublic(pubKey *ecdsa.PublicKey) (string, error)

func (*EllipticCurve) GenerateKeys

func (ec *EllipticCurve) GenerateKeys() (*ecdsa.PrivateKey, *ecdsa.PublicKey, error)

func (*EllipticCurve) Sign

func (ec *EllipticCurve) Sign(hash []byte) ([]byte, error)

func (*EllipticCurve) Verify

func (ec *EllipticCurve) Verify(signature []byte, hash []byte) (bool, error)

type EncryptionHelper

type EncryptionHelper struct {
	Key []byte
}

func NewEncryptionHelper

func NewEncryptionHelper(key string) *EncryptionHelper

func (EncryptionHelper) Decrypt

func (eh EncryptionHelper) Decrypt(encryptedData []byte) ([]byte, error)

func (EncryptionHelper) DecryptString

func (eh EncryptionHelper) DecryptString(encryptedData string) ([]byte, error)

func (EncryptionHelper) Encrypt

func (eh EncryptionHelper) Encrypt(data []byte) ([]byte, error)

func (EncryptionHelper) EncryptString

func (eh EncryptionHelper) EncryptString(data string) ([]byte, error)

type IEncryptionHelper

type IEncryptionHelper interface {
	Encrypt(data []byte) ([]byte, error)
	EncryptString(data string) ([]byte, error)
	Decrypt(encryptedData []byte) ([]byte, error)
	DecryptString(encryptedData string) ([]byte, error)
}

Jump to

Keyboard shortcuts

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