added check for presence of key expiry packet.
import org.bouncycastle.bcpg.PublicKeyAlgorithmTags;
import org.bouncycastle.bcpg.PublicKeyPacket;
import org.bouncycastle.bcpg.RSAPublicBCPGKey;
+import org.bouncycastle.bcpg.SignatureSubpacketTags;
import org.bouncycastle.bcpg.TrustPacket;
import org.bouncycastle.bcpg.UserAttributePacket;
import org.bouncycastle.bcpg.UserIDPacket;
public class PGPPublicKey
implements PublicKeyAlgorithmTags
{
- private static final int[] MASTER_KEY_CERTIFICATION_TYPES = new int[] { PGPSignature.POSITIVE_CERTIFICATION, PGPSignature.CASUAL_CERTIFICATION, PGPSignature.NO_CERTIFICATION, PGPSignature.DEFAULT_CERTIFICATION };
+ private static final int[] MASTER_KEY_CERTIFICATION_TYPES = new int[] { PGPSignature.POSITIVE_CERTIFICATION, PGPSignature.CASUAL_CERTIFICATION, PGPSignature.NO_CERTIFICATION, PGPSignature.DEFAULT_CERTIFICATION, PGPSignature.DIRECT_KEY };
PublicKeyPacket publicPk;
TrustPacket trustPk;
@@ -322,6 +323,11 @@ private long getExpirationTimeFromSig(
continue;
}
+ if (!hashed.hasSubpacket(SignatureSubpacketTags.KEY_EXPIRE_TIME))
+ {
+ continue;
+ }
+
long current = hashed.getKeyExpirationTime();
if (sig.getKeyID() == this.getKeyID())
