Documentation ¶
Index ¶
- Constants
- func AesDecrypt(crypted, key []byte) (original []byte, err error)
- func AesEncrypt(origData, key []byte) (crypted []byte, err error)
- func DesDecrypt(crypted, key []byte) ([]byte, error)
- func DesEncrypt(origData, key []byte) ([]byte, error)
- func GenKeyPair(bits, format int, priv, pub io.Writer) error
- func GetPrivKey(privKey []byte, format int) (priv *rsa.PrivateKey, err error)
- func GetPubKey(pubKey []byte) (pub *rsa.PublicKey, err error)
- func MarshalPKCS8PrivateKey(key *rsa.PrivateKey) ([]byte, error)
- func RsaDecrypt(ciphertext, privKey []byte, privKeyFormat int) ([]byte, error)
- func RsaDecryptPublic(origData []byte, pubKey *rsa.PublicKey) ([]byte, error)
- func RsaEncrypt(origData, pubKey []byte) ([]byte, error)
- func RsaEncryptPrivate(origData []byte, privKey *rsa.PrivateKey) ([]byte, error)
- func Sign(privKey []byte, hash crypto.Hash, hashed []byte, privKeyFormat int) ([]byte, error)
- func Verify(pubKey []byte, hash crypto.Hash, hashed, signature []byte) error
Constants ¶
View Source
const ( PKCS1 = iota PKCS8 )
Variables ¶
This section is empty.
Functions ¶
func AesDecrypt ¶
func AesEncrypt ¶
func DesDecrypt ¶
func DesEncrypt ¶
func GetPrivKey ¶
func GetPrivKey(privKey []byte, format int) (priv *rsa.PrivateKey, err error)
func MarshalPKCS8PrivateKey ¶
func MarshalPKCS8PrivateKey(key *rsa.PrivateKey) ([]byte, error)
PKCS8 私钥
func RsaDecryptPublic ¶
公钥解密
func RsaEncryptPrivate ¶
func RsaEncryptPrivate(origData []byte, privKey *rsa.PrivateKey) ( []byte, error)
私钥加密
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.