mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-11 11:35:07 -05:00
begin refactor
This commit is contained in:
parent
bb0baa815e
commit
cd4a3dd237
@ -927,20 +927,12 @@ public class PgpOperation {
|
|||||||
if (tmp_subkeyBinding_isok)
|
if (tmp_subkeyBinding_isok)
|
||||||
subkeyBinding_isok = true;
|
subkeyBinding_isok = true;
|
||||||
if (tmp_subkeyBinding_isok) {
|
if (tmp_subkeyBinding_isok) {
|
||||||
PGPSignatureSubpacketVector hPkts = sig.getHashedSubPackets();
|
primkeyBinding_isok = verifyPrimaryBinding(sig.getUnhashedSubPackets(), mKey, signatureKey);
|
||||||
PGPSignatureSubpacketVector uhPkts = sig.getUnhashedSubPackets();
|
if (primkeyBinding_isok)
|
||||||
if (uhPkts.hasSubpacket(SignatureSubpacketTags.EMBEDDED_SIGNATURE)) {
|
break;
|
||||||
PGPSignatureList eSigList = uhPkts.getEmbeddedSignatures();
|
primkeyBinding_isok = verifyPrimaryBinding(sig.getHashedSubPackets(), mKey, signatureKey);
|
||||||
for (int j = 0; j < eSigList.size(); ++j) {
|
|
||||||
PGPSignature emSig = eSigList.get(j);
|
|
||||||
emSig.init(contentVerifierBuilderProvider, signatureKey);
|
|
||||||
primkeyBinding_isok = emSig.verifyCertification(mKey, signatureKey);
|
|
||||||
if (primkeyBinding_isok)
|
if (primkeyBinding_isok)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
|
||||||
if (hPkts.hasSubpacket(SignatureSubpacketTags.EMBEDDED_SIGNATURE)) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -954,6 +946,40 @@ public class PgpOperation {
|
|||||||
return returnData;
|
return returnData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean verifyPrimaryBinding(PGPSignatureSubpacketVector Pkts, PGPPublicKey masterPublicKey, PGPPublicKey signingPublicKey)
|
||||||
|
{
|
||||||
|
boolean primkeyBinding_isok = false;
|
||||||
|
JcaPGPContentVerifierBuilderProvider contentVerifierBuilderProvider = new JcaPGPContentVerifierBuilderProvider()
|
||||||
|
.setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME);
|
||||||
|
PGPSignatureList eSigList;
|
||||||
|
|
||||||
|
if (Pkts.hasSubpacket(SignatureSubpacketTags.EMBEDDED_SIGNATURE)) {
|
||||||
|
try {
|
||||||
|
eSigList = Pkts.getEmbeddedSignatures();
|
||||||
|
} catch (IOException e) {
|
||||||
|
return false;
|
||||||
|
} catch (PGPException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (int j = 0; j < eSigList.size(); ++j) {
|
||||||
|
PGPSignature emSig = eSigList.get(j);
|
||||||
|
if (emSig.getSignatureType() == PGPSignature.PRIMARYKEY_BINDING) {
|
||||||
|
try {
|
||||||
|
emSig.init(contentVerifierBuilderProvider, signingPublicKey);
|
||||||
|
primkeyBinding_isok = emSig.verifyCertification(masterPublicKey, signingPublicKey);
|
||||||
|
if (primkeyBinding_isok)
|
||||||
|
break;
|
||||||
|
} catch (PGPException e) {
|
||||||
|
continue;
|
||||||
|
} catch (SignatureException e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return primkeyBinding_isok;
|
||||||
|
}
|
||||||
|
|
||||||
private static void processLine(final String pLine, final ArmoredOutputStream pArmoredOutput,
|
private static void processLine(final String pLine, final ArmoredOutputStream pArmoredOutput,
|
||||||
final PGPSignatureGenerator pSignatureGenerator) throws IOException, SignatureException {
|
final PGPSignatureGenerator pSignatureGenerator) throws IOException, SignatureException {
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user