myrsa

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDataToLarge     = errors.New("message too long for RSA public key size")
	ErrDataLen         = errors.New("data length error")
	ErrDataBroken      = errors.New("data broken, first byte is not zero")
	ErrKeyPairDismatch = errors.New("data is not encrypted by the private key")
	ErrDecryption      = errors.New("decryption error")
	ErrPublicKey       = errors.New("get public key error")
	ErrPrivateKey      = errors.New("get private key error")
)

Functions

func GetPriKey

func GetPriKey(prikey []byte) (*rsa.PrivateKey, error)

获得私钥(标准RSA PRIVATE KEY)

func GetPriKeyByPfxFile

func GetPriKeyByPfxFile(strFile string, strPasswd string) (prikey *rsa.PrivateKey, err error)

通过指定文件获得证书私钥

func GetPriKeyPfx

func GetPriKeyPfx(pfxKey []byte, strPasswd string) (prikey *rsa.PrivateKey, err error)

通过内存数组获得证书私钥

func GetPubKey

func GetPubKey(pubkey []byte) (*rsa.PublicKey, error)

获得公钥(标准RSA PUBLIC KEY)

func GetPubKeyByCerFile

func GetPubKeyByCerFile(strFile string) (pubkey *rsa.PublicKey, err error)

通过指定文件获得证书公钥

func GetPubKeyCer

func GetPubKeyCer(cerKey []byte) (pubkey *rsa.PublicKey, err error)

通过内存数组获得证书公钥

func ParseCerPublicKey

func ParseCerPublicKey(cerKey []byte) (*rsa.PublicKey, error)

Certificate证书获取公钥对象

func PriKeyDecrypt

func PriKeyDecrypt(prikey *rsa.PrivateKey, input []byte) ([]byte, error)

私钥解密

func PriKeyEncrypt

func PriKeyEncrypt(prikey *rsa.PrivateKey, input []byte) ([]byte, error)

私钥加密

func PubKeyDecrypt

func PubKeyDecrypt(pubkey *rsa.PublicKey, input []byte) ([]byte, error)

公钥解密

func PubKeyEncrypt

func PubKeyEncrypt(pubkey *rsa.PublicKey, input []byte) ([]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