Documentation ¶
Overview ¶
Package openpgp parses, merges, validates, stores and searches OpenPGP public key material in RFC4880 format. Workers handle HKP requests, process their contents, and produce HKP responses.
Public key material is stored in a PostgreSQL database.
prc_CurrState
PRLPKS - OpenPGP Synchronized Key Server with Deletion Copyright (c) 2014 Pruthvirajsinh Rajendrasinh Chauhan
PRLPKS is based heavily on hockeypuck(https://launchpad.net/hockeypuck) by Casey Marshall, copyright 2013(GNU GPL v3).
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
prc_authority
PRLPKS - OpenPGP Synchronized Key Server with Deletion Copyright (c) 2014 Pruthvirajsinh Rajendrasinh Chauhan
PRLPKS is based heavily on hockeypuck(https://launchpad.net/hockeypuck) by Casey Marshall, copyright 2013(GNU GPL v3).
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
prcDelete
PRLPKS - OpenPGP Synchronized Key Server with Deletion Copyright (c) 2014 Pruthvirajsinh Rajendrasinh Chauhan
PRLPKS is based heavily on hockeypuck(https://launchpad.net/hockeypuck) by Casey Marshall, copyright 2013(GNU GPL v3).
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
prc_mailer
PRLPKS - OpenPGP Synchronized Key Server with Deletion Copyright (c) 2014 Pruthvirajsinh Rajendrasinh Chauhan
PRLPKS is based heavily on hockeypuck(https://launchpad.net/hockeypuck) by Casey Marshall, copyright 2013(GNU GPL v3).
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
prc_otl_handler
PRLPKS - OpenPGP Synchronized Key Server with Deletion Copyright (c) 2014 Pruthvirajsinh Rajendrasinh Chauhan
PRLPKS is based heavily on hockeypuck(https://launchpad.net/hockeypuck) by Casey Marshall, copyright 2013(GNU GPL v3).
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
prc_reconDelete
PRLPKS - OpenPGP Synchronized Key Server with Deletion Copyright (c) 2014 Pruthvirajsinh Rajendrasinh Chauhan
PRLPKS is based heavily on hockeypuck(https://launchpad.net/hockeypuck) by Casey Marshall, copyright 2013(GNU GPL v3).
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
prc_sksDelegate
PRLPKS - OpenPGP Synchronized Key Server with Deletion Copyright (c) 2014 Pruthvirajsinh Rajendrasinh Chauhan
PRLPKS is based heavily on hockeypuck(https://launchpad.net/hockeypuck) by Casey Marshall, copyright 2013(GNU GPL v3).
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
prc_verifier
PRLPKS - OpenPGP Synchronized Key Server with Deletion Copyright (c) 2014 Pruthvirajsinh Rajendrasinh Chauhan
PRLPKS is based heavily on hockeypuck(https://launchpad.net/hockeypuck) by Casey Marshall, copyright 2013(GNU GPL v3).
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Made Changes to be in sync with https://github.com/cmars/hockeypuck/commit/80151d7026c3225178f24151386ce871223669e2
Index ¶
- Constants
- Variables
- func AlgorithmCode(algorithm int) string
- func CheckImap() (err error)
- func Fingerprint(pubkey *packet.PublicKey) string
- func FingerprintV3(pubkey *packet.PublicKeyV3) string
- func GetEmailFromPubKey(publicKey Pubkey) (email string, err error)
- func GetExplicitAuths(email string) (err error)
- func GetFileContentsFromConfig(key string) (contents string, err error)
- func GetMailerConf() (mailer mailerConf, err error)
- func GetUuid(rec PacketRecord) string
- func IsAuhtorized(email string, verifiedDomains []string) (isVerified bool)
- func IsUnderAuth(publicKey Pubkey) (err error)
- func MergeKey(dstKey *Pubkey, srcKey *Pubkey)
- func MergeStatesInToLocal(remoteStates []AuthorizedState, remoteStatesInJSON string) (err error)
- func NewSksPTree(reconSettings *recon.Settings) (recon.PrefixTree, error)
- func NewUuid() (string, error)
- func PRCSendMail(addr string, a smtp.Auth, from string, to []string, msg []byte) (err error)
- func PrintState(state AuthorizedState) (msg string)
- func PtagToString(htmlString string) (output string, err error)
- func ReconGetRemoteStates(remoteAddr string) (remoteStatesInJSON string, err error)
- func RecoveryAuthentication(remoteStatesInJSON string) (verifiedDomains []string, err error)
- func Resolve(pubkey *Pubkey)
- func SaveToLocalStates(state AuthorizedState, remoteStatesInJSON string) (err error)
- func SendEmail(eMail_ID string, subject string, message string) (err error)
- func SignKeyAfterVerification(pubkeyArmor string) (signedKey string, err error)
- func SksDigest(key *Pubkey, h hash.Hash) string
- func Sort(pubkey *Pubkey)
- func UpdateOwnLocalState() (err error)
- func WriteArmoredPackets(w io.Writer, root PacketRecord) error
- func WritePackets(w io.Writer, root PacketRecord) error
- func WriteStatesToJSON(authStates []AuthorizedState) (opJSON string, err error)
- func WriteToFileFromConfig(key string, contents string) (err error)
- type AddResponse
- type AllStatesResponse
- type AllStatesResult
- type AuthForDomain
- type Authority
- func GetAuthForDomain(domainKey string, remoteStatesInJSON string) (authority Authority, err error)
- func GetAuthForEmail(email string, remoteStatesInJSON string) (auth Authority, err error)
- func GetAuthForHkpAddr(HkpAddrKey string, remoteStatesInJSON string) (authority Authority, err error)
- func GetOwnAuthority() (auth Authority, err error)
- type AuthorizedState
- func GetAllStatesDirectFromAuth(rcvr *recon.Recover) (allStates []AuthorizedState, err error)
- func GetAllStatesFromPeer(remoteAddr string) (allStates []AuthorizedState, err error)
- func GetLatestLocalStates() (allStates []AuthorizedState, err error)
- func GetOwnCurrentState(toPeer string) (currState AuthorizedState, err error)
- func GetStateForDomain(allStates []AuthorizedState, domain string) (stateForDomain AuthorizedState, err error)
- func GetStatesFromJSON(ipjson string) (authStates []AuthorizedState, err error)
- type DB
- type DeleteResponse
- type DeleteResult
- type ErrorResponse
- type ExplicitAuth
- type HashQueryResponse
- type HkpStats
- type IndexResponse
- type KeyChange
- type KeyChangeChan
- type KeyChangeType
- type KeyringResponse
- type Loader
- type LocalDeleteKey
- type MessageResponse
- type NotImplementedResponse
- type OpaqueKeyring
- type OpaqueKeyringChan
- type PacketRecord
- type PacketRecordMap
- type PacketState
- type PacketVisitor
- type PksAuthTXT
- type PksKeyStats
- type PksStatus
- type PksSync
- type Pubkey
- func (pubkey *Pubkey) AddSignature(sig *Signature)
- func (pubkey *Pubkey) AppendUnsupported(opkt *packet.OpaquePacket)
- func (pubkey *Pubkey) Fingerprint() string
- func (pubkey *Pubkey) GetOpaquePacket() (*packet.OpaquePacket, error)
- func (pubkey *Pubkey) GetPacket() (p packet.Packet, err error)
- func (pubkey *Pubkey) KeyId() string
- func (pubkey *Pubkey) Read() (err error)
- func (pubkey *Pubkey) RemoveSignature(sig *Signature)
- func (pubkey *Pubkey) Serialize(w io.Writer) error
- func (pubkey *Pubkey) ShortId() string
- func (pubkey *Pubkey) Subkeys() []*Subkey
- func (pubkey *Pubkey) UnsupportedPackets() (result []*packet.OpaquePacket)
- func (pubkey *Pubkey) UserIds() []*UserId
- func (pubkey *Pubkey) Uuid() string
- func (pubkey *Pubkey) Visit(visitor PacketVisitor) (err error)
- type PubkeyChan
- type ReadKeyResult
- type ReadKeyResults
- type ReconDeleteResponse
- type RecoverKey
- type RecoverKeyResponse
- type Settings
- func (s *Settings) DSN() string
- func (s *Settings) Driver() string
- func (s *Settings) NumWorkers() int
- func (s *Settings) PksFrom() string
- func (s *Settings) PksTo() []string
- func (s *Settings) SmtpHost() string
- func (s *Settings) SmtpId() string
- func (s *Settings) SmtpPass() string
- func (s *Settings) SmtpUser() string
- func (s *Settings) VerifySigs() bool
- type Signable
- type Signature
- func (sig *Signature) GetOpaquePacket() (*packet.OpaquePacket, error)
- func (sig *Signature) GetPacket() (p packet.Packet, err error)
- func (sig *Signature) GetSignature() (packet.Packet, error)
- func (sig *Signature) IsPrimary() bool
- func (sig *Signature) IssuerFingerprint() string
- func (sig *Signature) IssuerKeyId() string
- func (sig *Signature) IssuerShortId() string
- func (sig *Signature) Read() (err error)
- func (sig *Signature) Serialize(w io.Writer) error
- func (sig *Signature) Uuid() string
- func (sig *Signature) Visit(visitor PacketVisitor) (err error)
- type SksPeer
- type StatsResponse
- type Subkey
- func (subkey *Subkey) AddSignature(sig *Signature)
- func (subkey *Subkey) Fingerprint() string
- func (subkey *Subkey) GetOpaquePacket() (*packet.OpaquePacket, error)
- func (subkey *Subkey) GetPacket() (p packet.Packet, err error)
- func (subkey *Subkey) KeyId() string
- func (subkey *Subkey) Read() (err error)
- func (subkey *Subkey) RemoveSignature(sig *Signature)
- func (subkey *Subkey) Serialize(w io.Writer) error
- func (subkey *Subkey) ShortId() string
- func (subkey *Subkey) Signatures() []*Signature
- func (subkey *Subkey) Uuid() string
- func (subkey *Subkey) Visit(visitor PacketVisitor) (err error)
- type UserAttribute
- func (uat *UserAttribute) AddSignature(sig *Signature)
- func (uat *UserAttribute) GetOpaquePacket() (*packet.OpaquePacket, error)
- func (uat *UserAttribute) GetPacket() (packet.Packet, error)
- func (uat *UserAttribute) Read() (err error)
- func (uat *UserAttribute) RemoveSignature(sig *Signature)
- func (uat *UserAttribute) Serialize(w io.Writer) error
- func (uat *UserAttribute) Uuid() string
- func (uat *UserAttribute) Visit(visitor PacketVisitor) (err error)
- type UserId
- func (uid *UserId) AddSignature(sig *Signature)
- func (uid *UserId) GetOpaquePacket() (*packet.OpaquePacket, error)
- func (uid *UserId) GetPacket() (packet.Packet, error)
- func (uid *UserId) Read() (err error)
- func (uid *UserId) RemoveSignature(sig *Signature)
- func (uid *UserId) Serialize(w io.Writer) error
- func (uid *UserId) Signatures() []*Signature
- func (uid *UserId) Uuid() string
- func (uid *UserId) Visit(visitor PacketVisitor) (err error)
- type Veri_data
- type Worker
- func (w *Worker) Add(a *hkp.Add)
- func (w *Worker) FindChanges(key *Pubkey) (change *KeyChange)
- func (w *Worker) HandleAllStatesReq(allStatesReq *hkp.AllStatesReq)
- func (w *Worker) HandleDeleteReq(delReq *hkp.DeleteReq)
- func (w *Worker) HashQuery(hq *hkp.HashQuery)
- func (w *Worker) Lookup(l *hkp.Lookup)
- func (w *Worker) LookupHash(digest string) ([]*Pubkey, error)
- func (w *Worker) LookupKey(keyid string) (pubkey *Pubkey, err error)
- func (w *Worker) LookupKeys(search string, limit int) (keys []*Pubkey, err error)
- func (w *Worker) PRCOTLVerify(otlv *hkp.OTLVerify) (result_code int)
- func (w *Worker) Run()
- func (w *Worker) Stats(l *hkp.Lookup)
- func (w *Worker) SubKeyChanges(keyChanges KeyChangeChan) error
- func (w *Worker) UpdateKey(pubkey *Pubkey) (err error)
- func (w *Worker) UpdateKeyRelations(pubkey *Pubkey) (err error)
- func (w *Worker) UpsertKey(key *Pubkey) (change *KeyChange)
- func (w *Worker) Verify(eMail string, keytext string, req_Pubkey Pubkey, op int16) (isVerified bool, resultCode int)
- func (w *Worker) WriteKeys(wr io.Writer, uuids []string) error
Constants ¶
const ( OTLVerified int = 1 OTLNotFound int = 2 OTLExpired int = 3 OTLNotVerified int = 4 OTLAlereadyVerified int = 5 OTLNewOtlMade int = 6 ErrorSendingMail int = 7 )
const ( PubkeyStateOk = 0 PubkeyStateInvalid = iota )
const ( // Key material has been registered with prlpks by the key owner, // who has signed a nonced challenge message with the associated private key. PacketStateRegistered = 1 << 0 // Key material is cloaked. prlpks will respond as if the key does not exist // unless the HKP request has proper authentication. PacketStateCloaked = 1 << 1 // Signature has been checked and verified PacketStateSigOk = 1 << 2 // Key material is banned from HKP results unconditionally. Could be signature // graphiti or other unwanted content. PacketStateSpam = 1 << 16 // Key material is considered to be abandoned according to keyserver policy. PacketStateAbandoned = 1 << 17 // Key material lacks a valid, non-expired self-signature PacketStateNoSelfSig = 1 << 18 // Subkey material lacks a valid, non-expired binding-signature PacketStateNoBindingSig = 1 << 19 // Public key is unsupported (unknown algorithm code, etc.) PacketStateUnsuppPubkey = 1 << 20 )
const Cr_openpgp_pubkey = `` /* 1501-byte string literal not displayed */
const Cr_openpgp_pubkey_sig = `` /* 266-byte string literal not displayed */
const Cr_openpgp_sig = `` /* 881-byte string literal not displayed */
const Cr_openpgp_subkey = `` /* 955-byte string literal not displayed */
const Cr_openpgp_subkey_sig = `` /* 332-byte string literal not displayed */
const Cr_openpgp_uat = `` /* 824-byte string literal not displayed */
const Cr_openpgp_uat_sig = `` /* 311-byte string literal not displayed */
const Cr_openpgp_uid = `` /* 1046-byte string literal not displayed */
const Cr_openpgp_uid_sig = `` /* 315-byte string literal not displayed */
const Cr_pks_stat = `` /* 824-byte string literal not displayed */
const Cr_verify_email = `` /* 1040-byte string literal not displayed */
PRC EDIT Start
const ExpInDays int = 2
const LOOKUP_RESULT_LIMIT = 100
const MAX_DELAY = 60
Max delay backoff multiplier when smtp errors
const RequestChunkSize = 100
const SaltSize = 16
const UUID_LEN = 40
UUID_LEN is the size of unique primary keys generated for certain database records. The length is chosen to approximate 256 bits of security. When Ascii85 encoding is used, log(2**256, 85) = 39.9413926456896
Variables ¶
var Cr_openpgp_pubkey_constraints []string = []string{
`ALTER TABLE openpgp_pubkey ADD CONSTRAINT openpgp_pubkey_pk PRIMARY KEY (uuid);`,
`ALTER TABLE openpgp_pubkey ADD CONSTRAINT openpgp_pubkey_md5 UNIQUE (md5);`,
`ALTER TABLE openpgp_pubkey ADD CONSTRAINT openpgp_pubkey_sha256 UNIQUE (sha256);`}
var Cr_openpgp_pubkey_sig_constraints []string = []string{
`ALTER TABLE openpgp_pubkey_sig ADD CONSTRAINT openpgp_pubkey_sig_pk PRIMARY KEY (uuid);`,
`ALTER TABLE openpgp_pubkey_sig ADD CONSTRAINT openpgp_pubkey_sig_unique
UNIQUE (pubkey_uuid, sig_uuid);`,
`ALTER TABLE openpgp_pubkey_sig ADD CONSTRAINT openpgp_pubkey_sig_pubkey_fk
FOREIGN KEY (pubkey_uuid) REFERENCES openpgp_pubkey(uuid)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`,
`ALTER TABLE openpgp_pubkey_sig ADD CONSTRAINT openpgp_pubkey_sig_sig_fk
FOREIGN KEY (sig_uuid) REFERENCES openpgp_sig(uuid)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`}
var Cr_openpgp_sig_constraints []string = []string{
`ALTER TABLE openpgp_sig ADD CONSTRAINT openpgp_sig_pk PRIMARY KEY (uuid);`,
`ALTER TABLE openpgp_pubkey ADD CONSTRAINT openpgp_pubkey_revsig_fk
FOREIGN KEY (revsig_uuid) REFERENCES openpgp_sig(uuid)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`,
`ALTER TABLE openpgp_sig ADD CONSTRAINT openpgp_sig_signer_fk FOREIGN KEY (signer_uuid)
REFERENCES openpgp_pubkey(uuid) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`,
`ALTER TABLE openpgp_sig ADD CONSTRAINT openpgp_sig_rev_fk FOREIGN KEY (revsig_uuid)
REFERENCES openpgp_sig(uuid) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`}
var Cr_openpgp_subkey_constraints []string = []string{
`ALTER TABLE openpgp_subkey ADD CONSTRAINT openpgp_subkey_pk PRIMARY KEY (uuid);`,
`ALTER TABLE openpgp_subkey ADD CONSTRAINT openpgp_subkey_pubkey_fk
FOREIGN KEY (pubkey_uuid) REFERENCES openpgp_pubkey(uuid)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`,
`ALTER TABLE openpgp_subkey ADD CONSTRAINT openpgp_subkey_rev_fk
FOREIGN KEY (revsig_uuid) REFERENCES openpgp_sig(uuid)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`,
`CREATE INDEX openpgp_subkey_pubkey ON openpgp_subkey (pubkey_uuid);`}
var Cr_openpgp_subkey_sig_constraints []string = []string{
`ALTER TABLE openpgp_subkey_sig ADD CONSTRAINT openpgp_subkey_sig_pk PRIMARY KEY (uuid);`,
`ALTER TABLE openpgp_subkey_sig ADD CONSTRAINT openpgp_subkey_sig_unique
UNIQUE (subkey_uuid, sig_uuid);`,
`ALTER TABLE openpgp_subkey_sig ADD CONSTRAINT openpgp_subkey_sig_pubkey_fk
FOREIGN KEY (pubkey_uuid) REFERENCES openpgp_pubkey(uuid)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`,
`ALTER TABLE openpgp_subkey_sig ADD CONSTRAINT openpgp_subkey_sig_subkey_fk
FOREIGN KEY (subkey_uuid) REFERENCES openpgp_subkey(uuid)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`,
`ALTER TABLE openpgp_subkey_sig ADD CONSTRAINT openpgp_subkey_sig_sig_fk
FOREIGN KEY (sig_uuid) REFERENCES openpgp_sig(uuid)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`}
var Cr_openpgp_uat_constraints []string = []string{
`ALTER TABLE openpgp_uat ADD CONSTRAINT openpgp_uat_pk PRIMARY KEY (uuid);`,
`ALTER TABLE openpgp_uat ADD CONSTRAINT openpgp_uat_pubkey_fk
FOREIGN KEY (pubkey_uuid) REFERENCES openpgp_pubkey(uuid)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`,
`ALTER TABLE openpgp_pubkey ADD CONSTRAINT openpgp_pubkey_primary_uat_fk
FOREIGN KEY (primary_uat) REFERENCES openpgp_uat(uuid)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`,
`ALTER TABLE openpgp_uat ADD CONSTRAINT openpgp_uat_rev_fk
FOREIGN KEY (revsig_uuid) REFERENCES openpgp_sig(uuid)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`,
`CREATE INDEX openpgp_uat_pubkey ON openpgp_uat (pubkey_uuid);`}
var Cr_openpgp_uat_sig_constraints []string = []string{
`ALTER TABLE openpgp_uat_sig ADD CONSTRAINT openpgp_uat_sig_pk PRIMARY KEY (uuid);`,
`ALTER TABLE openpgp_uat_sig ADD CONSTRAINT openpgp_uat_sig_unique
UNIQUE (uat_uuid, sig_uuid);`,
`ALTER TABLE openpgp_uat_sig ADD CONSTRAINT openpgp_uat_sig_pubkey_fk
FOREIGN KEY (pubkey_uuid) REFERENCES openpgp_pubkey(uuid)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`,
`ALTER TABLE openpgp_uat_sig ADD CONSTRAINT openpgp_uat_sig_uat_fk
FOREIGN KEY (uat_uuid) REFERENCES openpgp_uat(uuid)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`,
`ALTER TABLE openpgp_uat_sig ADD CONSTRAINT openpgp_uat_sig_sig_fk
FOREIGN KEY (sig_uuid) REFERENCES openpgp_sig(uuid)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`}
var Cr_openpgp_uid_constraints []string = []string{
`ALTER TABLE openpgp_uid ADD CONSTRAINT openpgp_uid_pk PRIMARY KEY (uuid);`,
`ALTER TABLE openpgp_uid ADD CONSTRAINT openpgp_uid_pubkey_fk
FOREIGN KEY (pubkey_uuid) REFERENCES openpgp_pubkey(uuid)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`,
`ALTER TABLE openpgp_pubkey ADD CONSTRAINT openpgp_pubkey_primary_uid_fk
FOREIGN KEY (primary_uid) REFERENCES openpgp_uid(uuid)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`,
`ALTER TABLE openpgp_uid ADD CONSTRAINT openpgp_uid_rev_fk
FOREIGN KEY (revsig_uuid) REFERENCES openpgp_sig(uuid)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`,
`CREATE INDEX openpgp_uid_pubkey ON openpgp_uid (pubkey_uuid);`,
`CREATE INDEX openpgp_uid_fulltext_idx ON openpgp_uid USING gin(keywords_fulltext);`}
var Cr_openpgp_uid_sig_constraints []string = []string{
`ALTER TABLE openpgp_uid_sig ADD CONSTRAINT openpgp_uid_sig_pk PRIMARY KEY (uuid);`,
`ALTER TABLE openpgp_uid_sig ADD CONSTRAINT openpgp_uid_sig_unique
UNIQUE (uid_uuid, sig_uuid);`,
`ALTER TABLE openpgp_uid_sig ADD CONSTRAINT openpgp_uid_sig_pubkey_fk
FOREIGN KEY (pubkey_uuid) REFERENCES openpgp_pubkey(uuid)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`,
`ALTER TABLE openpgp_uid_sig ADD CONSTRAINT openpgp_uid_sig_uid_fk
FOREIGN KEY (uid_uuid) REFERENCES openpgp_uid(uuid)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`,
`ALTER TABLE openpgp_uid_sig ADD CONSTRAINT openpgp_uid_sig_sig_fk
FOREIGN KEY (sig_uuid) REFERENCES openpgp_sig(uuid)
ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;`}
var CreateConstraintsSql [][]string = [][]string{ Cr_openpgp_pubkey_constraints, Cr_openpgp_sig_constraints, Cr_openpgp_subkey_constraints, Cr_openpgp_uid_constraints, Cr_openpgp_uat_constraints, Cr_openpgp_pubkey_sig_constraints, Cr_openpgp_subkey_sig_constraints, Cr_openpgp_uid_sig_constraints, Cr_openpgp_uat_sig_constraints}
var CreateTablesSql []string = []string{ Cr_openpgp_pubkey, Cr_openpgp_sig, Cr_openpgp_subkey, Cr_openpgp_uid, Cr_openpgp_uat, Cr_openpgp_pubkey_sig, Cr_openpgp_subkey_sig, Cr_openpgp_uid_sig, Cr_openpgp_uat_sig, Cr_pks_stat, Cr_verify_email}
var DeleteDuplicatesSql []string
var Dr_openpgp_pubkey_constraints []string = []string{
`ALTER TABLE openpgp_pubkey DROP CONSTRAINT openpgp_pubkey_pk;`,
`ALTER TABLE openpgp_pubkey DROP CONSTRAINT openpgp_pubkey_md5;`,
`ALTER TABLE openpgp_pubkey DROP CONSTRAINT openpgp_pubkey_sha256;`,
`ALTER TABLE openpgp_pubkey DROP CONSTRAINT openpgp_pubkey_primary_uid_fk;`,
`ALTER TABLE openpgp_pubkey DROP CONSTRAINT openpgp_pubkey_primary_uat_fk;`,
`ALTER TABLE openpgp_pubkey DROP CONSTRAINT openpgp_pubkey_revsig_fk;`}
var Dr_openpgp_pubkey_sig_constraints []string = []string{
`ALTER TABLE openpgp_pubkey_sig DROP CONSTRAINT openpgp_pubkey_sig_pk;`,
`ALTER TABLE openpgp_pubkey_sig DROP CONSTRAINT openpgp_pubkey_sig_unique;`,
`ALTER TABLE openpgp_pubkey_sig DROP CONSTRAINT openpgp_pubkey_sig_pubkey_fk;`,
`ALTER TABLE openpgp_pubkey_sig DROP CONSTRAINT openpgp_pubkey_sig_sig_fk;`}
var Dr_openpgp_sig_constraints []string = []string{
`ALTER TABLE openpgp_sig DROP CONSTRAINT openpgp_sig_pk;`,
`ALTER TABLE openpgp_sig DROP CONSTRAINT openpgp_sig_signer_fk;`,
`ALTER TABLE openpgp_sig DROP CONSTRAINT openpgp_sig_rev_fk;`}
var Dr_openpgp_subkey_constraints []string = []string{
`ALTER TABLE openpgp_subkey DROP CONSTRAINT openpgp_subkey_pk;`,
`ALTER TABLE openpgp_subkey DROP CONSTRAINT openpgp_subkey_pubkey_fk;`,
`ALTER TABLE openpgp_subkey DROP CONSTRAINT openpgp_subkey_rev_fk;`}
var Dr_openpgp_subkey_sig_constraints []string = []string{
`ALTER TABLE openpgp_subkey_sig DROP CONSTRAINT openpgp_subkey_sig_pk;`,
`ALTER TABLE openpgp_subkey_sig DROP CONSTRAINT openpgp_subkey_sig_unique;`,
`ALTER TABLE openpgp_subkey_sig DROP CONSTRAINT openpgp_subkey_sig_pubkey_fk;`,
`ALTER TABLE openpgp_subkey_sig DROP CONSTRAINT openpgp_subkey_sig_subkey_fk;`,
`ALTER TABLE openpgp_subkey_sig DROP CONSTRAINT openpgp_subkey_sig_sig_fk;`}
var Dr_openpgp_uat_constraints []string = []string{
`ALTER TABLE openpgp_uat DROP CONSTRAINT openpgp_uat_pk;`,
`ALTER TABLE openpgp_uat DROP CONSTRAINT openpgp_uat_pubkey_fk;`,
`ALTER TABLE openpgp_uat DROP CONSTRAINT openpgp_uat_rev_fk;`}
var Dr_openpgp_uat_sig_constraints []string = []string{
`ALTER TABLE openpgp_uat_sig DROP CONSTRAINT openpgp_uat_sig_pk;`,
`ALTER TABLE openpgp_uat_sig DROP CONSTRAINT openpgp_uat_sig_unique;`,
`ALTER TABLE openpgp_uat_sig DROP CONSTRAINT openpgp_uat_sig_pubkey_fk;`,
`ALTER TABLE openpgp_uat_sig DROP CONSTRAINT openpgp_uat_sig_uat_fk;`,
`ALTER TABLE openpgp_uat_sig DROP CONSTRAINT openpgp_uat_sig_sig_fk;`}
var Dr_openpgp_uid_constraints []string = []string{
`ALTER TABLE openpgp_uid DROP CONSTRAINT openpgp_uid_pk;`,
`ALTER TABLE openpgp_uid DROP CONSTRAINT openpgp_uid_pubkey_fk;`,
`ALTER TABLE openpgp_uid DROP CONSTRAINT openpgp_uid_rev_fk;`,
`DROP INDEX openpgp_uid_fulltext_idx;`}
var Dr_openpgp_uid_sig_constraints []string = []string{
`ALTER TABLE openpgp_uid_sig DROP CONSTRAINT openpgp_uid_sig_pk;`,
`ALTER TABLE openpgp_uid_sig DROP CONSTRAINT openpgp_uid_sig_unique;`,
`ALTER TABLE openpgp_uid_sig DROP CONSTRAINT openpgp_uid_sig_pubkey_fk;`,
`ALTER TABLE openpgp_uid_sig DROP CONSTRAINT openpgp_uid_sig_uid_fk;`,
`ALTER TABLE openpgp_uid_sig DROP CONSTRAINT openpgp_uid_sig_sig_fk;`}
var DropConstraintsSql [][]string = [][]string{ Dr_openpgp_pubkey_constraints, Dr_openpgp_sig_constraints, Dr_openpgp_subkey_constraints, Dr_openpgp_uid_constraints, Dr_openpgp_uat_constraints, Dr_openpgp_pubkey_sig_constraints, Dr_openpgp_subkey_sig_constraints, Dr_openpgp_uid_sig_constraints, Dr_openpgp_uat_sig_constraints}
var ErrInternalKeyInvalid error = errors.New("Internal integrity error matching key")
var ErrInvalidPacketType error = errors.New("Invalid packet type")
var ErrMissingSignature = errors.New("Key material missing an expected signature")
var ErrMissingUuid error = errors.New("Packet record missing content-unique identifier")
var ErrPacketRecordState error = errors.New("Packet record state has not been properly initialized")
var ErrSubKeyChanges error = errors.New("Worker already has a key change subscriber")
ErrSubKeyChanges is an error occurring when attempting to subscribe to KeyChange messages on a worker that already has a subscriber.
var NeverExpires time.Time
Comparable time flag for "never expires"
Functions ¶
func AlgorithmCode ¶
func CheckImap ¶
func CheckImap() (err error)
IMAP CheckImap() checks Imap inbox for any PGP requests ,numRequests returns number of Emails found with GPG requests.
func Fingerprint ¶
Get the public key fingerprint as a hex string.
func FingerprintV3 ¶
func FingerprintV3(pubkey *packet.PublicKeyV3) string
Get the public key fingerprint as a hex string.
func GetEmailFromPubKey ¶
func GetExplicitAuths ¶
func GetMailerConf ¶
func GetMailerConf() (mailer mailerConf, err error)
Get Email Server Configuration from Config File
func GetUuid ¶
func GetUuid(rec PacketRecord) string
func IsAuhtorized ¶
func IsUnderAuth ¶
func MergeKey ¶
Merge the contents of srcKey into dstKey, modifying in-place. Packets in src not found in dst are appended to the matching parent. Conflicting packets and unmatched parents are ignored.
func MergeStatesInToLocal ¶
func MergeStatesInToLocal(remoteStates []AuthorizedState, remoteStatesInJSON string) (err error)
func NewSksPTree ¶
func NewSksPTree(reconSettings *recon.Settings) (recon.PrefixTree, error)
func PRCSendMail ¶
PRCSendMail connects to the server at addr, switches to TLS if possible, authenticates with the optional mechanism a if possible, and then sends an email from address from, to addresses to, with message msg.
func PrintState ¶
func PrintState(state AuthorizedState) (msg string)
func PtagToString ¶
func ReconGetRemoteStates ¶
func RecoveryAuthentication ¶
func Resolve ¶
func Resolve(pubkey *Pubkey)
Resolve resolves and connects relationship references between the different packet records in the key material.
func SaveToLocalStates ¶
func SaveToLocalStates(state AuthorizedState, remoteStatesInJSON string) (err error)
func SksDigest ¶
SksDigest calculates a cumulative message digest on all OpenPGP packets for a given primary public key, using the same ordering as SKS, the Synchronizing Key Server. Use MD5 for matching digest values with SKS.
func UpdateOwnLocalState ¶
func UpdateOwnLocalState() (err error)
func WriteArmoredPackets ¶
func WriteArmoredPackets(w io.Writer, root PacketRecord) error
func WritePackets ¶
func WritePackets(w io.Writer, root PacketRecord) error
func WriteStatesToJSON ¶
func WriteStatesToJSON(authStates []AuthorizedState) (opJSON string, err error)
func WriteToFileFromConfig ¶
Types ¶
type AddResponse ¶
type AddResponse struct { Changes []*KeyChange Errors []*ReadKeyResult }
func (*AddResponse) Error ¶
func (r *AddResponse) Error() error
func (*AddResponse) WriteTo ¶
func (r *AddResponse) WriteTo(w http.ResponseWriter) (err error)
type AllStatesResponse ¶
type AllStatesResponse struct {
AllStatesResults []*AllStatesResult
}
PRC START
func (*AllStatesResponse) Error ¶
func (r *AllStatesResponse) Error() error
func (*AllStatesResponse) WriteTo ¶
func (r *AllStatesResponse) WriteTo(w http.ResponseWriter) (err error)
type AllStatesResult ¶
type AllStatesResult struct {
// contains filtered or unexported fields
}
type AuthForDomain ¶
type AuthForDomain struct {
// contains filtered or unexported fields
}
func GetAuthForAllDomains ¶
func GetAuthForAllDomains(remoteStatesInJSON string) (authsForDomains []AuthForDomain, err error)
func GetAuthsForDomFromStates ¶
func GetAuthsForDomFromStates(remoteStatesInJSON string) (authsForDomains []AuthForDomain, err error)
type Authority ¶
type Authority struct { HkpAddr string //Address in string format of the machine of authority DomainsUnderAuth []string //Domains which are under this authority EmailOfAuthority string //e.g. admin@authorize.com AsciiPubKeyOfAuth string //Ascii Armored Public Key of Auhtority }
func GetAuthForDomain ¶
func GetAuthForEmail ¶
func GetAuthForHkpAddr ¶
func GetOwnAuthority ¶
type AuthorizedState ¶
type AuthorizedState struct { TimeStamp int64 FromAuthority Authority ToPeer string //HkpAddr of direct peer of authority AsciiSigOfState string }
func GetAllStatesDirectFromAuth ¶
func GetAllStatesDirectFromAuth(rcvr *recon.Recover) (allStates []AuthorizedState, err error)
func GetAllStatesFromPeer ¶
func GetAllStatesFromPeer(remoteAddr string) (allStates []AuthorizedState, err error)
func GetLatestLocalStates ¶
func GetLatestLocalStates() (allStates []AuthorizedState, err error)
func GetOwnCurrentState ¶
func GetOwnCurrentState(toPeer string) (currState AuthorizedState, err error)
func GetStateForDomain ¶
func GetStateForDomain(allStates []AuthorizedState, domain string) (stateForDomain AuthorizedState, err error)
func GetStatesFromJSON ¶
func GetStatesFromJSON(ipjson string) (authStates []AuthorizedState, err error)
func (*AuthorizedState) GetStateString ¶
func (ast *AuthorizedState) GetStateString() (stateString string, err error)
func (*AuthorizedState) SignState ¶
func (ast *AuthorizedState) SignState(asciiPriKey string, pripwd string) (err error)
func (*AuthorizedState) VerifyState ¶
func (ast *AuthorizedState) VerifyState(asciiPubKey string) (err error)
type DB ¶
func (*DB) CreateConstraints ¶
func (*DB) CreateSchema ¶
func (*DB) CreateTables ¶
func (*DB) DeleteDuplicates ¶
func (*DB) DropConstraints ¶
type DeleteResponse ¶
type DeleteResponse struct {
DeleteResults []*DeleteResult
}
PRC START
func (*DeleteResponse) Error ¶
func (r *DeleteResponse) Error() error
func (*DeleteResponse) WriteTo ¶
func (r *DeleteResponse) WriteTo(w http.ResponseWriter) (err error)
type DeleteResult ¶
type ErrorResponse ¶
type ErrorResponse struct {
Err error
}
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() error
func (*ErrorResponse) WriteTo ¶
func (r *ErrorResponse) WriteTo(w http.ResponseWriter) error
type ExplicitAuth ¶
type ExplicitAuth struct {
Emails []string //Emails that we are explicitly authorizing ourselves to handle.
}
type HashQueryResponse ¶
type HashQueryResponse struct {
Keys []*Pubkey
}
func (*HashQueryResponse) Error ¶
func (hq *HashQueryResponse) Error() error
func (*HashQueryResponse) WriteTo ¶
func (hq *HashQueryResponse) WriteTo(w http.ResponseWriter) (err error)
type HkpStats ¶
type HkpStats struct { *Worker Timestamp time.Time Hostname string Port int Version string PksPeers []PksStatus TotalKeys int `db:"total_keys"` KeyStatsHourly []PksKeyStats KeyStatsDaily []PksKeyStats }
type IndexResponse ¶
type IndexResponse struct { Lookup *hkp.Lookup Keys []*Pubkey Verbose bool Err error Delegated bool //IF lookup was delegated to other PKS Server then it is true Msg string //Message to be shown on html index page }
PRC Edit Start
func (*IndexResponse) Error ¶
func (r *IndexResponse) Error() error
func (*IndexResponse) WriteTo ¶
func (r *IndexResponse) WriteTo(w http.ResponseWriter) error
type KeyChange ¶
type KeyChange struct { // Fingerprint is the public key fingerprint Fingerprint string // CurrentMd5 contains the new digest of the key (SKS compatible). CurrentMd5 string // PreviousMd5 contains the digest of the key prior to update, if any (SKS compatible). PreviousMd5 string // CurrentSha256 contains the new digest of the key. CurrentSha256 string // PreviousSha256 contains the digest of the key prior to update, if any. PreviousSha256 string // Error captures the error that prevented the change from occurring, otherwise nil. Error error // Type indicates the type of key change that occurred, as indicated by KeyChangeType. Type KeyChangeType //Message to be displayed at addResponse Screen ChangeMessage string }
KeyChange describes the change made to a public key resulting from a /pks/add HKP request.
type KeyChangeChan ¶
type KeyChangeChan chan *KeyChange
type KeyChangeType ¶
type KeyChangeType int
KeyChangeType identifies the type of change that a worker has made to a public key.
const ( // KeyChangeInvalid indicates that the attempted key change information // does not describe an expected, valid event. KeyChangeInvalid KeyChangeType = iota // KeyNotChanged indicates that a request to update an existing public key // did not result in any change or addition of new key material. KeyNotChanged KeyChangeType = iota // KeyAdded indicates a new key was added to the database. KeyAdded KeyChangeType = iota // KeyModified indicates that an existing key was updated with new information. KeyModified KeyChangeType = iota //PRC Start //Key is Deleted KeyDeleted KeyChangeType = iota //Key Replaces current key as emails are same KeyReplaced KeyChangeType = iota //OTL is not verified yet EmailNotVerified KeyChangeType = iota //We are not authority for domain of the email,hence can not accept NotInOurAuthority KeyChangeType = iota )
type KeyringResponse ¶
type KeyringResponse struct {
Keys []*Pubkey
}
func (*KeyringResponse) Error ¶
func (k *KeyringResponse) Error() error
func (*KeyringResponse) WriteTo ¶
func (k *KeyringResponse) WriteTo(w http.ResponseWriter) error
type LocalDeleteKey ¶
type LocalDeleteKey struct { Keytext []byte // contains filtered or unexported fields }
type MessageResponse ¶
func (*MessageResponse) Error ¶
func (r *MessageResponse) Error() error
func (*MessageResponse) WriteTo ¶
func (r *MessageResponse) WriteTo(w http.ResponseWriter) error
type NotImplementedResponse ¶
type NotImplementedResponse struct { }
func (*NotImplementedResponse) Error ¶
func (e *NotImplementedResponse) Error() error
func (*NotImplementedResponse) WriteTo ¶
func (e *NotImplementedResponse) WriteTo(w http.ResponseWriter) error
type OpaqueKeyring ¶
type OpaqueKeyringChan ¶
type OpaqueKeyringChan chan *OpaqueKeyring
func ReadOpaqueKeyrings ¶
func ReadOpaqueKeyrings(r io.Reader) OpaqueKeyringChan
type PacketRecord ¶
type PacketRecordMap ¶
type PacketRecordMap map[string]PacketRecord
func MapKey ¶
func MapKey(pubkey *Pubkey) PacketRecordMap
Map a tree of packet objects by strong hash.
func (PacketRecordMap) Add ¶
func (m PacketRecordMap) Add(rec PacketRecord) error
type PacketState ¶
type PacketState int
PacketState indicates the validity of the public key material and special policies that may apply to it. The lower 16 bits are either neutral policy or positive validation indicators. The upper 16 bits indicate validation failure that the key material is either invalid, unverifiable or failed to meet some policy criteria.
type PacketVisitor ¶
type PacketVisitor func(PacketRecord) error
type PksAuthTXT ¶
type PksAuthTXT struct {
// contains filtered or unexported fields
}
func GetPksAuthTXTRecord ¶
func GetPksAuthTXTRecord(domain string) (pksAuth PksAuthTXT, err error)
type PksKeyStats ¶
type PksKeyStats struct { Timestamp time.Time `db:"start"` Created int `db:"created"` Modified int `db:"modified"` }
func (*PksKeyStats) Day ¶
func (s *PksKeyStats) Day() string
func (*PksKeyStats) Hour ¶
func (s *PksKeyStats) Hour() string
type PksStatus ¶
type PksStatus struct { // Email address of the PKS server. Addr string `db:"email_addr"` // Timestamp of the last sync to this server. LastSync time.Time `db:"last_sync"` }
Status of PKS synchronization
type PksSync ¶
type PksSync struct { *Worker // Our PKS email address, which goes into the From: address outbound MailFrom string // Remote PKS servers we are sending updates to PksAddrs []string // SMTP host used to send email SmtpHost string // SMTP authentication SmtpAuth smtp.Auth // contains filtered or unexported fields }
Basic implementation of outbound PKS synchronization
func NewPksSync ¶
Initialize from command line switches if fields not set.
func (*PksSync) SyncStatus ¶
type Pubkey ¶
type Pubkey struct { RFingerprint string `db:"uuid"` // immutable Creation time.Time `db:"creation"` // immutable Expiration time.Time `db:"expiration"` // mutable State int `db:"state"` // mutable Packet []byte `db:"packet"` // immutable Ctime time.Time `db:"ctime"` // immutable Mtime time.Time `db:"mtime"` // mutable Md5 string `db:"md5"` // mutable Sha256 string `db:"sha256"` // mutable RevSigDigest sql.NullString `db:"revsig_uuid"` // mutable PrimaryUid sql.NullString `db:"primary_uid"` // mutable PrimaryUat sql.NullString `db:"primary_uat"` // mutable Algorithm int `db:"algorithm"` // immutable BitLen int `db:"bit_len"` // immutable Unsupported []byte `db:"unsupp"` // mutable PublicKey *packet.PublicKey PublicKeyV3 *packet.PublicKeyV3 // contains filtered or unexported fields }
Pubkey represents an OpenPGP public key packet. Searchable fields are extracted from the packet key material stored in Packet, for database indexing.
func DelegateToSKS ¶
func (*Pubkey) AddSignature ¶
func (*Pubkey) AppendUnsupported ¶
func (pubkey *Pubkey) AppendUnsupported(opkt *packet.OpaquePacket)
func (*Pubkey) Fingerprint ¶
func (*Pubkey) GetOpaquePacket ¶
func (pubkey *Pubkey) GetOpaquePacket() (*packet.OpaquePacket, error)
func (*Pubkey) RemoveSignature ¶
func (*Pubkey) UnsupportedPackets ¶
func (pubkey *Pubkey) UnsupportedPackets() (result []*packet.OpaquePacket)
func (*Pubkey) Visit ¶
func (pubkey *Pubkey) Visit(visitor PacketVisitor) (err error)
type PubkeyChan ¶
type PubkeyChan chan *ReadKeyResult
func ReadKeys ¶
func ReadKeys(r io.Reader) PubkeyChan
type ReadKeyResult ¶
func ErrReadKeys ¶
func ErrReadKeys(msg string) *ReadKeyResult
type ReadKeyResults ¶
type ReadKeyResults []*ReadKeyResult
func (ReadKeyResults) GoodKeys ¶
func (r ReadKeyResults) GoodKeys() (result []*Pubkey)
type ReconDeleteResponse ¶
PRC Start
func (*ReconDeleteResponse) Error ¶
func (r *ReconDeleteResponse) Error() error
func (*ReconDeleteResponse) WriteTo ¶
func (r *ReconDeleteResponse) WriteTo(w http.ResponseWriter) error
type RecoverKey ¶
type RecoverKeyResponse ¶
func (*RecoverKeyResponse) Error ¶
func (r *RecoverKeyResponse) Error() error
func (*RecoverKeyResponse) WriteTo ¶
func (r *RecoverKeyResponse) WriteTo(w http.ResponseWriter) error
type Settings ¶
func (*Settings) VerifySigs ¶
type Signature ¶
type Signature struct { ScopedDigest string `db:"uuid"` // immutable Creation time.Time `db:"creation"` // immutable Expiration time.Time `db:"expiration"` // immutable State int `db:"state"` // mutable Packet []byte `db:"packet"` // immutable SigType int `db:"sig_type"` // immutable RIssuerKeyId string `db:"signer"` // immutable RIssuerFingerprint sql.NullString `db:"signer_uuid"` // mutable RevSigDigest sql.NullString `db:"revsig_uuid"` // mutable Signature *packet.Signature SignatureV3 *packet.SignatureV3 // contains filtered or unexported fields }
func NewSignature ¶
func NewSignature(op *packet.OpaquePacket) (sig *Signature, err error)
func (*Signature) GetOpaquePacket ¶
func (sig *Signature) GetOpaquePacket() (*packet.OpaquePacket, error)
func (*Signature) IssuerFingerprint ¶
func (*Signature) IssuerKeyId ¶
func (*Signature) IssuerShortId ¶
func (*Signature) Visit ¶
func (sig *Signature) Visit(visitor PacketVisitor) (err error)
type SksPeer ¶
type SksPeer struct { *recon.Peer Service *hkp.Service RecoverKey chan *RecoverKey KeyChanges KeyChangeChan LocalDeleteKey chan *LocalDeleteKey }
func (*SksPeer) HandleKeyUpdates ¶
func (r *SksPeer) HandleKeyUpdates()
func (*SksPeer) HandleRecovery ¶
func (r *SksPeer) HandleRecovery()
type StatsResponse ¶
func (*StatsResponse) Error ¶
func (r *StatsResponse) Error() error
func (*StatsResponse) WriteTo ¶
func (r *StatsResponse) WriteTo(w http.ResponseWriter) (err error)
type Subkey ¶
type Subkey struct { RFingerprint string `db:"uuid"` // immutable Creation time.Time `db:"creation"` // immutable Expiration time.Time `db:"expiration"` // mutable State int `db:"state"` // mutable Packet []byte `db:"packet"` // immutable PubkeyRFP string `db:"pubkey_uuid"` // immutable RevSigDigest sql.NullString `db:"revsig_uuid"` // mutable Algorithm int `db:"algorithm"` // immutable BitLen int `db:"bit_len"` // immutable PublicKey *packet.PublicKey PublicKeyV3 *packet.PublicKeyV3 // contains filtered or unexported fields }
func (*Subkey) AddSignature ¶
func (*Subkey) Fingerprint ¶
func (*Subkey) GetOpaquePacket ¶
func (subkey *Subkey) GetOpaquePacket() (*packet.OpaquePacket, error)
func (*Subkey) RemoveSignature ¶
func (*Subkey) Signatures ¶
func (*Subkey) Visit ¶
func (subkey *Subkey) Visit(visitor PacketVisitor) (err error)
type UserAttribute ¶
type UserAttribute struct { ScopedDigest string `db:"uuid"` // immutable Creation time.Time `db:"creation"` // mutable (derived from latest sigs) Expiration time.Time `db:"expiration"` // mutable State int `db:"state"` // mutable Packet []byte `db:"packet"` // immutable PubkeyRFP string `db:"pubkey_uuid"` // immutable RevSigDigest sql.NullString `db:"revsig_uuid"` // mutable UserAttribute *packet.UserAttribute // contains filtered or unexported fields }
func NewUserAttribute ¶
func NewUserAttribute(op *packet.OpaquePacket) (uat *UserAttribute, err error)
func (*UserAttribute) AddSignature ¶
func (uat *UserAttribute) AddSignature(sig *Signature)
func (*UserAttribute) GetOpaquePacket ¶
func (uat *UserAttribute) GetOpaquePacket() (*packet.OpaquePacket, error)
func (*UserAttribute) Read ¶
func (uat *UserAttribute) Read() (err error)
func (*UserAttribute) RemoveSignature ¶
func (uat *UserAttribute) RemoveSignature(sig *Signature)
func (*UserAttribute) Uuid ¶
func (uat *UserAttribute) Uuid() string
func (*UserAttribute) Visit ¶
func (uat *UserAttribute) Visit(visitor PacketVisitor) (err error)
type UserId ¶
type UserId struct { ScopedDigest string `db:"uuid"` // immutable Creation time.Time `db:"creation"` // mutable (derived from latest sigs) Expiration time.Time `db:"expiration"` // mutable State int `db:"state"` // mutable Packet []byte `db:"packet"` // immutable PubkeyRFP string `db:"pubkey_uuid"` // immutable RevSigDigest sql.NullString `db:"revsig_uuid"` // mutable Keywords string `db:"keywords"` // immutable UserId *packet.UserId // contains filtered or unexported fields }
func (*UserId) AddSignature ¶
func (*UserId) GetOpaquePacket ¶
func (uid *UserId) GetOpaquePacket() (*packet.OpaquePacket, error)
func (*UserId) RemoveSignature ¶
func (*UserId) Signatures ¶
func (*UserId) Visit ¶
func (uid *UserId) Visit(visitor PacketVisitor) (err error)
type Veri_data ¶
type Veri_data struct { //Database values //otl_hash,req_email,req_time,verify_time,verified,req_pubkey Req_email string `db:"req_email"` // immutable Hash_pubkey string `db:"hash_pubkey"` //immutable Packet []byte `db:"packet"` // immutable Otl_hash string `db:"otl_hash"` // mutable Req_time time.Time `db:"req_time"` // immutable Veri_time time.Time `db:"veri_time"` // mutable Expi_time time.Time `db:"expi_time"` //immutable Is_verified bool `db:"is_verified"` // mutable Key_text string `db:"key_text"` // immutable Pubkey_id string `db:"pubkey_id"` //immutable Operation int16 `db:"operation"` //1 for add , 2 for delete }
type Worker ¶
type Worker struct { *Loader Service *hkp.Service Peer *SksPeer // contains filtered or unexported fields }
func (*Worker) FindChanges ¶
PRC START : ONLY FINDS changes required g\for incoming request
func (*Worker) HandleAllStatesReq ¶
func (w *Worker) HandleAllStatesReq(allStatesReq *hkp.AllStatesReq)
func (*Worker) HandleDeleteReq ¶
func (*Worker) LookupKeys ¶
func (*Worker) SubKeyChanges ¶
func (w *Worker) SubKeyChanges(keyChanges KeyChangeChan) error
SubKeyChanges subscribes a KeyChange channel to receive updates on any keys added or updated by this worker.
func (*Worker) UpdateKey ¶
PRC END UpdateKey updates the database to the contents of the given public key.
func (*Worker) UpdateKeyRelations ¶
UpdateKeyRelations updates the foreign-key relations between matching public key packet records to represent the state of the given public key.
func (*Worker) Verify ¶
func (w *Worker) Verify(eMail string, keytext string, req_Pubkey Pubkey, op int16) (isVerified bool, resultCode int)
op 1=add op 2=delete Verification process
DONE 1. extract email ID from go.crypto/openpgp/packet struct userID DONE 2. lookup in to db for (e-mail,sha256_key) pair,if verified return true DONE 3. generate a random otl_hash for key DONE 4. add in to mail_verify db(e-mail,sha256_key,otl_hash,req_time,verify_time,verified,pubkey_packet,pub_key_ID) DONE 5. call sendmail with otl and email
Source Files ¶
- add.go
- config.go
- db.go
- doc.go
- index.go
- io.go
- loader.go
- merge.go
- pks.go
- prc_CurrState.go
- prc_authority.go
- prc_delete.go
- prc_mailer.go
- prc_otl_handler.go
- prc_pks_signer.go
- prc_reconDelete.go
- prc_sksDelegate.go
- prc_verifier.go
- pubkey.go
- recon.go
- resolve.go
- responses.go
- schema.go
- signature.go
- sort.go
- stats.go
- subkey.go
- types.go
- userattribute.go
- userid.go
- worker.go