Documentation ¶
Overview ¶
Package encrypta encrypts text by public key
Example
pk, err := encrypta.NewPublicKeyFromKeybase("sawadashota") if err != nil { // error handling } enc, err := pk.Encrypt([]byte("I'm encrypted text")) if err != nil { // error handling } fmt.Println(enc.Base64Encode()) // Stdout base64 encoded encrypted text
To decode this, private key holder executes following command
$ go run main.go | base64 --decode | keybase pgp decrypt I'm encrypted text
Index ¶
- type Encrypted
- type EncryptionKey
- func NewPublicKey(key io.Reader) (EncryptionKey, error)
- func NewPublicKeyFromBase64Encoded(base64EncodedKey string) (EncryptionKey, error)
- func NewPublicKeyFromKeybase(username string, opts ...Option) (EncryptionKey, error)
- func NewPublicKeyFromURL(publicKeyURL string, opts ...Option) (EncryptionKey, error)
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Encrypted ¶
type Encrypted []byte
Encrypted .
func (*Encrypted) Base64Encode ¶
Base64Encode Encrypted text
type EncryptionKey ¶
EncryptionKey is public key to encrypt
func NewPublicKey ¶
func NewPublicKey(key io.Reader) (EncryptionKey, error)
NewPublicKey returns new pgpEncryptionKey instance from given key
func NewPublicKeyFromBase64Encoded ¶
func NewPublicKeyFromBase64Encoded(base64EncodedKey string) (EncryptionKey, error)
NewPublicKeyFromBase64Encoded returns new EncryptionKey from base64 encoded key
func NewPublicKeyFromKeybase ¶
func NewPublicKeyFromKeybase(username string, opts ...Option) (EncryptionKey, error)
NewPublicKeyFromKeybase fetches public key from given Keybase's username and returns encryption key
func NewPublicKeyFromURL ¶
func NewPublicKeyFromURL(publicKeyURL string, opts ...Option) (EncryptionKey, error)
NewPublicKeyFromURL fetches public key from given URL and returns encryption key
Click to show internal directories.
Click to hide internal directories.