fix primary user id in master key flag modification

This commit is contained in:
Vincent Breitmoser 2014-08-19 14:42:40 +02:00
parent 4a280f6ba3
commit 6a3150d878

View File

@ -881,10 +881,12 @@ public class PgpKeyOperation {
} }
// add shiny new user id certificate // add shiny new user id certificate
boolean isPrimary = currentCert.getHashedSubPackets() != null &&
currentCert.getHashedSubPackets().isPrimaryUserID();
modifiedPublicKey = PGPPublicKey.removeCertification( modifiedPublicKey = PGPPublicKey.removeCertification(
modifiedPublicKey, userId, currentCert); modifiedPublicKey, userId, currentCert);
PGPSignature newCert = generateUserIdSignature( PGPSignature newCert = generateUserIdSignature(
masterPrivateKey, masterPublicKey, userId, true, flags, expiry); masterPrivateKey, masterPublicKey, userId, isPrimary, flags, expiry);
modifiedPublicKey = PGPPublicKey.addCertification( modifiedPublicKey = PGPPublicKey.addCertification(
modifiedPublicKey, userId, newCert); modifiedPublicKey, userId, newCert);
ok = true; ok = true;