crypto

package
v0.0.0-...-9e6d8ee Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: MIT Imports: 20 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteCountIEC

func ByteCountIEC(b int64) string

ByteCountIEC -

func ByteCountSI

func ByteCountSI(b int64) string

ByteCountSI -

func BytesToPrivateKey

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

BytesToPrivateKey bytes to private key

func BytesToPublicKey

func BytesToPublicKey(pub []byte) *rsa.PublicKey

BytesToPublicKey bytes to public key

func CreateHash

func CreateHash(key string) string

CreateHash -

func CreateHashByte

func CreateHashByte(key []byte) string

CreateHashByte -

func Decrypt

func Decrypt(data []byte, passphrase string) []byte

Decrypt -

func DecryptWithPrivateKey

func DecryptWithPrivateKey(ciphertext []byte, priv *rsa.PrivateKey) []byte

DecryptWithPrivateKey decrypts data with private key

func Encrypt

func Encrypt(data []byte, passphrase string) []byte

Encrypt -

func EncryptWithPublicKey

func EncryptWithPublicKey(msg []byte, pub *rsa.PublicKey) []byte

EncryptWithPublicKey -

func GenerateKeyPair

func GenerateKeyPair(bits int) (*rsa.PrivateKey, *rsa.PublicKey)

GenerateKeyPair generates a new key pair

func GenerateUUID

func GenerateUUID() string

GenerateUUID -

func PrivateKeyToBytes

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

PrivateKeyToBytes private key to bytes

func PublicKeyToBytes

func PublicKeyToBytes(pub *rsa.PublicKey) []byte

PublicKeyToBytes public key to bytes

Types

type Certificate

type Certificate struct {
	CACert     []byte
	CAKey      []byte
	ServerCert []byte
	ServerKey  []byte
}

Certificate -

func GenerateCA

func GenerateCA(keySize int) (cert Certificate, err error)

GenerateCA -

func GenerateCert

func GenerateCert(keySize int, domain []string, alips []string) (cert Certificate, err error)

GenerateCert -

Jump to

Keyboard shortcuts

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