mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-18 02:12:06 +01:00
Direct-Key signatures are calculated over the signee only, not the signer plus signee
This commit is contained in:
parent
0fdafdf956
commit
7769ff8173
2 changed files with 4 additions and 8 deletions
|
@ -43,12 +43,8 @@ public class ThirdPartyDirectKeySignatureBuilder extends AbstractSignatureBuilde
|
||||||
|
|
||||||
public PGPSignature build(PGPPublicKey key) throws PGPException {
|
public PGPSignature build(PGPPublicKey key) throws PGPException {
|
||||||
PGPSignatureGenerator signatureGenerator = buildAndInitSignatureGenerator();
|
PGPSignatureGenerator signatureGenerator = buildAndInitSignatureGenerator();
|
||||||
if (key.getKeyID() != publicSigningKey.getKeyID()) {
|
|
||||||
return signatureGenerator.generateCertification(publicSigningKey, key);
|
|
||||||
} else {
|
|
||||||
return signatureGenerator.generateCertification(key);
|
return signatureGenerator.generateCertification(key);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isValidSignatureType(SignatureType type) {
|
protected boolean isValidSignatureType(SignatureType type) {
|
||||||
|
|
|
@ -546,10 +546,10 @@ public abstract class SignatureValidator {
|
||||||
try {
|
try {
|
||||||
signature.init(ImplementationFactory.getInstance().getPGPContentVerifierBuilderProvider(), signer);
|
signature.init(ImplementationFactory.getInstance().getPGPContentVerifierBuilderProvider(), signer);
|
||||||
boolean valid;
|
boolean valid;
|
||||||
if (signer.getKeyID() != signee.getKeyID()) {
|
if (signer.getKeyID() == signee.getKeyID() || signature.getSignatureType() == PGPSignature.DIRECT_KEY) {
|
||||||
valid = signature.verifyCertification(signer, signee);
|
|
||||||
} else {
|
|
||||||
valid = signature.verifyCertification(signee);
|
valid = signature.verifyCertification(signee);
|
||||||
|
} else {
|
||||||
|
valid = signature.verifyCertification(signer, signee);
|
||||||
}
|
}
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
throw new SignatureValidationException("Signature is not correct.");
|
throw new SignatureValidationException("Signature is not correct.");
|
||||||
|
|
Loading…
Reference in a new issue