Documentation ¶ Index ¶ type RSA func Init(bits int) (RSA, error) func InitWithKey(public []byte, private []byte) (RSA, error) func (f *RSA) Decrypt(data []byte) []byte func (f *RSA) Encrypt(data []byte) []byte func (f *RSA) GenerateKey(bits int) error func (f *RSA) SavePem() error func (f *RSA) Sign(data []byte) []byte func (f *RSA) Verify(data []byte, signature []byte) error Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ This section is empty. Types ¶ type RSA ¶ type RSA struct { PublicKey *rsa.PublicKey PrivateKey *rsa.PrivateKey } func Init ¶ func Init(bits int) (RSA, error) Init 初始化秘钥对 func InitWithKey ¶ func InitWithKey(public []byte, private []byte) (RSA, error) InitWithKey 初始化秘钥对 func (*RSA) Decrypt ¶ func (f *RSA) Decrypt(data []byte) []byte Decrypt rsa私钥加密 data 要解密的数据 func (*RSA) Encrypt ¶ func (f *RSA) Encrypt(data []byte) []byte Encrypt rsa公钥加密 data 要加密的数据 func (*RSA) GenerateKey ¶ func (f *RSA) GenerateKey(bits int) error GenerateKey RsaGenKey 参数bits: 指定生成的秘钥的长度, 单位: bit func (*RSA) SavePem ¶ func (f *RSA) SavePem() error SavePem 保存公钥私钥文件 func (*RSA) Sign ¶ func (f *RSA) Sign(data []byte) []byte Sign rsa私钥签名 data 要签名的数据 func (*RSA) Verify ¶ func (f *RSA) Verify(data []byte, signature []byte) error Verify rsa公钥验签 data 要验签的数据 Source Files ¶ View all Source files rsa.go Click to show internal directories. Click to hide internal directories.