scrypto

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ed25519                    = "ed25519"
	Curve25519xSalsa20Poly1305 = "curve25519xsalsa20poly1305"
)

Available asymmetric crypto algorithms. The values must be lower case.

View Source
const (
	NaClBoxNonceSize = 24
	NaClBoxKeySize   = 32
)

Constants for nacl/box implementation of Curve25519xSalsa20Poly1305

View Source
const (
	InvalidPubKeySize       = "Invalid public key size"
	InvalidPrivKeySize      = "Invalid private key size"
	InvalidSignature        = "Invalid signature"
	UnableToGenerateKeyPair = "Unable to generate key pair"
	UnableToDecrypt         = "Unable to decrypt message"
	UnsupportedAlgo         = "Unsupported algorithm"
	UnsupportedSignAlgo     = "Unsupported signing algorithm"
	UnsupportedEncAlgo      = "Unsupported encryption algorithm"
)
View Source
const (
	ErrorCipherFailure = "Unable to initalize AES cipher"
	ErrorMacFailure    = "Unable to initalize Mac"
)
View Source
const (
	InvalidNonceSize      = "Invalid nonce size"
	UnableToGenerateNonce = "Unable to generate nonce"
)
View Source
const LatestVer uint64 = 0

LatestVer is the wildcard version indicating the highest available version when requesting certificate chains and TRCs.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(msg, nonce, pubkey, privkey common.RawBytes, algo string) (common.RawBytes, error)

Decrypt decrypts a message for a given nonce and public/private keypair.

func Encrypt

func Encrypt(msg, nonce, pubkey, privkey common.RawBytes, algo string) (common.RawBytes, error)

Encrypt takes a message, a nonce and a public/private keypair and returns the encrypted and authenticated message. Note: Nonce must be different for each message that is encrypted with the same key.

func GenKeyPair

func GenKeyPair(algo string) (common.RawBytes, common.RawBytes, error)

GenKeyPair generates a public/private key pair.

func InitMac

func InitMac(key common.RawBytes) (hash.Hash, error)

func Mac

func Mac(mac hash.Hash, msg common.RawBytes) (common.RawBytes, error)

func MathRandSeed

func MathRandSeed()

Seed math/rand's default generator with a random value, once.

func Nonce

func Nonce(l int) (common.RawBytes, error)

Nonce takes an input length and returns a random nonce of the given length.

func RandInt64

func RandInt64() int64

RandInt64 returns a random int64 value. The returned value can be negative.

func RandUint64

func RandUint64() uint64

func Sign

func Sign(sigInput, signKey common.RawBytes, signAlgo string) (common.RawBytes, error)

Sign takes a signature input and a signing key to create a signature. Currently only ed25519 is supported.

func Verify

func Verify(sigInput, sig, verifyKey common.RawBytes, signAlgo string) error

Verify takes a signature input and a verifying key and returns an error, if the signature does not match. Currently only ed25519 is supported.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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