Documentation ¶
Index ¶
- func GenerateSymKey(opt crypto.KeyType, key []byte) (crypto.SymmetricKey, error)
- func PKCS5Padding(ciphertext []byte, blockSize int) []byte
- func PKCS5UnPadding(origData []byte) ([]byte, error)
- func TripleDesDec(key, src []byte) ([]byte, error)
- func TripleDesEnc(key, src []byte) ([]byte, error)
- type AESKey
- type ThirdDESKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateSymKey ¶
GenerateSymKey generates a new aes256 key or 3des key
func PKCS5Padding ¶
PKCS5Padding padding with pkcs5
func PKCS5UnPadding ¶
PKCS5UnPadding unpadding with pkcs5
func TripleDesDec ¶
TripleDesDec decryption algorithm implements
func TripleDesEnc ¶
TripleDesEnc encryption algorithm implements
Types ¶
type AESKey ¶
type AESKey struct {
// contains filtered or unexported fields
}
AES a AES instance is a tool to encrypt and decrypt
type ThirdDESKey ¶
type ThirdDESKey struct {
// contains filtered or unexported fields
}
TripleDES a 3DES instance is a tool to encrypt and decrypt Very not recommended to use 3des!!! It's slow and unsafe
func (*ThirdDESKey) Bytes ¶
func (ea *ThirdDESKey) Bytes() ([]byte, error)
func (*ThirdDESKey) Decrypt ¶
func (ea *ThirdDESKey) Decrypt(cipherTex []byte) (plaintext []byte, err error)
Decrypt decrypt
func (*ThirdDESKey) Encrypt ¶
func (ea *ThirdDESKey) Encrypt(plain []byte) (cipher []byte, err error)
Encrypt encrypt
func (*ThirdDESKey) Type ¶
func (ea *ThirdDESKey) Type() crypto.KeyType
Click to show internal directories.
Click to hide internal directories.