shellgamecrypto

package module
v0.0.0-...-1cdf863 Latest Latest
Warning

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

Go to latest
Published: May 13, 2018 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Build Status Coverage Status

A few useful wrappers around the base golang openpgp implementation.

Data encrypted via bundle.EncryptAndSign is gzip compressed before encryption.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncryptAndSign

func EncryptAndSign(r io.Reader, recipientPubKeys openpgp.EntityList, signingPrivKey *openpgp.Entity) (data, signature string, err error)

EncryptAndSign Takes an IO stream, recipient public keys, and a non-passworded signing private key, then encrypts the payload and signs the result. The order is important. If it's signed first, THEN encrypted, the signature can't be validated without the decryption key This operation is destructive - the reader is no longer accessible afterwards

func GenerateRSAKeyPair

func GenerateRSAKeyPair(bits int, name, comment, email string) (privKey string, pubKey string, err error)

GenerateRSAKeyPair takes the bitlength and spits out a base64 encoded private/public RSA keypair

func ReadSigner

func ReadSigner(r io.Reader) (keyID string, err error)

ReadSigner returns the long key ID of whoever signed the message

func Version

func Version() string

Version reports the current build version

Types

type KeyIDs

type KeyIDs struct {
	PrimaryKeyID string        `json:"primary_key_id"`
	SubKeyIDs    []string      `json:"subkey_ids"`
	UserID       packet.UserId `json:"user_id"`
}

KeyIDs is the public key metadata container

func DecodePublicKey

func DecodePublicKey(r io.Reader) (key *KeyIDs, err error)

DecodePublicKey returns metadata about a public key

func EntityKeyIDs

func EntityKeyIDs(entity *openpgp.Entity) (keys KeyIDs, err error)

EntityKeyIDs extracts the key IDs from a given entity

type MessageMetadata

type MessageMetadata struct {
	IsEncrypted              bool     // true if the message was encrypted.
	EncryptedToKeyIds        []string // the list of recipient key ids.
	IsSymmetricallyEncrypted bool     // true if a passphrase could have decrypted the message.
	IsSigned                 bool     // true if the message is signed.
	SignedByKeyID            string   // the key id of the signer, if any.
	// If IsSigned is true and SignedBy is non-zero then the signature will
	// be verified as UnverifiedBody is read. The signature cannot be
	// checked until the whole of UnverifiedBody is read so UnverifiedBody
	// must be consumed until EOF before the data can be trusted. Even if a
	// message isn't signed (or the signer is unknown) the data may contain
	// an authentication code that is only checked once UnverifiedBody has
	// been consumed. Once EOF has been seen, the following fields are
	// valid. (An authentication code failure is reported as a
	// SignatureError error when reading from UnverifiedBody.)
	SignatureError error               // nil if the signature is good.
	Signature      *packet.Signature   // the signature packet itself, if v4 (default)
	SignatureV3    *packet.SignatureV3 // the signature packet if it is a v2 or v3 signature

}

MessageMetadata contains the result of parsing an OpenPGP encrypted and/or signed message.

func ReadRecipients

func ReadRecipients(r io.Reader) (md *MessageMetadata, err error)

ReadRecipients parses an OpenPGP message that may be signed and/or encrypted. An encrypted & signed message cannot be signature-validated without the decryption key

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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