Documentation ¶
Index ¶
- func Decrypt(priv *rsa.PrivateKey, msg []byte, opts ...Option) ([]byte, error)
- func Encrypt(pub *rsa.PublicKey, msg []byte, opts ...Option) ([]byte, error)
- func PrivateKey(key string) (priv *rsa.PrivateKey)
- func Publickey(key string) (pub *rsa.PublicKey)
- type Cipher
- func (s *Cipher) Bytes() []byte
- func (s *Cipher) Decrypt(msg []byte) *Cipher
- func (s *Cipher) DecryptPublic(msg []byte) *Cipher
- func (s *Cipher) Encrypt(msg []byte) *Cipher
- func (s *Cipher) EncryptPrivate(msg []byte) *Cipher
- func (s *Cipher) Sign(msg []byte) (buf []byte, e error)
- func (s *Cipher) String(enc func([]byte) string) (ss string)
- func (s *Cipher) Verify(signed, msg []byte) (e error)
- type Option
- type Padding
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PrivateKey ¶
func PrivateKey(key string) (priv *rsa.PrivateKey)
PrivateKey parse a private key from a string
a string without the word BEGIN END
a string with the word BEGIN END
Types ¶
type Cipher ¶
type Cipher struct { Error error // contains filtered or unexported fields }
func New ¶
New RSA
New().String(gcrypto.Base64) => base64 string New().Encrypt().String(gcrypto.Raw) => utf8 string New().Decrypt().Bytes() => []byte New().Release() => free Cipher to global rsapool
support none padding (unsafe)
func (*Cipher) DecryptPublic ¶
func (*Cipher) EncryptPrivate ¶
Click to show internal directories.
Click to hide internal directories.