mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
add user id flags to UserAttribute self signatures
This commit is contained in:
parent
46cc7f8174
commit
f30900d085
@ -553,7 +553,8 @@ public class PgpKeyOperation {
|
|||||||
PGPSignature cert = generateUserAttributeSignature(
|
PGPSignature cert = generateUserAttributeSignature(
|
||||||
getSignatureGenerator(masterSecretKey, cryptoInput),
|
getSignatureGenerator(masterSecretKey, cryptoInput),
|
||||||
cryptoInput.getSignatureTime(),
|
cryptoInput.getSignatureTime(),
|
||||||
masterPrivateKey, masterPublicKey, vector);
|
masterPrivateKey, masterPublicKey, vector,
|
||||||
|
masterKeyFlags, masterKeyExpiry);
|
||||||
modifiedPublicKey = PGPPublicKey.addCertification(modifiedPublicKey, vector, cert);
|
modifiedPublicKey = PGPPublicKey.addCertification(modifiedPublicKey, vector, cert);
|
||||||
} catch (NfcInteractionNeeded e) {
|
} catch (NfcInteractionNeeded e) {
|
||||||
nfcSignOps.addHash(e.hashToSign, e.hashAlgo);
|
nfcSignOps.addHash(e.hashToSign, e.hashAlgo);
|
||||||
@ -1319,11 +1320,9 @@ public class PgpKeyOperation {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private PGPSignature generateUserIdSignature(
|
private static PGPSignatureSubpacketGenerator generateHashedSelfSigSubpackets(
|
||||||
PGPSignatureGenerator sGen, Date creationTime,
|
Date creationTime, PGPPublicKey pKey, boolean primary, int flags, long expiry
|
||||||
PGPPrivateKey masterPrivateKey, PGPPublicKey pKey, String userId, boolean primary,
|
) {
|
||||||
int flags, long expiry)
|
|
||||||
throws IOException, PGPException, SignatureException {
|
|
||||||
|
|
||||||
PGPSignatureSubpacketGenerator hashedPacketsGen = new PGPSignatureSubpacketGenerator();
|
PGPSignatureSubpacketGenerator hashedPacketsGen = new PGPSignatureSubpacketGenerator();
|
||||||
{
|
{
|
||||||
@ -1357,6 +1356,17 @@ public class PgpKeyOperation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return hashedPacketsGen;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static PGPSignature generateUserIdSignature(
|
||||||
|
PGPSignatureGenerator sGen, Date creationTime,
|
||||||
|
PGPPrivateKey masterPrivateKey, PGPPublicKey pKey, String userId, boolean primary,
|
||||||
|
int flags, long expiry)
|
||||||
|
throws IOException, PGPException, SignatureException {
|
||||||
|
|
||||||
|
PGPSignatureSubpacketGenerator hashedPacketsGen =
|
||||||
|
generateHashedSelfSigSubpackets(creationTime, pKey, primary, flags, expiry);
|
||||||
sGen.setHashedSubpackets(hashedPacketsGen.generate());
|
sGen.setHashedSubpackets(hashedPacketsGen.generate());
|
||||||
sGen.init(PGPSignature.POSITIVE_CERTIFICATION, masterPrivateKey);
|
sGen.init(PGPSignature.POSITIVE_CERTIFICATION, masterPrivateKey);
|
||||||
return sGen.generateCertification(userId, pKey);
|
return sGen.generateCertification(userId, pKey);
|
||||||
@ -1365,15 +1375,12 @@ public class PgpKeyOperation {
|
|||||||
private static PGPSignature generateUserAttributeSignature(
|
private static PGPSignature generateUserAttributeSignature(
|
||||||
PGPSignatureGenerator sGen, Date creationTime,
|
PGPSignatureGenerator sGen, Date creationTime,
|
||||||
PGPPrivateKey masterPrivateKey, PGPPublicKey pKey,
|
PGPPrivateKey masterPrivateKey, PGPPublicKey pKey,
|
||||||
PGPUserAttributeSubpacketVector vector)
|
PGPUserAttributeSubpacketVector vector,
|
||||||
|
int flags, long expiry)
|
||||||
throws IOException, PGPException, SignatureException {
|
throws IOException, PGPException, SignatureException {
|
||||||
|
|
||||||
PGPSignatureSubpacketGenerator hashedPacketsGen = new PGPSignatureSubpacketGenerator();
|
PGPSignatureSubpacketGenerator hashedPacketsGen =
|
||||||
{
|
generateHashedSelfSigSubpackets(creationTime, pKey, false, flags, expiry);
|
||||||
/* critical subpackets: we consider those important for a modern pgp implementation */
|
|
||||||
hashedPacketsGen.setSignatureCreationTime(true, creationTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
sGen.setHashedSubpackets(hashedPacketsGen.generate());
|
sGen.setHashedSubpackets(hashedPacketsGen.generate());
|
||||||
sGen.init(PGPSignature.POSITIVE_CERTIFICATION, masterPrivateKey);
|
sGen.init(PGPSignature.POSITIVE_CERTIFICATION, masterPrivateKey);
|
||||||
return sGen.generateCertification(vector, pKey);
|
return sGen.generateCertification(vector, pKey);
|
||||||
|
Loading…
Reference in New Issue
Block a user