crypto

package
v0.0.0-...-e75800c Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64ToPrivateKey

func Base64ToPrivateKey(b64Key string) (*rsa.PrivateKey, error)

func Base64ToPublicKey

func Base64ToPublicKey(b64Key string) (*rsa.PublicKey, error)

func BytesToPrivateKey

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

func BytesToPublicKey

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

func DecryptWithPrivateKey

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

func EncryptWithPublicKey

func EncryptWithPublicKey(publicKey *rsa.PublicKey, text []byte) ([]byte, error)

func ExportRsaPrivateKeyAsPemStr

func ExportRsaPrivateKeyAsPemStr(privkey *rsa.PrivateKey) string

func ExportRsaPublicKeyAsPemStr

func ExportRsaPublicKeyAsPemStr(pubkey *rsa.PublicKey) string

func GenerateNonce

func GenerateNonce() (string, error)

func ParseRsaPrivateKeyFromPemStr

func ParseRsaPrivateKeyFromPemStr(privPEM string) (*rsa.PrivateKey, error)

func ParseRsaPublicKeyFromPemStr

func ParseRsaPublicKeyFromPemStr(pubPEM string) (*rsa.PublicKey, error)

func PrivateKeyToBase64

func PrivateKeyToBase64(key *rsa.PrivateKey) string

func PublicKeyToBase64

func PublicKeyToBase64(key *rsa.PublicKey) string

Types

type KeyPair

type KeyPair struct {
	PrivateKey *rsa.PrivateKey
	PublicKey  *rsa.PublicKey
}

func GenerateKeyPair

func GenerateKeyPair(bits int) *KeyPair

Jump to

Keyboard shortcuts

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