Documentation ¶
Index ¶
- Constants
- func Decrypt(msg, nonce, pubkey, privkey common.RawBytes, algo string) (common.RawBytes, error)
- func Encrypt(msg, nonce, pubkey, privkey common.RawBytes, algo string) (common.RawBytes, error)
- func GenKeyPair(algo string) (common.RawBytes, common.RawBytes, error)
- func InitMac(key common.RawBytes) (hash.Hash, error)
- func Mac(mac hash.Hash, msg common.RawBytes) (common.RawBytes, error)
- func MathRandSeed()
- func Nonce(l int) (common.RawBytes, error)
- func RandInt64() int64
- func RandUint64() uint64
- func Sign(sigInput, signKey common.RawBytes, signAlgo string) (common.RawBytes, error)
- func Verify(sigInput, sig, verifyKey common.RawBytes, signAlgo string) error
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 Encrypt ¶
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 ¶
GenKeyPair generates a public/private key pair.
func MathRandSeed ¶
func MathRandSeed()
Seed math/rand's default generator with a random value, once.
func RandInt64 ¶
func RandInt64() int64
RandInt64 returns a random int64 value. The returned value can be negative.
func RandUint64 ¶
func RandUint64() uint64
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.