Documentation
¶
Index ¶
- Variables
- func AesDecrypt(ciphertext []byte, key []byte) ([]byte, error)
- func AesDecrypt64(encodedCiphertext string, key []byte) ([]byte, error)
- func AesEncrypt(plaintext []byte, key []byte) ([]byte, error)
- func AesEncrypt64(plaintext []byte, key []byte) (string, error)
- func AesGCMDecrypt(ciphertext []byte, key []byte) ([]byte, error)
- func AesGCMDecrypt64(encodedCiphertext string, key []byte) ([]byte, error)
- func AesGCMEncrypt(plaintext []byte, key []byte) ([]byte, error)
- func AesGCMEncrypt64(plaintext []byte, key []byte) (string, error)
- func ComparePassword(hashedPassword, password string) bool
- func HashPassword(ctx context.Context, password string) (string, error)
- func PKCS7Padding(ciphertext []byte, blockSize int) []byte
- func PKCS7UnPadding(origData []byte) []byte
- func PKCS7UnPaddingE(origData []byte) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
var (
ErrInvalidPadding = errors.New("invalid PKCS7 padding")
)
Functions ¶
func AesDecrypt ¶
AesDecrypt decrypts AES-CFB ciphertext produced by AesEncrypt.
func AesDecrypt64 ¶
AesDecrypt64 - AES Decrypt base64
func AesEncrypt ¶
AesEncrypt encrypts plaintext with AES-CFB. Prefer AesGCMEncrypt for new code because CFB does not authenticate ciphertext integrity.
func AesEncrypt64 ¶
AesEncrypt64 - AES Encrypt base64
func AesGCMDecrypt ¶ added in v0.2.5
AesGCMDecrypt decrypts and authenticates data produced by AesGCMEncrypt.
func AesGCMDecrypt64 ¶ added in v0.2.5
AesGCMDecrypt64 decrypts base64 data produced by AesGCMEncrypt64.
func AesGCMEncrypt ¶ added in v0.2.5
AesGCMEncrypt encrypts and authenticates plaintext with AES-GCM. The returned byte slice is nonce || ciphertext || tag.
func AesGCMEncrypt64 ¶ added in v0.2.5
AesGCMEncrypt64 encrypts and authenticates plaintext, returning base64 data.
func ComparePassword ¶
ComparePassword compares the hashed password with the provided password.
func HashPassword ¶
HashPassword hashes the provided password using bcrypt.
func PKCS7Padding ¶
PKCS7Padding - PKCS7 padding
func PKCS7UnPaddingE ¶ added in v0.2.5
PKCS7UnPaddingE removes PKCS7 padding and validates the padding bytes.
Types ¶
This section is empty.