Skip to content

Error: Failed to send message due to: Error: Error encrypting message: Could not find valid self-signature in key c8ab232c7f675ec4 #6064

@martgil

Description

@martgil

Just noting down this error:

Failed to send message due to: Error: Error encrypting message: Could not find valid self-signature in key c8ab232c7f675ec4

Based on my experience, it is possible that key to use is using an insecure hash algorithm. For verifying and troubleshooting, the following raw openpgp.js snippet can be used:

const publicKey = await openpgp.readKey({ armoredKey: pubKeyArmored });
  for (const user of publicKey.users) {
    console.log(`User ID: ${user.userID?.userID}`);
    for (const sig of user.selfCertifications) {
      console.log(`  Self-sig created: ${sig.created}`);
      console.log(`  Hash algorithm used: ${sig.hashAlgorithm} (${openpgp.enums.hash[sig.hashAlgorithm]})`);
      if (sig.preferredHashAlgorithms) {
        const readable = sig.preferredHashAlgorithms.map(id => openpgp.enums.hash[id]);
        console.log(`  Preferred hash algos: ${sig.preferredHashAlgorithms} (${readable.join(", ")})`);
      }
    }
  }

Then compare the result of preferred hash against opgp.config.rejectHashAlgorithms.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions