Documentation ¶
Index ¶
- Constants
- func CBCDecrypt(key, iv, cipherText []byte) (plainText []byte, err error)
- func CBCEncrypt(key, iv, plainText []byte) (cipherText []byte, err error)
- func ECBDecrypt(key, cipherText []byte) (plainText []byte, err error)
- func ECBEncrypt(key, plainText []byte) (cipherText []byte, err error)
- func NewCipher(key []byte) (cipher.Block, error)
- type KeySizeError
Constants ¶
View Source
const ( BlockSize = 16 KeySize = 16 )
Variables ¶
This section is empty.
Functions ¶
func CBCDecrypt ¶
输出的plainText是加padding的明文,调用方需要自己去padding, 可调用util.PKCS5UnPadding()方法进行去padding操作
func CBCEncrypt ¶
输入的plainText长度必须是BlockSize(16)的整数倍,也就是调用该方法前调用方需先加好padding, 可调用util.PKCS5Padding()方法进行加padding操作
func ECBDecrypt ¶
输出的plainText是加padding的明文,调用方需要自己去padding, 可调用util.PKCS5UnPadding()方法进行去padding操作
func ECBEncrypt ¶
输入的plainText长度必须是BlockSize(16)的整数倍,也就是调用该方法前调用方需先加好padding, 可调用util.PKCS5Padding()方法进行加padding操作
Types ¶
type KeySizeError ¶
type KeySizeError int
func (KeySizeError) Error ¶
func (k KeySizeError) Error() string
Click to show internal directories.
Click to hide internal directories.