Documentation ¶
Index ¶
- Constants
- func DecodeData(privateKey []byte, data []byte, pkc ...int) ([]byte, error)
- func DecodePrivateKey(privateKey []byte, pkc ...int) (*rsa.PrivateKey, error)
- func Decrypt(privateKey []byte, data []byte, pkc ...int) ([]byte, error)
- func DecryptNoPadding(privateKey *rsa.PrivateKey, data []byte) []byte
- func EncodeData(publickey []byte, data []byte, elen ...int) ([]byte, error)
- func Encrypt(publickey []byte, data []byte) ([]byte, error)
- func EncryptNoPadding(publickey []byte, data []byte) ([]byte, error)
- func GenRsaKey(bits int, pkc ...int) ([]byte, []byte, error)
- func SignSHA1(privateKey []byte, data []byte, pkc ...int) ([]byte, error)
- func SignSHA512(privateKey []byte, data []byte, pkc ...int) ([]byte, error)
- func VerifySHA1(publickey []byte, data []byte, vStr []byte) (bool, error)
- func VerifySHA512(publickey []byte, data []byte, vStr []byte) (bool, error)
Constants ¶
View Source
const ( PKCS1 int = iota PKCS8 )
Variables ¶
This section is empty.
Functions ¶
func DecodeData ¶
DecodeData 解密
@param []byte => privateKey 私钥 @param []byte => data 要解密的数据,如果数据进行过任何编码的请先解码 @param ...int => pkc 私钥的编码方式 pkcs1 pkcs8 @return []byte 解密内容 error 错误信息
func DecodePrivateKey ¶
func DecodePrivateKey(privateKey []byte, pkc ...int) (*rsa.PrivateKey, error)
DecodePrivateKey 解析私钥
func DecryptNoPadding ¶
func DecryptNoPadding(privateKey *rsa.PrivateKey, data []byte) []byte
DecryptNoPadding NO_PADDING模式解密
func EncodeData ¶
EncodeData 加密,数据如果过长将使用分段加密
@param []byte => publickey 公钥数据 @param []byte => data 需要加密的内容 @param ...int => elen 数据分段加密长度,如果为空将按照密钥的能加密的最大长度分段 @return []byte 加密结果 error 错误信息
func EncryptNoPadding ¶
EncryptNoPadding 无填充模式加密
func SignSHA512 ¶
SignSHA512 RSA签名 SHA512withRSA
func VerifySHA1 ¶
VerifySHA1 RSA验证签名 SHA1withRSA
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.