Documentation ¶
Index ¶
- Variables
- type Security
- func (sec *Security) GetPrivateKey() (*rsa.PrivateKey, error)
- func (sec *Security) GetPublicKey() (*rsa.PublicKey, error)
- func (sec *Security) PriKeyDecrypt(input []byte) ([]byte, error)
- func (sec *Security) PriKeyEncrypt(input []byte) ([]byte, error)
- func (sec *Security) PubKeyDecrypt(input []byte) ([]byte, error)
- func (sec *Security) PubKeyEncrypt(input []byte) ([]byte, error)
- func (sec *Security) SetPrivateKey(priStr string) (err error)
- func (sec *Security) SetPublicKey(pubStr string) (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrDataToLarge = errors.New("message to 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") )
View Source
var RSA = &Security{}
Functions ¶
This section is empty.
Types ¶
type Security ¶
type Security struct {
// contains filtered or unexported fields
}
func (*Security) GetPrivateKey ¶
func (sec *Security) GetPrivateKey() (*rsa.PrivateKey, error)
func (*Security) PriKeyDecrypt ¶
PriKeyDecrypt 私钥解密
func (*Security) PriKeyEncrypt ¶
PriKeyEncrypt 私钥加密
func (*Security) PubKeyDecrypt ¶
PubKeyDecrypt 公钥解密
func (*Security) PubKeyEncrypt ¶
PubKeyEncrypt 公钥加密
func (*Security) SetPrivateKey ¶
SetPrivateKey 设置私钥
func (*Security) SetPublicKey ¶
SetPublicKey 设置公钥
Click to show internal directories.
Click to hide internal directories.