openpgp

package
v2.0.0-...-6e5629b Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2023 License: BSD-3-Clause Imports: 27 Imported by: 1

Documentation

Overview

Package openpgp implements high level operations on OpenPGP messages.

Index

Constants

This section is empty.

Variables

View Source
var PrivateKeyType = "PGP PRIVATE KEY BLOCK"

PrivateKeyType is the armor type for a PGP private key.

View Source
var PublicKeyType = "PGP PUBLIC KEY BLOCK"

PublicKeyType is the armor type for a PGP public key.

View Source
var SignatureType = "PGP SIGNATURE"

SignatureType is the armor type for a PGP signature.

Functions

func ArmoredDetachSign

func ArmoredDetachSign(w io.Writer, signers []*Entity, message io.Reader, config *packet.Config) (err error)

ArmoredDetachSign signs message with the private key from signer (which must already have been decrypted) and writes an armored signature to w. If config is nil, sensible defaults will be used.

func ArmoredDetachSignText

func ArmoredDetachSignText(w io.Writer, signers []*Entity, message io.Reader, config *packet.Config) error

ArmoredDetachSignText signs message (after canonicalising the line endings) with the private key from signer (which must already have been decrypted) and writes an armored signature to w. If config is nil, sensible defaults will be used.

func DetachSign

func DetachSign(w io.Writer, signers []*Entity, message io.Reader, config *packet.Config) error

DetachSign signs message with the private key from signer (which must already have been decrypted) and writes the signature to w. If config is nil, sensible defaults will be used.

func DetachSignText

func DetachSignText(w io.Writer, signers []*Entity, message io.Reader, config *packet.Config) error

DetachSignText signs message (after canonicalising the line endings) with the private key from signer (which must already have been decrypted) and writes the signature to w. If config is nil, sensible defaults will be used.

func DetachSignWriter

func DetachSignWriter(w io.Writer, signers []*Entity, utf8Message bool, config *packet.Config) (io.WriteCloser, error)

DetachSignWriter signs a message with the private key from a signer (which must already have been decrypted) and writes the signature to w. DetachSignWriter returns a WriteCloser to which the message can be written to. The resulting WriteCloser must be closed after the contents of the message have been written. If utf8Message is set to true, the line endings of the message are canonicalised and the type of the signature will be SigTypeText. If config is nil, sensible defaults will be used.

func Encrypt

func Encrypt(ciphertext io.Writer, to, toHidden []*Entity, signers []*Entity, hints *FileHints, config *packet.Config) (plaintext io.WriteCloser, err error)

Encrypt encrypts a message to a number of recipients and, optionally, signs it. hints contains optional information, that is also encrypted, that aids the recipients in processing the message. The resulting WriteCloser must be closed after the contents of the file have been written. The to argument contains recipients that are explicitly mentioned in signatures and encrypted keys, whereas the toHidden argument contains recipients that will be hidden and not mentioned. If config is nil, sensible defaults will be used.

func EncryptWithParams

func EncryptWithParams(ciphertext io.Writer, to, toHidden []*Entity, params *EncryptParams) (plaintext io.WriteCloser, err error)

EncryptWithParams encrypts a message to a number of recipients and, optionally, signs it. The resulting WriteCloser must be closed after the contents of the file have been written. The to argument contains recipients that are explicitly mentioned in signatures and encrypted keys, whereas the toHidden argument contains recipients that will be hidden and not mentioned. Params contains all optional parameters.

func HashIdToHash

func HashIdToHash(id byte) (h crypto.Hash, ok bool)

HashIdToHash returns a crypto.Hash which corresponds to the given OpenPGP hash id.

func HashIdToString

func HashIdToString(id byte) (name string, ok bool)

HashIdToString returns the name of the hash function corresponding to the given OpenPGP hash id.

func HashToHashId

func HashToHashId(h crypto.Hash) (id byte, ok bool)

HashToHashId returns an OpenPGP hash id which corresponds the given Hash.

func NewCanonicalTextHash

func NewCanonicalTextHash(h hash.Hash) hash.Hash

NewCanonicalTextHash reformats text written to it into the canonical form and then applies the hash h. See RFC 4880, section 5.2.1.

func NewCanonicalTextReader

func NewCanonicalTextReader(r io.Reader) io.Reader

NewCanonicalTextReader reformats text read from it into the canonical form. See RFC 4880, section 5.2.1.

func NewCanonicalTextWriteCloser

func NewCanonicalTextWriteCloser(w io.WriteCloser) io.WriteCloser

NewCanonicalTextWriteCloser reformats text written to it into the canonical form. See RFC 4880, section 5.2.1.

func Sign

func Sign(output io.Writer, signers []*Entity, hints *FileHints, config *packet.Config) (input io.WriteCloser, err error)

Sign signs a message. The resulting WriteCloser must be closed after the contents of the file have been written. hints contains optional information that aids the recipients in processing the message. If config is nil, sensible defaults will be used.

func SignWithParams

func SignWithParams(output io.Writer, signers []*Entity, params *SignParams) (input io.WriteCloser, err error)

SignWithParams signs a message. The resulting WriteCloser must be closed after the contents of the file have been written. SignParams can contain optional params and can be nil for defaults.

func SymmetricallyEncrypt

func SymmetricallyEncrypt(ciphertext io.Writer, passphrase []byte, hints *FileHints, config *packet.Config) (plaintext io.WriteCloser, err error)

SymmetricallyEncrypt acts like gpg -c: it encrypts a file with a passphrase. The resulting WriteCloser must be closed after the contents of the file have been written. If config is nil, sensible defaults will be used.

func SymmetricallyEncryptWithParams

func SymmetricallyEncryptWithParams(passphrase []byte, dataWriter io.Writer, params *EncryptParams) (plaintext io.WriteCloser, err error)

SymmetricallyEncryptWithParams acts like SymmetricallyEncrypt: but provides more configuration options EncryptParams provides the optional parameters. The resulting WriteCloser must be closed after the contents of the file have been written.

Types

type EncryptParams

type EncryptParams struct {
	// KeyWriter is a Writer to which the encrypted
	// session keys are written to.
	// If nil, DataWriter is used instead.
	KeyWriter io.Writer
	// Hints contains file metadata for the literal data packet.
	// If nil, default is used.
	Hints *FileHints
	// SiningEntities contains the private keys to produce signatures with
	// If nil, no signatures are created
	Signers []*Entity
	// TextSig indicates if signatures of type SigTypeText should be produced
	TextSig bool
	// SessionKey provides a session key to be used for encryption.
	// If nil, a one-time session key is generated
	SessionKey []byte
	// Config provides the config to be used.
	// If Config is nil, sensible defaults will be used.
	Config *packet.Config
}

type Entity

type Entity struct {
	PrimaryKey       *packet.PublicKey
	PrivateKey       *packet.PrivateKey
	Identities       map[string]*Identity // indexed by Identity.Name
	Revocations      []*packet.VerifiableSignature
	DirectSignatures []*packet.VerifiableSignature // Direct-key self signature of the PrimaryKey (containts primary key properties in v6)}
	Subkeys          []Subkey
}

An Entity represents the components of an OpenPGP key: a primary public key (which must be a signing key), one or more identities claimed by that key, and zero or more subkeys, which may be encryption keys.

func NewEntity

func NewEntity(name, comment, email string, config *packet.Config) (*Entity, error)

NewEntity returns an Entity that contains fresh keys with a for signing and encrypting pgp messages. The key is associated with a single identity composed of the given full name, comment and email, any of which may be empty but must not contain any of "()<>\x00". If config is nil, sensible defaults will be used.

func NewEntityWithoutId

func NewEntityWithoutId(config *packet.Config) (*Entity, error)

NewEntityWithoutId returns an Entity that contains fresh keys for signing and encrypting pgp messages. The key is not associated with an identity. This is only allowed for v6 key generation. If v6 is not enabled, it will return an error. If config is nil, sensible defaults will be used.

func ReadEntity

func ReadEntity(packets *packet.Reader) (*Entity, error)

ReadEntity reads an entity (public key, identities, subkeys etc) from the given Reader.

func VerifyArmoredDetachedSignature

func VerifyArmoredDetachedSignature(keyring KeyRing, signed, signature io.Reader, config *packet.Config) (sig *packet.Signature, signer *Entity, err error)

VerifyArmoredDetachedSignature performs the same actions as VerifyDetachedSignature but expects the signature to be armored.

func VerifyDetachedSignature

func VerifyDetachedSignature(keyring KeyRing, signed, signature io.Reader, config *packet.Config) (sig *packet.Signature, signer *Entity, err error)

VerifyDetachedSignature takes a signed file and a detached signature and returns the signature packet and the entity the signature was signed by, if any, and a possible signature verification error. If the signer isn't known, ErrUnknownIssuer is returned.

func (*Entity) AddDirectKeySignature

func (t *Entity) AddDirectKeySignature(config *packet.Config) error

func (*Entity) AddEncryptionSubkey

func (e *Entity) AddEncryptionSubkey(config *packet.Config) error

AddEncryptionSubkey adds an encryption keypair as a subkey to the Entity. If config is nil, sensible defaults will be used.

func (*Entity) AddSigningSubkey

func (e *Entity) AddSigningSubkey(config *packet.Config) error

AddSigningSubkey adds a signing keypair as a subkey to the Entity. If config is nil, sensible defaults will be used.

func (*Entity) AddUserId

func (t *Entity) AddUserId(name, comment, email string, config *packet.Config) error

func (*Entity) CertificationKey

func (e *Entity) CertificationKey(now time.Time, config *packet.Config) (Key, bool)

CertificationKey return the best candidate Key for certifying a key with this Entity.

func (*Entity) CertificationKeyById

func (e *Entity) CertificationKeyById(now time.Time, id uint64, config *packet.Config) (Key, bool)

CertificationKeyById return the Key for key certification with this Entity and keyID.

func (*Entity) DecryptPrivateKeys

func (e *Entity) DecryptPrivateKeys(passphrase []byte) error

DecryptPrivateKeys decrypts all encrypted keys in the entitiy with the given passphrase. Avoids recomputation of similar s2k key derivations. Public keys and dummy keys are ignored, and don't cause an error to be returned.

func (*Entity) DecryptionKeys

func (e *Entity) DecryptionKeys(id uint64, date time.Time) (keys []Key)

DecryptionKeys returns all keys that are available for decryption, matching the keyID when given If date is zero (i.e., date.IsZero() == true) the time checks are not performed, which should be proffered to decrypt older messages. If id is 0 all decryption keys are returned. This is useful to retrieve keys for session key decryption.

func (*Entity) EncryptPrivateKeys

func (e *Entity) EncryptPrivateKeys(passphrase []byte, config *packet.Config) error

EncryptPrivateKeys encrypts all non-encrypted keys in the entity with the same key derived from the provided passphrase. Public keys and dummy keys are ignored, and don't cause an error to be returned.

func (*Entity) EncryptionKey

func (e *Entity) EncryptionKey(now time.Time, config *packet.Config) (Key, bool)

EncryptionKey returns the best candidate Key for encrypting a message to the given Entity.

func (*Entity) LatestValidDirectSignature

func (e *Entity) LatestValidDirectSignature(date time.Time) (selectedSig *packet.Signature, err error)

func (*Entity) PrimaryIdentity

func (e *Entity) PrimaryIdentity(date time.Time) (*packet.Signature, *Identity, error)

PrimaryIdentity returns a valid non-revoked Identity while preferring identities marked as primary, or the latest-created identity, in that order.

func (*Entity) PrimarySelfSignature

func (e *Entity) PrimarySelfSignature(date time.Time) (primarySig *packet.Signature, err error)

primarySelfSignature searches the entitity for the self-signature that stores key prefrences. For V4 keys, returns the self-signature of the primary indentity, and the identity. For V6 keys, returns the latest valid direct-key self-signature, and no identity (nil). This self-signature is to be used to check the key expiration, algorithm preferences, and so on.

func (*Entity) Revoke

func (e *Entity) Revoke(reason packet.ReasonForRevocation, reasonText string, config *packet.Config) error

Revoke generates a key revocation signature (packet.SigTypeKeyRevocation) with the specified reason code and text (RFC4880 section-5.2.3.23). If config is nil, sensible defaults will be used.

func (*Entity) Revoked

func (e *Entity) Revoked(now time.Time) bool

Revoked returns whether the entity has any direct key revocation signatures. Note that third-party revocation signatures are not supported. Note also that Identity and Subkey revocation should be checked separately.

func (*Entity) Serialize

func (e *Entity) Serialize(w io.Writer) error

Serialize writes the public part of the given Entity to w, including signatures from other entities. No private key material will be output.

func (*Entity) SerializePrivate

func (e *Entity) SerializePrivate(w io.Writer, config *packet.Config) (err error)

SerializePrivate serializes an Entity, including private key material, but excluding signatures from other entities, to the given Writer. Identities and subkeys are re-signed in case they changed since NewEntry. If config is nil, sensible defaults will be used.

func (*Entity) SerializePrivateWithoutSigning

func (e *Entity) SerializePrivateWithoutSigning(w io.Writer, config *packet.Config) (err error)

SerializePrivateWithoutSigning serializes an Entity, including private key material, but excluding signatures from other entities, to the given Writer. Self-signatures of identities and subkeys are not re-signed. This is useful when serializing GNU dummy keys, among other things. If config is nil, sensible defaults will be used.

func (*Entity) SignIdentity

func (e *Entity) SignIdentity(identity string, signer *Entity, config *packet.Config) error

SignIdentity adds a signature to e, from signer, attesting that identity is associated with e. The provided identity must already be an element of e.Identities and the private key of signer must have been decrypted if necessary. If config is nil, sensible defaults will be used.

func (*Entity) SigningKey

func (e *Entity) SigningKey(now time.Time, config *packet.Config) (Key, bool)

SigningKey return the best candidate Key for signing a message with this Entity.

func (*Entity) SigningKeyById

func (e *Entity) SigningKeyById(now time.Time, id uint64, config *packet.Config) (Key, bool)

SigningKeyById return the Key for signing a message with this Entity and keyID.

func (*Entity) VerifyPrimaryKey

func (e *Entity) VerifyPrimaryKey(date time.Time) (*packet.Signature, error)

VerifyPrimaryKey checks if the primary key is valid by checking: - that the primary key is has not been revoked at the given date, - that there is valid non-expired self-signature, - that the primary key is not expired given its self-signature. If date is zero (i.e., date.IsZero() == true) the time checks are not performed.

type EntityList

type EntityList []*Entity

An EntityList contains one or more Entities.

func ReadArmoredKeyRing

func ReadArmoredKeyRing(r io.Reader) (EntityList, error)

ReadArmoredKeyRing reads one or more public/private keys from an armor keyring file.

func ReadKeyRing

func ReadKeyRing(r io.Reader) (el EntityList, err error)

ReadKeyRing reads one or more public/private keys. Unsupported keys are ignored as long as at least a single valid key is found.

func (EntityList) EntitiesById

func (el EntityList) EntitiesById(id uint64) (entities []*Entity)

EntitiesById returns the entities that contain a key with the given key id.

func (EntityList) KeysById

func (el EntityList) KeysById(id uint64) (keys []Key)

KeysById returns the set of keys that have the given key id. KeysById does not perform any key validation, and the self-signature fields in the returned key structs are nil.

type FileHints

type FileHints struct {
	// IsUTF8 can be set to hint that the contents are utf8 encoded data
	IsUTF8 bool
	// FileName hints at the name of the file that should be written. It's
	// truncated to 255 bytes if longer. It may be empty to suggest that the
	// file should not be written to disk. It may be equal to "_CONSOLE" to
	// suggest the data should not be written to disk.
	FileName string
	// ModTime contains the modification time of the file, or the zero time if not applicable.
	ModTime time.Time
}

FileHints contains metadata about encrypted files. This metadata is, itself, encrypted.

type Identity

type Identity struct {
	Primary             *Entity
	Name                string // by convention, has the form "Full Name (comment) <email@example.com>"
	UserId              *packet.UserId
	SelfCertifications  []*packet.VerifiableSignature
	OtherCertifications []*packet.VerifiableSignature
	Revocations         []*packet.VerifiableSignature
}

An Identity represents an identity claimed by an Entity and zero or more assertions by other entities about that claim.

func (*Identity) LatestValidSelfCertification

func (i *Identity) LatestValidSelfCertification(date time.Time) (selectedSig *packet.Signature, err error)

LatestValidSelfCertification returns the latest valid self-signature of this user-id that is not newer than the provided date. Does not consider signatures that are expired. If date is zero (i.e., date.IsZero() == true) the expiration checks are not performed. Returns a StructuralError if no valid self-certification is found.

func (*Identity) ReSign

func (i *Identity) ReSign(config *packet.Config) error

func (*Identity) Revoked

func (i *Identity) Revoked(selfCertification *packet.Signature, date time.Time) bool

Revoked returns whether the identity has been revoked by a self-signature. Note that third-party revocation signatures are not supported.

func (*Identity) Serialize

func (i *Identity) Serialize(w io.Writer) error

func (*Identity) SignIdentity

func (ident *Identity) SignIdentity(signer *Entity, config *packet.Config) error

SignIdentity adds a signature to e, from signer, attesting that identity is associated with e. The provided identity must already be an element of e.Identities and the private key of signer must have been decrypted if necessary. If config is nil, sensible defaults will be used.

func (*Identity) Verify

func (i *Identity) Verify(date time.Time) (selfSignature *packet.Signature, err error)

Verify checks if the user-id is valid by checking: - that a valid self-certification exists and is not expired - that user-id has not been revoked at the given point in time If date is zero (i.e., date.IsZero() == true) the time checks are not performed.

type Key

type Key struct {
	Entity               *Entity
	PrimarySelfSignature *packet.Signature // might be nil, if not verified
	PublicKey            *packet.PublicKey
	PrivateKey           *packet.PrivateKey
	SelfSignature        *packet.Signature // might be nil, if not verified
}

A Key identifies a specific public key in an Entity. This is either the Entity's primary key or a subkey.

func (*Key) IsPrimary

func (k *Key) IsPrimary() bool

type KeyRing

type KeyRing interface {
	// KeysById returns the set of keys that have the given key id.
	// KeysById does not perform any signature validations and verification of the returned keys.
	KeysById(id uint64) []Key
	// EntitiesById returns the set of entities that contain a key with the given key id.
	// EntitiesById does not perform any signature validations and verification of the returned keys.
	EntitiesById(id uint64) []*Entity
}

A KeyRing provides access to public and private keys.

type MessageDetails

type MessageDetails struct {
	IsEncrypted              bool                  // true if the message was encrypted.
	EncryptedToKeyIds        []uint64              // the list of recipient key ids.
	IsSymmetricallyEncrypted bool                  // true if a passphrase could have decrypted the message.
	DecryptedWith            Key                   // the private key used to decrypt the message, if any.
	DecryptedWithAlgorithm   packet.CipherFunction // Stores the algorithm used to decrypt the message, if any.
	IsSigned                 bool                  // true if the message is signed.
	LiteralData              *packet.LiteralData   // the metadata of the contents
	UnverifiedBody           io.Reader             // the contents of the message.
	CheckRecipients          bool                  // Indicates if the intended recipients should be checked

	SessionKey []byte // Caches the session key if the flag in packet.Config is set to true and a session key was present.

	// If IsSigned is true then the signature candidates 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.)
	IsVerified          bool                  // true if the signatures have been verified else false
	SignatureCandidates []*SignatureCandidate // stores state for all signatures of this message
	SignedBy            *Key                  // the issuer key of the fist successfully verified signature, if any found.
	Signature           *packet.Signature     // the first successfully verified signature, if any found.
	// SignatureError is nil if one of the signatures in the message verifies successfully
	// else it points to the last observed signature error.
	// The error of each signature verification can be inspected by iterating trough
	// SignatureCandidates.
	SignatureError error
	// SelectedCandidate points to the signature candidate the SignatureError error stems from or
	// the selected successfully verified signature candidate.
	SelectedCandidate *SignatureCandidate
	// contains filtered or unexported fields
}

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

func ReadMessage

func ReadMessage(r io.Reader, keyring KeyRing, prompt PromptFunction, config *packet.Config) (md *MessageDetails, err error)

ReadMessage parses an OpenPGP message that may be signed and/or encrypted. The given KeyRing should contain both public keys (for signature verification) and, possibly encrypted, private keys for decrypting. If config is nil, sensible defaults will be used.

func VerifyDetachedSignatureReader

func VerifyDetachedSignatureReader(keyring KeyRing, signed, signature io.Reader, config *packet.Config) (md *MessageDetails, err error)

VerifyDetachedSignatureReader takes a signed file and a detached signature and returns message details struct similar to the ReadMessage function. Once all data is read from md.UnverifiedBody the detached signature is verified. If a verification error occurs it is stored in md.SignatureError If the signer isn't known, ErrUnknownIssuer is returned. If expectedHashes or expectedSaltedHashes is not nil, the method checks if they match the signatures metadata or else return an error

type PromptFunction

type PromptFunction func(keys []Key, symmetric bool) ([]byte, error)

A PromptFunction is used as a callback by functions that may need to decrypt a private key, or prompt for a passphrase. It is called with a list of acceptable, encrypted private keys and a boolean that indicates whether a passphrase is usable. It should either decrypt a private key or return a passphrase to try. If the decrypted private key or given passphrase isn't correct, the function will be called again, forever. Any error returned will be passed up.

type SignParams

type SignParams struct {
	// Hints contains file metadata for the literal data packet.
	// If nil, default is used.
	Hints *FileHints
	// TextSig indicates if signatures of type SigTypeText should be produced
	TextSig bool
	// Config provides the config to be used.
	// If Config is nil, sensible defaults will be used.
	Config *packet.Config
}

type SignatureCandidate

type SignatureCandidate struct {
	OPSVersion        int
	SigType           packet.SignatureType
	HashAlgorithm     crypto.Hash
	PubKeyAlgo        packet.PublicKeyAlgorithm
	IssuerKeyId       uint64
	IssuerFingerprint []byte // v6 only
	Salt              []byte // v6 only

	SignedByEntity    *Entity
	SignedBy          *Key              // the key of the signer, if available. (OPS)
	SignatureError    error             // nil if the signature is valid or not checked.
	CorrespondingSig  *packet.Signature // the candidate's signature packet
	Hash, WrappedHash hash.Hash         // hashes for this signature candidate (OPS)
}

SignatureCandidate keeps state about a signature that can be potentially verified.

type Subkey

type Subkey struct {
	Primary     *Entity
	PublicKey   *packet.PublicKey
	PrivateKey  *packet.PrivateKey
	Bindings    []*packet.VerifiableSignature
	Revocations []*packet.VerifiableSignature
}

A Subkey is an additional public key in an Entity. Subkeys can be used for encryption.

func (*Subkey) Expired

func (s *Subkey) Expired(selectedSig *packet.Signature, date time.Time) bool

Expired checks if given the selected self-signature if the subkey is expired.

func (*Subkey) LatestValidBindingSignature

func (s *Subkey) LatestValidBindingSignature(date time.Time) (selectedSig *packet.Signature, err error)

LatestValidBindingSignature returns the latest valid self-signature of this subkey that is not newer than the provided date. Does not consider signatures/embedded signatures that are expired. If date is zero (i.e., date.IsZero() == true) the expiration checks are not performed. Returns a StructuralError if no valid self-signature is found.

func (*Subkey) ReSign

func (s *Subkey) ReSign(config *packet.Config) error

func (*Subkey) Revoke

func (s *Subkey) Revoke(reason packet.ReasonForRevocation, reasonText string, config *packet.Config) error

Revoke generates a subkey revocation signature (packet.SigTypeSubkeyRevocation) for a subkey with the specified reason code and text (RFC4880 section-5.2.3.23). If config is nil, sensible defaults will be used.

func (*Subkey) Revoked

func (s *Subkey) Revoked(selfCertification *packet.Signature, date time.Time) bool

Revoked returns whether the subkey has been revoked by a self-signature. Note that third-party revocation signatures are not supported.

func (*Subkey) Serialize

func (s *Subkey) Serialize(w io.Writer, includeSecrets bool) error

func (*Subkey) Verify

func (s *Subkey) Verify(date time.Time) (selfSig *packet.Signature, err error)

Verify checks if the subkey is valid by checking: - that the key is not revoked - that there is valid non-expired binding self-signature - that the subkey is not expired If date is zero (i.e., date.IsZero() == true) the time checks are not performed.

Directories

Path Synopsis
aes
keywrap
Package keywrap is an implementation of the RFC 3394 AES key wrapping algorithm.
Package keywrap is an implementation of the RFC 3394 AES key wrapping algorithm.
Package armor implements OpenPGP ASCII Armor, see RFC 4880.
Package armor implements OpenPGP ASCII Armor, see RFC 4880.
Package clearsign generates and processes OpenPGP, clear-signed data.
Package clearsign generates and processes OpenPGP, clear-signed data.
Package ecdh implements ECDH encryption, suitable for OpenPGP, as specified in RFC 6637, section 8.
Package ecdh implements ECDH encryption, suitable for OpenPGP, as specified in RFC 6637, section 8.
Package ecdsa implements ECDSA signature, suitable for OpenPGP, as specified in RFC 6637, section 5.
Package ecdsa implements ECDSA signature, suitable for OpenPGP, as specified in RFC 6637, section 5.
Package ed25519 implements the ed25519 signature algorithm for OpenPGP as defined in the Open PGP crypto refresh.
Package ed25519 implements the ed25519 signature algorithm for OpenPGP as defined in the Open PGP crypto refresh.
Package ed448 implements the ed448 signature algorithm for OpenPGP as defined in the Open PGP crypto refresh.
Package ed448 implements the ed448 signature algorithm for OpenPGP as defined in the Open PGP crypto refresh.
Package eddsa implements EdDSA signature, suitable for OpenPGP, as specified in https://datatracker.ietf.org/doc/html/draft-ietf-openpgp-crypto-refresh-06#section-13.7
Package eddsa implements EdDSA signature, suitable for OpenPGP, as specified in https://datatracker.ietf.org/doc/html/draft-ietf-openpgp-crypto-refresh-06#section-13.7
Package elgamal implements ElGamal encryption, suitable for OpenPGP, as specified in "A Public-Key Cryptosystem and a Signature Scheme Based on Discrete Logarithms," IEEE Transactions on Information Theory, v.
Package elgamal implements ElGamal encryption, suitable for OpenPGP, as specified in "A Public-Key Cryptosystem and a Signature Scheme Based on Discrete Logarithms," IEEE Transactions on Information Theory, v.
Package errors contains common error types for the OpenPGP packages.
Package errors contains common error types for the OpenPGP packages.
internal
ecc
Package ecc implements a generic interface for ECDH, ECDSA, and EdDSA.
Package ecc implements a generic interface for ECDH, ECDSA, and EdDSA.
encoding
Package encoding implements openpgp packet field encodings as specified in RFC 4880 and 6637.
Package encoding implements openpgp packet field encodings as specified in RFC 4880 and 6637.
Package packet implements parsing and serialization of OpenPGP packets, as specified in RFC 4880.
Package packet implements parsing and serialization of OpenPGP packets, as specified in RFC 4880.
Package s2k implements the various OpenPGP string-to-key transforms as specified in RFC 4800 section 3.7.1, and Argon2 specified in draft-ietf-openpgp-crypto-refresh-08 section 3.7.1.4.
Package s2k implements the various OpenPGP string-to-key transforms as specified in RFC 4800 section 3.7.1, and Argon2 specified in draft-ietf-openpgp-crypto-refresh-08 section 3.7.1.4.

Jump to

Keyboard shortcuts

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