Documentation ¶
Overview ¶
Package rsa implements crypto/rsa
Index ¶
- type KeyPair
- func (k *KeyPair) DecryptByPrivateKey(src []byte) (dst []byte, err error)
- func (k *KeyPair) DecryptByPublicKey(src []byte) (dst []byte, err error)
- func (k *KeyPair) EncryptByPrivateKey(src []byte) (dst []byte, err error)
- func (k *KeyPair) EncryptByPublicKey(src []byte) (dst []byte, err error)
- func (k *KeyPair) IsPrivateKey() bool
- func (k *KeyPair) IsPublicKey() bool
- func (k *KeyPair) IsSupportedHash() bool
- func (k *KeyPair) SetHash(hash crypto.Hash)
- func (k *KeyPair) SetPrivateKey(privateKey []byte)
- func (k *KeyPair) SetPublicKey(publicKey []byte)
- func (k *KeyPair) SignByPrivateKey(src []byte) (dst []byte, err error)
- func (k *KeyPair) VerifyByPublicKey(src, sign []byte) (err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyPair ¶
type KeyPair struct {
// contains filtered or unexported fields
}
KeyPair defines a KeyPair struct. 定义 KeyPair 结构体
func NewKeyPair ¶
func NewKeyPair() *KeyPair
NewKeyPair returns a new KeyPair instance. 初始化 keyPair 结构体
func (*KeyPair) DecryptByPrivateKey ¶
DecryptByPrivateKey encrypts by private key. 通过私钥解密
func (*KeyPair) DecryptByPublicKey ¶
DecryptByPublicKey encrypts by public key. 通过公钥解密
func (*KeyPair) EncryptByPrivateKey ¶
EncryptByPrivateKey encrypts by private key. 通过私钥加密
func (*KeyPair) EncryptByPublicKey ¶
EncryptByPublicKey encrypts by public key. 通过公钥加密
func (*KeyPair) IsPrivateKey ¶
IsPrivateKey whether is a private key. 是否是私钥
func (*KeyPair) IsPublicKey ¶
IsPublicKey whether is a public key. 是否是公钥
func (*KeyPair) IsSupportedHash ¶
IsSupportedHash whether is a supported hash algorithm. 判断是否是支持的哈希算法
func (*KeyPair) SetPrivateKey ¶
SetPrivateKey sets private key. 设置私钥
func (*KeyPair) SetPublicKey ¶
SetPublicKey sets public key. 设置公钥
func (*KeyPair) SignByPrivateKey ¶
SignByPrivateKey signs by private key. 通过私钥签名
func (*KeyPair) VerifyByPublicKey ¶
VerifyByPublicKey verify by public key. 通过公钥验签