gpg

package
v0.0.0-...-d62ea78 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMessageNotEncrypted = errors.New("gpg: Message not encrypted")

ErrMessageNotEncrypted is returned when to be decrypted message is not encrypted.

View Source
var ErrMessageNotSigned = errors.New("gpg: Message not signed")

ErrMessageNotSigned is returned when to be decrypted message was not signed by anybody.

View Source
var ErrNoPrivateKey = errors.New("gpg: Entity contains no private key to decrypt")

ErrNoPrivateKey is returned when an entity does not contain needed private keys.

View Source
var ErrUnknownIdentity = errors.New("gpg: Identity not associated with client key")

ErrUnknownIdentity is returned when an identity could not be found within the identities of a key.

View Source
var ErrUnknownIssuer = openpgpErrors.ErrUnknownIssuer

ErrUnknownIssuer is returned when the issuer of a signature is not known.

Functions

func MarshalKey

func MarshalKey(k *openpgp.Entity) ([]byte, error)

MarshalKey encodes the public parts of the given key into a byte array

Types

type GPG

type GPG struct {
	// contains filtered or unexported fields
}

GPG contains the data necessary to perform our cryptographical actions, but hides the private key.

func NewGPG

func NewGPG(serverPrivateKey io.Reader, passphrase string) (*GPG, error)

NewGPG initializes a GPG object from a buffer containing the server's private key.

func (*GPG) CheckMessageSignature

func (gpg *GPG) CheckMessageSignature(message io.Reader, signature io.Reader, checkedSignerKey Key) error

CheckMessageSignature checks whether an armored detached signature is valid for a given message and has been made by the given signer.

func (*GPG) DecryptMessage

func (gpg *GPG) DecryptMessage(message io.Reader) (io.Reader, error)

DecryptMessage decrypts an encrypted message sent to server, but does not check the signature. It writes the plain text to the output

func (*GPG) DecryptSignedMessage

func (gpg *GPG) DecryptSignedMessage(message io.Reader, output io.Writer, senderPublicKey Key) error

DecryptSignedMessage decrypts an encrypted message sent to server, checks the (mandatory) embedded signature made by the given sender and write the plain text to output.

func (*GPG) EncryptMessage

func (gpg *GPG) EncryptMessage(output io.Writer, recipient Key) (plaintext io.WriteCloser, err error)

EncryptMessage encrypts a message using the server's entity for the given recipient and writes the cipher text to output.

func (*GPG) ReadKey

func (gpg *GPG) ReadKey(r io.Reader) (Key, error)

ReadKey reads a PGP public or private key from the given reader.

func (*GPG) ServerIdentity

func (gpg *GPG) ServerIdentity() string

ServerIdentity returns the full identity string for the server key in use

func (*GPG) SignMessage

func (gpg *GPG) SignMessage(message io.Reader, w io.Writer) error

SignMessage signs message and writes the armored detached signature to w.

func (*GPG) SignUserID

func (gpg *GPG) SignUserID(signedEMail string, pubkey Key, w io.Writer) error

SignUserID signs the part in the given public key corresponding to the given email and writes the signed public key to w.

type Key

type Key *openpgp.Entity

Key is a reference to an OpenPGP entity containing some public keys

func UnmarshalKey

func UnmarshalKey(data []byte) (Key, error)

UnmarshalKey reads a key from an ascii armor or binary encoding

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL