Skip to content
Browse files

Skip marker packets to properly identify what to do with an OpenPGP f…

…ile based on its contents

[#257 state:fixed]
  • Loading branch information...
lukele committed Aug 16, 2019
1 parent f51f033 commit 17b325bb1544bfdef383668c19fe56f2dccea466
Showing with 14 additions and 0 deletions.
  1. +14 −0 Source/GPGServices.m
@@ -117,6 +117,20 @@ - (void)application:(NSApplication *)sender openFiles:(NSArray *)filenames {

GPGPacketParser *parser = [GPGPacketParser packetParserWithStream:unArmoredStream];
GPGPacket *packet = [parser nextPacket];
// Bug #257: If the first packet is not a known packet GPG Services
// starts encrypt operation.
// GPG Services only checks the first packet it finds for known packets.
// If no match is found it's assumed that the file is not a OpenPGP related file
// and thus the user wants to encrypt the file instead.
// In some cases however the first packet is a marker packet instead. In this case
// GPG Services will skip that packet and check the next one.
// TODO: Should maybe enhanced to loop through additional packets, if not too expensive.
if(packet.tag == GPGMarkerPacketTag) {
packet = [parser nextPacket];

BOOL verify = NO;
BOOL import = NO;
BOOL decrypt = NO;

0 comments on commit 17b325b

Please sign in to comment.
You can’t perform that action at this time.