Documentation ¶
Overview ¶
Package rsa implements RSA encryption as specified in PKCS#1.
Index ¶
- func Decrypt(src, privateKey []byte) ([]byte, error)
- func DecryptHex(src, privateKey string) (string, error)
- func Encrypt(src, publicKey []byte) ([]byte, error)
- func EncryptHex(src, publicKey string) (string, error)
- func GenerateKey(bits int) (privateKey []byte, publicKey []byte, err error)
- func GeneratingKey(bits int) (privateKey string, publicKey string, err error)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decrypt ¶
Decrypt decrypts the first block in src into dst. Dst and src may point at the same memory.
func DecryptHex ¶
DecryptHex decrypts the first block in src into dst.
func Encrypt ¶
Encrypt encrypts the first block in src into dst. Dst and src may point at the same memory.
func EncryptHex ¶
EncryptHex encrypts the first block in src into dst.
func GenerateKey ¶
GenerateKey generates an RSA keypair of the given bit size.
func GeneratingKey ¶
GeneratingKey generates an RSA keypair of the given bit size.
Example ¶
package main import ( "fmt" "strings" "gopkg.in/goyy/goyy.v0/util/crypto/rsa" ) func main() { prikey, pubkey, _ := rsa.GeneratingKey(512) fmt.Println(strings.Contains(prikey, "-----BEGIN RSA PRIVATE KEY-----")) fmt.Println(strings.Contains(pubkey, "-----BEGIN RSA PUBLIC KEY-----")) }
Output: true true
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.