Documentation ¶
Overview ¶
Package crypto contains functions to help perform hashing and simple encryption operations
Index ¶
- Variables
- func DecryptAESCBC(key []byte, in []byte) ([]byte, error)
- func ECDSADerivePublicKey(privatekey []byte) ([]byte, error)
- func ECDSAGenerateKey(curve elliptic.Curve) ([]byte, error)
- func EncryptAESCBC(key []byte, in []byte) ([]byte, error)
- func PBKDF2(password, salt []byte, iter, keylen int, hashFunc crypto.Hash) ([]byte, error)
- func RSADecrypt(key string, in []byte) ([]byte, error)
- func RSADerivePublicKey(privateKey []byte) ([]byte, error)
- func RSAEncrypt(key string, in []byte) ([]byte, error)
- func RSAGenerateKey(bits int) ([]byte, error)
- func StrToHash(hash string) (crypto.Hash, error)
Constants ¶
This section is empty.
Variables ¶
var Curves = map[string]elliptic.Curve{ "P224": elliptic.P224(), "P256": elliptic.P256(), "P384": elliptic.P384(), "P521": elliptic.P521(), }
Curves is a map of curve names to curves
Functions ¶
func DecryptAESCBC ¶ added in v3.11.0
DecryptAESCBC - use a 128, 192, or 256 bit key to decrypt the given content using AES-CBC. The output will not be encoded. Empty content will not be decrypted.
This function is compatible with Helm's encryptAES function, when the input is base64-decoded, and when the key is 256 bits long.
func ECDSADerivePublicKey ¶ added in v3.11.0
ECDSADerivePublicKey -
func ECDSAGenerateKey ¶ added in v3.11.0
ECDSAGenerateKey -
func EncryptAESCBC ¶ added in v3.11.0
EncryptAESCBC - use a 128, 192, or 256 bit key to encrypt the given content using AES-CBC. The output will not be encoded. Usually the output would be base64-encoded for display. Empty content will not be encrypted.
This function is compatible with Helm's decryptAES function, when the output is base64-encoded, and when the key is 256 bits long.
func PBKDF2 ¶
PBKDF2 - Run the Password-Based Key Derivation Function #2 as defined in RFC 8018 (PKCS #5 v2.1)
func RSADecrypt ¶ added in v3.8.0
RSADecrypt - decrypt the ciphertext with the given private key. The key must be a PEM-encoded RSA private key in PKCS#1, ASN.1 DER form, typically beginning with "RSA PRIVATE KEY". The input text must be plain ciphertext, not base64-encoded.
func RSADerivePublicKey ¶ added in v3.8.0
RSADerivePublicKey -
func RSAEncrypt ¶ added in v3.8.0
RSAEncrypt - use the given public key to encrypt the given plaintext. The key should be a PEM-encoded RSA public key in PKIX, ASN.1 DER form, typically beginning with "PUBLIC KEY". PKCS#1 format is also supported as a fallback. The output will not be encoded, so consider base64-encoding it for display.
func RSAGenerateKey ¶ added in v3.8.0
RSAGenerateKey -
Types ¶
This section is empty.