Documentation ¶
Index ¶
- Constants
- Variables
- func Decrypt(msg, nonce, pubkey, privkey []byte, algo string) ([]byte, error)
- func Encrypt(msg, nonce, pubkey, privkey []byte, algo string) ([]byte, error)
- func GenKeyPair(algo string) (common.RawBytes, common.RawBytes, error)
- func GetPubKey(privKey []byte, algo string) ([]byte, error)
- func HFMacFactory(key []byte) (func() hash.Hash, error)
- func InitMac(key []byte) (hash.Hash, error)
- func Nonce(l int) (common.RawBytes, error)
- func RandInt64() int64
- func RandUint64() uint64
- func Sign(sigInput, signKey []byte, signAlgo string) ([]byte, error)
- func Verify(sigInput, sig, verifyKey []byte, signAlgo string) error
- type Version
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 ( ErrCipherFailure common.ErrMsg = "Unable to initialize AES cipher" ErrMacFailure common.ErrMsg = "Unable to initialize Mac" )
View Source
const ( ErrInvalidNonceSize common.ErrMsg = "Invalid nonce size" ErrUnableToGenerateNonce common.ErrMsg = "Unable to generate nonce" )
Variables ¶
View Source
var ( ErrInvalidPubKeySize = serrors.New("Invalid public key size") ErrInvalidPrivKeySize = serrors.New("Invalid private key size") ErrInvalidSignatureSize = serrors.New("Invalid signature size") ErrInvalidSignatureFormat = serrors.New("Invalid signature format: sig[63]&224 should equal 0") ErrVerification = serrors.New("Signature verification failed") ErrUnableToGenerateKeyPair = serrors.New("Unable to generate key pair") ErrUnableToDecrypt = serrors.New("Unable to decrypt message") ErrUnsupportedAlgo = serrors.New("Unsupported algorithm") ErrUnsupportedSignAlgo = serrors.New("Unsupported signing algorithm") ErrUnsupportedEncAlgo = serrors.New("Unsupported encryption algorithm") )
Errors
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 RandInt64 ¶
func RandInt64() int64
RandInt64 returns a random int64 value. The returned value can be negative.
func RandUint64 ¶
func RandUint64() uint64
Types ¶
type Version ¶ added in v0.4.0
type Version uint64
Version identifies the version of a trust file. It cannot be marshalled/unmarshalled to/from LatestVer.
const LatestVer Version = 0
LatestVer is the wildcard version indicating the highest available version when requesting certificate chains and TRCs.
Click to show internal directories.
Click to hide internal directories.