crypto

package
v0.0.0-...-b6f14a9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2018 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PKCS1 = iota
	PKCS8
)

Variables

This section is empty.

Functions

func AesDecrypt

func AesDecrypt(crypted, key []byte) (original []byte, err error)

func AesEncrypt

func AesEncrypt(origData, key []byte) (crypted []byte, err error)

func DesDecrypt

func DesDecrypt(crypted, key []byte) ([]byte, error)

func DesEncrypt

func DesEncrypt(origData, key []byte) ([]byte, error)

func GenKeyPair

func GenKeyPair(bits, format int, priv, pub io.Writer) error

func GetPrivKey

func GetPrivKey(privKey []byte, format int) (priv *rsa.PrivateKey, err error)

func GetPubKey

func GetPubKey(pubKey []byte) (pub *rsa.PublicKey, err error)

func MarshalPKCS8PrivateKey

func MarshalPKCS8PrivateKey(key *rsa.PrivateKey) ([]byte, error)

PKCS8 私钥

func RsaDecrypt

func RsaDecrypt(ciphertext, privKey []byte, privKeyFormat int) ([]byte, error)

解密

func RsaDecryptPublic

func RsaDecryptPublic(origData []byte, pubKey *rsa.PublicKey) ([]byte, error)

公钥解密

func RsaEncrypt

func RsaEncrypt(origData, pubKey []byte) ([]byte, error)

加密

func RsaEncryptPrivate

func RsaEncryptPrivate(origData []byte, privKey *rsa.PrivateKey) (
	[]byte, error)

私钥加密

func Sign

func Sign(privKey []byte, hash crypto.Hash, hashed []byte, privKeyFormat int) ([]byte, error)

签名

func Verify

func Verify(pubKey []byte, hash crypto.Hash, hashed, signature []byte) error

验签

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL