Documentation ¶
Index ¶
- Variables
- func AesCBCDecrypt(encrypted, aesKey, iv []byte, padding PaddingT) ([]byte, error)
- func AesCBCEncrypt(decrypted, aesKey, iv []byte, padding PaddingT) ([]byte, error)
- func AesCFBDecrypt(encrypted, aesKey, iv []byte) ([]byte, error)
- func AesCFBEncrypt(decrypted, aesKey, iv []byte) ([]byte, error)
- func AesCTRDecrypt(decrypted, aesKey, iv []byte) ([]byte, error)
- func AesCTREncrypt(decrypted, aesKey, iv []byte) ([]byte, error)
- func AesECBDecrypt(encrypted, aesKey []byte, padding PaddingT) ([]byte, error)
- func AesECBEncrypt(decrypted, aesKey []byte, padding PaddingT) ([]byte, error)
- func AesOFBDecrypt(encrypted, aesKey, iv []byte) ([]byte, error)
- func AesOFBEncrypt(encrypted, aesKey, iv []byte) ([]byte, error)
- func CBCDecrypt(block cipher.Block, src, iv []byte, padding PaddingT) ([]byte, error)
- func CBCEncrypt(block cipher.Block, src, iv []byte, padding PaddingT) ([]byte, error)
- func CFBDecrypt(block cipher.Block, src, iv []byte) ([]byte, error)
- func CFBEncrypt(block cipher.Block, src, iv []byte) ([]byte, error)
- func CTRCrypto(block cipher.Block, src, iv []byte) ([]byte, error)
- func Des3CBCDecrypt(encrypted, desKey, iv []byte, padding PaddingT) ([]byte, error)
- func Des3CBCEncrypt(decrypted, desKey, iv []byte, padding PaddingT) ([]byte, error)
- func Des3CFBDecrypt(encrypted, desKey, iv []byte) ([]byte, error)
- func Des3CFBEncrypt(decrypted, desKey, iv []byte) ([]byte, error)
- func Des3CTRDecrypt(encrypted, desKey, iv []byte) ([]byte, error)
- func Des3CTREncrypt(decrypted, desKey, iv []byte) ([]byte, error)
- func Des3ECBDecrypt(encrypted, desKey []byte, padding PaddingT) ([]byte, error)
- func Des3ECBEncrypt(decrypted, desKey []byte, padding PaddingT) ([]byte, error)
- func Des3OFBDecrypt(encrypted, desKey, iv []byte) ([]byte, error)
- func Des3OFBEncrypt(decrypted, desKey, iv []byte) ([]byte, error)
- func DesCBCDecrypt(encrypted []byte, desKey, iv []byte, padding PaddingT) ([]byte, error)
- func DesCBCEncrypt(decrypted []byte, desKey, iv []byte, padding PaddingT) ([]byte, error)
- func DesCFBDecrypt(encrypted, desKey, iv []byte) ([]byte, error)
- func DesCFBEncrypt(decrypted, desKey, iv []byte) ([]byte, error)
- func DesCTRDecrypt(encrypted, desKey, iv []byte) ([]byte, error)
- func DesCTREncrypt(decrypted, desKey, iv []byte) ([]byte, error)
- func DesECBDecrypt(encrypted, desKey []byte, padding PaddingT) ([]byte, error)
- func DesECBEncrypt(decrypted, desKey []byte, padding PaddingT) ([]byte, error)
- func DesOFBDecrypt(encrypted, desKey, iv []byte) ([]byte, error)
- func DesOFBEncrypt(decrypted, desKey, iv []byte) ([]byte, error)
- func ECBDecrypt(block cipher.Block, src []byte, padding PaddingT) ([]byte, error)
- func ECBEncrypt(block cipher.Block, src []byte, padding PaddingT) ([]byte, error)
- func GenRsaKey(priWriter, pubWriter io.Writer, bits int) error
- func GenRsaPKCS8Key(bits int) (string, string, error)
- func GenRsaPriKey(priKey []byte) (*rsa.PrivateKey, error)
- func GenRsaPubKey(pubKey []byte) (*rsa.PublicKey, error)
- func NewCBCDecrypter(b cipher.Block) cipher.BlockMode
- func NewECBEncrypter(b cipher.Block) cipher.BlockMode
- func OFBCrypto(block cipher.Block, src, iv []byte) ([]byte, error)
- func PKCS5Padding(src []byte, blockSize int) []byte
- func PKCS5UnPadding(src []byte) ([]byte, error)
- func PKCS7Padding(src []byte, blockSize int) []byte
- func PKCS7UnPadding(src []byte) ([]byte, error)
- func Padding(padding PaddingT, src []byte, blockSize int) []byte
- func RsaDecrypt(encrypted, priKey []byte) ([]byte, error)
- func RsaEncrypt(decrypted, puKey []byte) ([]byte, error)
- func RsaSign(src []byte, priKey *rsa.PrivateKey, hash crypto.Hash) ([]byte, error)
- func RsaVerify(src, sign []byte, pubKey *rsa.PublicKey, hash crypto.Hash) error
- func UnPadding(padding PaddingT, src []byte) ([]byte, error)
- func ZerosPadding(src []byte, blockSize int) []byte
- func ZerosUnPadding(src []byte) ([]byte, error)
- type PaddingT
Constants ¶
This section is empty.
Variables ¶
var ErrorUnPadding = errors.New("UnPadding error")
Functions ¶
func AesCBCDecrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * -aesKey must 16,24 or 32 bytes. * HISTORY: * -create: 2021/12/15 10:20:44 ColeCai. * -update: 2021/12/16 11:26:42 ColeCai. decrypt with customize iv. * -update: 2021/12/16 14:37:58 ColeCai. decrypt with customize padding type. * -update: 2021/12/16 15:41:37 ColeCai. make cbc as public module. ***********************************************************************************************
func AesCBCEncrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * -aesKey must 16,24 or 32 bytes. * HISTORY: * -create: 2021/12/15 10:20:44 ColeCai. * -update: 2021/12/16 11:25:32 ColeCai. encrypt with customize iv. * -update: 2021/12/16 14:37:20 ColeCai. encrypt with customize padding type. * -update: 2021/12/16 15:40:49 ColeCai. make cbc as public module. ***********************************************************************************************
func AesCFBDecrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/20 10:13:11 ColeCai. ***********************************************************************************************
func AesCFBEncrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/20 10:11:36 ColeCai. ***********************************************************************************************
func AesCTRDecrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/22 11:10:52 ColeCai. ***********************************************************************************************
func AesCTREncrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/22 11:10:11 ColeCai. ***********************************************************************************************
func AesECBDecrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/17 10:04:06 ColeCai. ***********************************************************************************************
func AesECBEncrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/17 10:02:44 ColeCai. ***********************************************************************************************
func AesOFBDecrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/22 10:44:57 ColeCai. ***********************************************************************************************
func AesOFBEncrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/22 10:44:05 ColeCai. ***********************************************************************************************
func CBCDecrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/16 15:37:11 ColeCai. ***********************************************************************************************
func CBCEncrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/16 15:35:25 ColeCai. ***********************************************************************************************
func CFBDecrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/16 15:55:35 ColeCai. ***********************************************************************************************
func CFBEncrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/16 15:43:59 ColeCai. ***********************************************************************************************
func CTRCrypto ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/16 16:45:02 ColeCai. ***********************************************************************************************
func Des3CBCDecrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * -deskey must 24 bytes, iv must 8 bytes. * HISTORY: * -create: 2022/12/31 10:14:23 ColeCai. ***********************************************************************************************
func Des3CBCEncrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * -deskey must 24 bytes, iv must 8 bytes. * HISTORY: * -create: 2022/12/31 10:13:17 ColeCai. ***********************************************************************************************
func Des3CFBDecrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * -deskey must 24 bytes, iv must 8 bytes. * HISTORY: * -create: 2022/01/06 15:21:27 ColeCai. ***********************************************************************************************
func Des3CFBEncrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * -deskey must 24 bytes, iv must 8 bytes. * HISTORY: * -create: 2022/01/06 15:20:18 ColeCai. ***********************************************************************************************
func Des3CTRDecrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2022/01/12 09:53:04 ColeCai. ***********************************************************************************************
func Des3CTREncrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2022/01/12 09:52:15 ColeCai. ***********************************************************************************************
func Des3ECBDecrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * -deskey must 24 bytes, iv must 8 bytes. * HISTORY: * -create: 2022/01/04 10:22:47 ColeCai. ***********************************************************************************************
func Des3ECBEncrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * -deskey must 24 bytes, iv must 8 bytes. * HISTORY: * -create: 2022/01/04 10:20:50 ColeCai. ***********************************************************************************************
func Des3OFBDecrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2022/01/10 09:59:09 ColeCai. ***********************************************************************************************
func Des3OFBEncrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2022/01/10 09:58:15 ColeCai. ***********************************************************************************************
func DesCBCDecrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * -deskey and iv length must equal 8. if not DesCBCDecrypt will panic. * HISTORY: * -create: 2021/12/23 10:09:12 ColeCai. ***********************************************************************************************
func DesCBCEncrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * -deskey and iv length must equal 8. if not DesCBCEncrypt will panic. * HISTORY: * -create: 2021/12/23 10:06:54 ColeCai. ***********************************************************************************************
func DesCFBDecrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * -deskey length must equal 8. if not DesCFBDecrypt will panic. * HISTORY: * -create: 2021/12/25 15:05:28 ColeCai. ***********************************************************************************************
func DesCFBEncrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * -deskey length must equal 8. if not DesCFBEncrypt will panic. * HISTORY: * -create: 2021/12/25 15:04:28 ColeCai. ***********************************************************************************************
func DesCTRDecrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * -deskey length must equal 8. if not DesCTRDecrypt will panic. * HISTORY: * -create: 2022/12/28 11:48:56 ColeCai. ***********************************************************************************************
func DesCTREncrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * -deskey length must equal 8. if not DesCTREncrypt will panic. * HISTORY: * -create: 2022/12/28 11:48:04 ColeCai. ***********************************************************************************************
func DesECBDecrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * -deskey length must equal 8. if not DesECBDecrypt will panic. * HISTORY: * -create: 2021/12/24 10:18:16 ColeCai. ***********************************************************************************************
func DesECBEncrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * -deskey length must equal 8. if not DesECBEncrypt will panic. * HISTORY: * -create: 2021/12/24 10:15:55 ColeCai. ***********************************************************************************************
func DesOFBDecrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * -deskey length must equal 8. if not DesOFBDecrypt will panic. * HISTORY: * -create: 2022/12/27 09:40:51 ColeCai. ***********************************************************************************************
func DesOFBEncrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * -deskey length must equal 8. if not DesOFBEncrypt will panic. * HISTORY: * -create: 2022/12/27 09:39:58 ColeCai. ***********************************************************************************************
func ECBDecrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/16 15:15:29 ColeCai. ***********************************************************************************************
func ECBEncrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/16 15:13:15 ColeCai. ***********************************************************************************************
func GenRsaKey ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/01/17 10:14:13 ColeCai. ***********************************************************************************************
func GenRsaPKCS8Key ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2022/01/17 12:17:34 ColeCai. ***********************************************************************************************
func GenRsaPriKey ¶
func GenRsaPriKey(priKey []byte) (*rsa.PrivateKey, error)
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2022/01/17 11:34:20 ColeCai. ***********************************************************************************************
func GenRsaPubKey ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2022/01/17 11:36:57 ColeCai. ***********************************************************************************************
func NewCBCDecrypter ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/16 15:09:10 ColeCai. ***********************************************************************************************
func NewECBEncrypter ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/16 15:04:30 ColeCai. ***********************************************************************************************
func OFBCrypto ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/16 16:37:58 ColeCai. ***********************************************************************************************
func PKCS5Padding ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/16 14:18:57 ColeCai. ***********************************************************************************************
func PKCS5UnPadding ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/16 14:24:40 ColeCai. ***********************************************************************************************
func PKCS7Padding ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/15 10:20:44 ColeCai. ***********************************************************************************************
func PKCS7UnPadding ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/15 10:20:44 ColeCai. * -update: 2021/12/16 14:22:35 ColeCai. verify src and unPadding length. ***********************************************************************************************
func Padding ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/16 14:31:43 ColeCai. ***********************************************************************************************
func RsaDecrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/01/17 10:10:47 ColeCai. ***********************************************************************************************
func RsaEncrypt ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/01/17 10:07:01 ColeCai. ***********************************************************************************************
func RsaSign ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2022/01/17 11:21:34 ColeCai. ***********************************************************************************************
func RsaVerify ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2022/01/17 11:28:27 ColeCai. ***********************************************************************************************
func UnPadding ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/16 14:33:24 ColeCai. ***********************************************************************************************
func ZerosPadding ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/16 14:26:36 ColeCai. ***********************************************************************************************
func ZerosUnPadding ¶
*********************************************************************************************** * SUMMARY: * WARNING: * HISTORY: * -create: 2021/12/16 14:28:31 ColeCai. ***********************************************************************************************