package main import ( "crypto" "crypto/x509" "fmt" "os" "sync" "time" "golang.org/x/crypto/openpgp/packet" "golang.org/x/crypto/openpgp/s2k" ) // This file implements gnupg's "status protocol". When the --status-fd argument // is passed, gpg will output machine-readable status updates to that fd. // Details on the "protocol" can be found at https://git.io/vFFKC type status string const ( // BEGIN_SIGNING // Mark the start of the actual signing process. This may be used as an // indication that all requested secret keys are ready for use. sBeginSigning status = "BEGING_SIGNING" // SIG_CREATED // A signature has been created using these parameters. // Values for type are: // - D :: detached // - C :: cleartext // - S :: standard // (only the first character should be checked) // // are 2 hex digits with the OpenPGP signature class. // // Note, that TIMESTAMP may either be a number of seconds since Epoch // or an ISO 8601 string which can be detected by the presence of the // letter 'T'. sSigCreated status = "SIG_CREATED" // NEWSIG [] // Is issued right before a signature verification starts. This is // useful to define a context for parsing ERROR status messages. // arguments are currently defined. If SIGNERS_UID is given and is // not "-" this is the percent escape value of the OpenPGP Signer's // User ID signature sub-packet. sNewSig status = "NEWSIG" // GOODSIG // The signature with the keyid is good. For each signature only one // of the codes GOODSIG, BADSIG, EXPSIG, EXPKEYSIG, REVKEYSIG or // ERRSIG will be emitted. In the past they were used as a marker // for a new signature; new code should use the NEWSIG status // instead. The username is the primary one encoded in UTF-8 and %XX // escaped. The fingerprint may be used instead of the long keyid if // it is available. This is the case with CMS and might eventually // also be available for OpenPGP. sGoodSig status = "GOODSIG" // BADSIG // The signature with the keyid has not been verified okay. The username is // the primary one encoded in UTF-8 and %XX escaped. The fingerprint may be // used instead of the long keyid if it is available. This is the case with // CMS and might eventually also be available for OpenPGP. sBadSig status = "BADSIG" // ERRSIG