rsacustom

package
v0.0.0-...-193ac27 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(priv *PrivateKey, c *big.Int) *big.Int

Decrypt decrypts the cipher text using the privatekey

func Encrypt

func Encrypt(pub *PublicKey, m *big.Int) *big.Int

Encrypt encrypts the message using the publickey

func Generate

func Generate(filename string, password string) string

Generate writes a encrypted secret key to a file, and returns a public key

func Hash

func Hash(message *big.Int) *big.Int

Hash generates a sha256 hash

func KeyGen

func KeyGen(k int) (*PublicKey, *PrivateKey, error)

KeyGen generates a publickey and a privatekey

func Sign

func Sign(filename string, password string, msg []byte) *big.Int

Sign will sign a msg, with a secret key if the password is correct.

func SignOld

func SignOld(privKey *PrivateKey, m *big.Int) (*big.Int, *big.Int)

SignOld signs messages by first hashng them and then signing

func Verify

func Verify(pub *PublicKey, signature *big.Int, hash *big.Int) bool

Verify verifies the message is from a trustworthy sender

Types

type PrivateKey

type PrivateKey struct {
	N *big.Int
	D *big.Int
}

PrivateKey consists of N and D of type big.int

type PublicKey

type PublicKey struct {
	N *big.Int
	E *big.Int
}

PublicKey consists of N and E of type big.int

Jump to

Keyboard shortcuts

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