Documentation ¶
Index ¶
- func BytesToPrivateKey(priv []byte) *rsa.PrivateKey
- func BytesToPublicKey(pub []byte) *rsa.PublicKey
- func DecryptWithPrivateKey(ciphertext []byte, priv *rsa.PrivateKey) []byte
- func EncryptWithPublicKey(msg []byte, pub *rsa.PublicKey) []byte
- func GenerateKey() (*rsa.PrivateKey, *rsa.PublicKey, error)
- func GenerateKey64() (pri64, pub64 string, err error)
- func GenerateKeyBytes() (privateBytes, publicBytes []byte, err error)
- func GenerateKeyPair(bits int) (*rsa.PrivateKey, *rsa.PublicKey)
- func PrivateDecrypt(key *rsa.PrivateKey, data []byte) ([]byte, error)
- func PrivateKeyFrom(key []byte) (*rsa.PrivateKey, error)
- func PrivateKeyFrom64(key string) (*rsa.PrivateKey, error)
- func PrivateKeyToBytes(priv *rsa.PrivateKey) []byte
- func PrivateSign(key *rsa.PrivateKey, data []byte) ([]byte, error)
- func PrivateVerify(key *rsa.PrivateKey, sign, data []byte) error
- func PublicEncrypt(key *rsa.PublicKey, data []byte) ([]byte, error)
- func PublicKeyFrom(key []byte) (*rsa.PublicKey, error)
- func PublicKeyFrom64(key string) (*rsa.PublicKey, error)
- func PublicKeyToBytes(pub *rsa.PublicKey) []byte
- func PublicSign(key *rsa.PublicKey, data []byte) ([]byte, error)
- func PublicVerify(key *rsa.PublicKey, sign, data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BytesToPrivateKey ¶
func BytesToPrivateKey(priv []byte) *rsa.PrivateKey
BytesToPrivateKey bytes to private key
func BytesToPublicKey ¶
BytesToPublicKey bytes to public key
func DecryptWithPrivateKey ¶
func DecryptWithPrivateKey(ciphertext []byte, priv *rsa.PrivateKey) []byte
DecryptWithPrivateKey decrypts data with private key
func EncryptWithPublicKey ¶
EncryptWithPublicKey encrypts data with public key
func GenerateKey ¶
func GenerateKey() (*rsa.PrivateKey, *rsa.PublicKey, error)
GenerateKey Copy from https://gist.github.com/wongoo/2b974a9594627114bea3e53c794980cd GenerateKey
func GenerateKey64 ¶
func GenerateKeyBytes ¶
func GenerateKeyPair ¶
func GenerateKeyPair(bits int) (*rsa.PrivateKey, *rsa.PublicKey)
GenerateKeyPair Copy from https://gist.github.com/miguelmota/3ea9286bd1d3c2a985b67cac4ba2130a GenerateKeyPair generates a new key pair
func PrivateDecrypt ¶
func PrivateDecrypt(key *rsa.PrivateKey, data []byte) ([]byte, error)
func PrivateKeyFrom ¶
func PrivateKeyFrom(key []byte) (*rsa.PrivateKey, error)
func PrivateKeyFrom64 ¶
func PrivateKeyFrom64(key string) (*rsa.PrivateKey, error)
func PrivateKeyToBytes ¶
func PrivateKeyToBytes(priv *rsa.PrivateKey) []byte
PrivateKeyToBytes private key to bytes
func PrivateSign ¶
func PrivateSign(key *rsa.PrivateKey, data []byte) ([]byte, error)
func PrivateVerify ¶
func PrivateVerify(key *rsa.PrivateKey, sign, data []byte) error
func PublicKeyToBytes ¶
PublicKeyToBytes public key to bytes
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.