Documentation ¶
Index ¶
- Constants
- func GCMDecrypt(K, IV, C, A []byte) (P, _T []byte)
- func GCMEncrypt(K, IV, P, A []byte) (C, T []byte)
- func GHASH(H []byte, A []byte, C []byte) (X []byte)
- func GetH(key []byte) (H []byte)
- func GetY0(H, IV []byte) []byte
- func MSB(len int, S []byte) (out []byte)
- func NewCipher(key []byte) (cipher.Block, error)
- func PKCS7Padding(src []byte) []byte
- func PKCS7UnPadding(src []byte) []byte
- func Rightshift(V []byte)
- func Sm4GCM(key []byte, IV, in, A []byte, mode bool) ([]byte, []byte, error)
- func WriteKeyToPem(key SM4Key, pwd []byte) ([]byte, error)
- func WriteKeyToPemFile(FileName string, key SM4Key, pwd []byte) error
- type SM4Key
- type Sm4Cipher
Constants ¶
View Source
const BlockSize = 16
Variables ¶
This section is empty.
Functions ¶
func GCMDecrypt ¶
func PKCS7Padding ¶
func PKCS7UnPadding ¶
func Rightshift ¶
func Rightshift(V []byte)
func Sm4GCM ¶
Sm4GCM SM4 GCM 加解密模式 Paper: The Galois/Counter Mode of Operation (GCM) David A. Mcgrew,John Viega .2004. key: 对称加密密钥 IV: IV向量 in: A: 附加的可鉴别数据(ADD) mode: true - 加密; false - 解密验证
return: 密文C, 鉴别标签T, 错误
func WriteKeyToPem ¶
WriteKeyToPem will convert SM4Key to PEM format data and return it.
Types ¶
type SM4Key ¶
type SM4Key []byte
func ReadKeyFromPem ¶
ReadKeyFromPem will return SM4Key from PEM format data.
Click to show internal directories.
Click to hide internal directories.