Documentation ¶
Index ¶
- Constants
- func DecryptWithPrivateKeyString(privateKeyStr, cipher string) (string, error)
- func DecryptWithPublicKeyString(publicKeyStr, cipher string) (string, error)
- func EncryptWithPrivateKeyString(privateKeyStr, message string) (string, error)
- func EncryptWithPublicKeyString(publicKeyStr, message string) (string, error)
- type RSA
- func (r *RSA) Decrypt(cipher string) (string, error)
- func (r *RSA) DecryptWithPrivateKey(cipher string) (string, error)
- func (r *RSA) DecryptWithPublicKey(cipher string) (string, error)
- func (r *RSA) Encrypt(message string) (string, error)
- func (r *RSA) EncryptWithPrivateKey(message string) (string, error)
- func (r *RSA) EncryptWithPublicKey(message string) (string, error)
- func (r *RSA) GetPrivateKey() (string, error)
- func (r *RSA) GetPublicKey() (string, error)
- func (r *RSA) SetPrivateKey(privateKeyStr string) error
- func (r *RSA) SetPublicKey(publicKeyStr string) error
Constants ¶
const (
DefaultRSAKeySize = 512
)
Variables ¶
This section is empty.
Functions ¶
func DecryptWithPrivateKeyString ¶
DecryptWithPrivateKeyString decrypts the data with private key string
func DecryptWithPublicKeyString ¶
DecryptWithPublicKeyString decrypts the data with public key string
func EncryptWithPrivateKeyString ¶
EncryptWithPrivateKeyString encrypts the data with private key string
func EncryptWithPublicKeyString ¶
EncryptWithPublicKeyString encrypts the data with public key string
Types ¶
type RSA ¶
type RSA struct {
// contains filtered or unexported fields
}
func NewRSAWithKeySize ¶
NewRSAWithKeySize returns a new *RSA with given key size
func NewRSAWithPrivateKey ¶
func NewRSAWithPrivateKey(privateKey *rsa.PrivateKey) *RSA
NewRSAWithPrivateKey returns a new *RSA with given private key
func NewRSAWithPrivateKeyString ¶
NewRSAWithPrivateKeyString returns a new *RSA with given private key base64 string
func (*RSA) DecryptWithPrivateKey ¶
DecryptWithPrivateKey decrypts the cipher with private key
func (*RSA) DecryptWithPublicKey ¶
DecryptWithPublicKey decrypts the cipher with public key
func (*RSA) EncryptWithPrivateKey ¶
EncryptWithPrivateKey encrypts the message with private key
func (*RSA) EncryptWithPublicKey ¶
EncryptWithPublicKey encrypts the message with public key
func (*RSA) GetPrivateKey ¶
GetPrivateKey gets the private key base64 string
func (*RSA) GetPublicKey ¶
GetPublicKey gets the public key base64 string
func (*RSA) SetPrivateKey ¶
SetPrivateKey sets the private key with base64 string
func (*RSA) SetPublicKey ¶
SetPublicKey sets the public key with base64 string