crypto

package
v0.0.0-...-f23cd05 Latest Latest
Warning

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

Go to latest
Published: May 2, 2019 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// Note that this is the default public exponent set by Golang in rsa.go
	// See https://github.com/golang/go/blob/6269dcdc24d74379d8a609ce886149811020b2cc/src/crypto/rsa/rsa.go#L226
	COMM_PUBLIC_EXPONENT = 65537
	COMM_KEY_BITS        = 2048
	COMM_PROOF_LENGTH    = 256
	COMM_KEY_LENGTH      = 256
	COMM_NOF_PRIMES      = 2
)

Variables

This section is empty.

Functions

func CreateECDSAKeyFile

func CreateECDSAKeyFile(filename string) (err error)

func CreateRSAKeyFile

func CreateRSAKeyFile(filename string) error

Creates an RSA key file with the following lines 1 Public Modulus N 2 Private Exponent D 3+ Private Primes (depending on COMM_NOF_PRIMES)

func CreateRSAPrivKeyFromBase64

func CreateRSAPrivKeyFromBase64(strModulus string, strPrivExponent string, strPrimes []string) (privKey *rsa.PrivateKey, err error)

func CreateRSAPubKeyFromBytes

func CreateRSAPubKeyFromBytes(bytModulus [COMM_KEY_LENGTH]byte) (pubKey *rsa.PublicKey, err error)

func ExtractECDSAKeyFromFile

func ExtractECDSAKeyFromFile(filename string) (privKey *ecdsa.PrivateKey, err error)

func ExtractECDSAPublicKeyFromFile

func ExtractECDSAPublicKeyFromFile(filename string) (pubKey *ecdsa.PublicKey, err error)

func ExtractRSAKeyFromFile

func ExtractRSAKeyFromFile(filename string) (privKey *rsa.PrivateKey, err error)

func GetAddressFromPubKey

func GetAddressFromPubKey(pubKey *ecdsa.PublicKey) (address [64]byte)

func GetPubKeyFromString

func GetPubKeyFromString(pub1, pub2 string) (pubKey *ecdsa.PublicKey, err error)

func ReadFile

func ReadFile(filename string) (lines []string)

func SignMessageWithRSAKey

func SignMessageWithRSAKey(privKey *rsa.PrivateKey, msg string) (fixedSig [COMM_PROOF_LENGTH]byte, err error)

func VerifyECDSAKey

func VerifyECDSAKey(privKey *ecdsa.PrivateKey) error

func VerifyMessageWithRSAKey

func VerifyMessageWithRSAKey(pubKey *rsa.PublicKey, msg string, fixedSig [COMM_PROOF_LENGTH]byte) (err error)

func VerifyRSAKey

func VerifyRSAKey(privKey *rsa.PrivateKey) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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