Documentation ¶
Overview ¶
Package cryptoutil contains generic & stateless crypto helpers.
Index ¶
- Constants
- func AESCTRStream(key, iv []byte) (cipher.Stream, error)
- func AESGCMDecrypt(key, data []byte) ([]byte, error)
- func AESGCMEncrypt(key, data []byte) ([]byte, error)
- func ConcatAndHashSha256(slices ...[]byte) *[sha256.Size]byte
- func DeriveKey(passphrase, salt []byte) ([]byte, []byte, error)
- func EdwardsToMontgomery(privKey crypto.PrivKey, pubKey crypto.PubKey) (*[32]byte, *[32]byte, error)
- func EdwardsToMontgomeryPriv(privKey crypto.PrivKey) (*[KeySize]byte, error)
- func EdwardsToMontgomeryPub(pubKey crypto.PubKey) (*[KeySize]byte, error)
- func GenerateNonce() (*[NonceSize]byte, error)
- func GenerateNonceSize(size int) ([]byte, error)
- func KeySliceToArray(keySlice []byte) (*[KeySize]byte, error)
- func NonceSliceToArray(nonceSlice []byte) (*[NonceSize]byte, error)
- func SeedFromEd25519PrivateKey(key crypto.PrivKey) ([]byte, error)
Constants ¶
const ( KeySize = 32 // Key size required by box NonceSize = 24 // Nonce size required by box ScryptIterations = 1 << 15 ScryptR = 8 ScryptP = 1 ScryptKeyLen = 32 )
Variables ¶
This section is empty.
Functions ¶
func AESCTRStream ¶ added in v2.231.0
AESCTRStream returns a CTR stream that can be used to produce ciphertext without padding.
func AESGCMDecrypt ¶ added in v2.231.0
AESGCMDecrypt uses AES+GCM to decrypt plaintext data.
func AESGCMEncrypt ¶ added in v2.231.0
AESGCMEncrypt use AES+GCM to encrypt plaintext data.
The generated output will be longer than the original plaintext input.
func ConcatAndHashSha256 ¶ added in v2.33.0
func DeriveKey ¶ added in v2.231.0
DeriveKey takes a passphrase of any length and returns a key of fixed size.
If no salt is provided, a new one will be created and returned.
func EdwardsToMontgomery ¶
func EdwardsToMontgomery(privKey crypto.PrivKey, pubKey crypto.PubKey) (*[32]byte, *[32]byte, error)
EdwardsToMontgomery converts ed25519 priv/pub keys to X25519 keys.
func EdwardsToMontgomeryPriv ¶ added in v2.33.0
EdwardsToMontgomeryPriv converts ed25519 priv key to X25519 priv key.
func EdwardsToMontgomeryPub ¶ added in v2.33.0
EdwardsToMontgomeryPub converts ed25519 pub key to X25519 pub key.
func GenerateNonce ¶ added in v2.33.0
func GenerateNonceSize ¶ added in v2.231.0
func KeySliceToArray ¶ added in v2.33.0
func NonceSliceToArray ¶ added in v2.33.0
Types ¶
This section is empty.