/// Often PGP keyring files consist of multiple master keys, if you are trying to process
/// or construct one of these you should use the
* This method will ignore trust packets on the second copy of the certificate and instead * copy the local certificate's trust packets to the joined certificate. * * @param first local copy of the certificate * @param second remote copy of the certificate (e.g. from a key server) * @return joined key ring * @throws PGPException */ public static PgpPublicKeyRing Join(PgpPublicKeyRing first, PgpPublicKeyRing second) { return Join(first, second, false, false); } /** * Join two copies of the same certificate. * The certificates must have the same primary key, but may carry different subkeys, user-ids and signatures. * The resulting certificate will carry the sum of both certificates subkeys, user-ids and signatures. *
* For each subkey holds: If joinTrustPackets is set to true and the second key is carrying a trust packet,
* the trust packet will be copied to the joined key.
* Otherwise, the joined key will carry the trust packet of the local copy.
*
* @param first local copy of the certificate
* @param second remote copy of the certificate (e.g. from a key server)
* @param joinTrustPackets if true, trust packets from the second certificate copy will be carried over into the joined certificate
* @param allowSubkeySigsOnNonSubkey if true, the resulting joined certificate may carry subkey signatures on its primary key
* @return joined certificate
* @throws PGPException
*/
public static PgpPublicKeyRing Join(PgpPublicKeyRing first, PgpPublicKeyRing second, bool joinTrustPackets,
bool allowSubkeySigsOnNonSubkey)
{
if (!Arrays.AreEqual(first.GetPublicKey().GetFingerprint(), second.GetPublicKey().GetFingerprint()))
throw new ArgumentException("Cannot merge certificates with differing primary keys.");
var secondKeys = new HashSet