Ejemplo n.º 1
0
func (ce *CryptEngine) verifyServerSig(
	uid *uid.Message,
	msgReply *uid.MessageReply,
	position uint64,
) error {
	// For the first keyserver message we do not need to verify the server signature
	if uid.Localpart() == "keyserver" && uid.UIDContent.MSGCOUNT == 0 {
		return nil
	}

	// Get keyserver UID
	srvUID, _, found, err := ce.keyDB.GetPublicUID("keyserver@"+uid.Domain(), position)
	if err != nil {
		return err
	}
	if !found {
		return log.Errorf("cryptengine: no keyserver signature key found for domain '%s'", uid.Domain())
	}

	// Verify server signature
	if err := msgReply.VerifySrvSig(uid, srvUID.UIDContent.SIGKEY.PUBKEY); err != nil {
		return log.Error(err)
	}
	return nil
}
Ejemplo n.º 2
0
// AddPrivateUIDReply adds the msgReply to the given UID message.
func (keyDB *KeyDB) AddPrivateUIDReply(
	msg *uid.Message,
	msgReply *uid.MessageReply,
) error {
	_, err := keyDB.addPrivateUIDReplyQuery.Exec(msgReply.JSON(), msg.JSON())
	if err != nil {
		return err
	}
	return nil
}