Пример #1
0
func InsertPubKey(conn *neoism.Database, k *puck_gpg.PrimaryKey) {

	cq0 := neoism.CypherQuery{
		Statement: `
			MERGE (n:Key {keyid: {keyid}})
			ON CREATE SET
			n.fingerprint = {fingerprint}
			ON MATCH SET
			n.fingerprint = {fingerprint};`,
		Parameters: neoism.Props{
			"keyid":       k.KeyID(),
			"fingerprint": k.Fingerprint()}}

	err := conn.Cypher(&cq0)
	if err != nil {
		panic(err)
	}
}
Пример #2
0
func LoadKey(app App, key *puck_gpg.PrimaryKey) {
	conn := app.GraphDB

	kid := key.KeyID()

	app.Logger.Debugf("Got key ID %s fpr %s", kid, key.Fingerprint())

	InsertPubKey(conn, key)
	app.KeyCounter.Mark(1)

	for _, uid := range key.UserIDs {
		InsertUID(conn, key, uid)

		for _, sig := range uid.Signatures {
			if sig.IssuerKeyID() == kid {
				continue
			}
			switch sig.SigType {
			case 0x10, 0x11, 0x12, 0x13:
				InsertSignature(conn, key, uid, sig)
			}
		}
	}
}