Documentation ¶
Index ¶
- func AESDecryptWithCBC(cryptStr, key []byte, iv []byte) ([]byte, error)
- func AESDecryptWithCFB(cryptStr, key []byte, iv []byte) ([]byte, error)
- func AESDecryptWithCTR(cryptedStr, key []byte, iv []byte) ([]byte, error)
- func AESDecryptWithECB(cryptStr, key []byte) ([]byte, error)
- func AESDecryptWithOFB(cipherStr []byte, key []byte, iv []byte) ([]byte, error)
- func AESEncryptWithCBC(str, key []byte, iv []byte) ([]byte, error)
- func AESEncryptWithCFB(cryptStr, key []byte, iv []byte) ([]byte, error)
- func AESEncryptWithCTR(plainStr, key []byte, iv []byte) ([]byte, error)
- func AESEncryptWithECB(str, key []byte) ([]byte, error)
- func AESEncryptWithOFB(plainStr []byte, key []byte, iv []byte) ([]byte, error)
- func DeriveKeyMySQL(key []byte, blockSize int) []byte
- func PKCS7Pad(data []byte, blockSize int) ([]byte, error)
- func PKCS7Unpad(data []byte, blockSize int) ([]byte, error)
- func SQLDecode(str string, password string) (string, error)
- func SQLEncode(cryptStr string, password string) (string, error)
- type CtrCipher
- type Reader
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AESDecryptWithCBC ¶
AESDecryptWithCBC decrypts data using AES with CBC mode.
func AESDecryptWithCFB ¶
AESDecryptWithCFB decrypts data using AES with CFB mode.
func AESDecryptWithCTR ¶
AESDecryptWithCTR decrypts data using AES with CTR mode.
func AESDecryptWithECB ¶
AESDecryptWithECB decrypts data using AES with ECB mode.
func AESDecryptWithOFB ¶
AESDecryptWithOFB decrypts data using AES with OFB mode.
func AESEncryptWithCBC ¶
AESEncryptWithCBC encrypts data using AES with CBC mode.
func AESEncryptWithCFB ¶
AESEncryptWithCFB encrypts data using AES with CFB mode.
func AESEncryptWithCTR ¶
AESEncryptWithCTR encrypts data using AES with CTR mode.
func AESEncryptWithECB ¶
AESEncryptWithECB encrypts data using AES with ECB mode.
func AESEncryptWithOFB ¶
AESEncryptWithOFB encrypts data using AES with OFB mode.
func DeriveKeyMySQL ¶
DeriveKeyMySQL derives the encryption key from a password in MySQL algorithm. See https://security.stackexchange.com/questions/4863/mysql-aes-encrypt-key-length.
func PKCS7Unpad ¶
PKCS7Unpad unpads data using PKCS7. See http://tools.ietf.org/html/rfc2315.
Types ¶
type CtrCipher ¶
type CtrCipher struct {
// contains filtered or unexported fields
}
CtrCipher encrypting data using AES in counter mode
func NewCtrCipher ¶
NewCtrCipher return a CtrCipher using the default encrypt block size
func NewCtrCipherWithBlockSize ¶
NewCtrCipherWithBlockSize return a CtrCipher with the encrypt block size
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader implements an io.ReadAt, reading from the input source after decrypting.
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer implements an io.WriteCloser, it encrypt data using AES before writing to the underlying object.
func NewWriter ¶
func NewWriter(w io.WriteCloser, ctrCipher *CtrCipher) *Writer
NewWriter returns a new Writer which encrypt data using AES before writing to the underlying object.
func (*Writer) AvailableSize ¶
AvailableSize returns how many bytes are unused in the buffer.
func (*Writer) Buffered ¶
Buffered returns the number of bytes that have been written into the current buffer.
func (*Writer) GetCacheDataOffset ¶
GetCacheDataOffset return the user data offset in cache.