I've encrypted a file with PGP but for "security reasons" I thought it would be good to damage the header and add some extra bytes so that even if someone finds it it won't know for sure it's a PGP file as the decryption check would fail.
The issue is that now I can't remember what extra bytes I've added. Is there any way that I can "force" the decryption or sanitize the file / remove the extra bytes?
Update:
I've used the script provided by Jens to remove the bytes until I get a prompt for the password. Unfortunately the password(s) I remember don't seem to work. Also if I keep removing bytes after the first prompt I still get the password prompt from time to time so I'm wondering if the method is really effective. See the log below
./a.bh
Trying bytes: 1
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof
Trying bytes: 2
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof
Trying bytes: 3
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof
Trying bytes: 4
gpg: [don't know]: indeterminate length for invalid packet type 4
Trying bytes: 5
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof
Trying bytes: 6
gpg: packet(6) with unknown version 125
Trying bytes: 7
........................
Trying bytes: 21
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof
Trying bytes: 22
gpg: [don't know]: indeterminate length for invalid packet type 6
...........................
Trying bytes: 24
:literal data packet:
mode ? (4), created 2823998230, name="U\x07\x82Swo\xe6\xd9\x82\xd9[C\x16\xba\xeb\xa50r\xcd#\x03\xbd>\xec*l>\xbd\xb2\xcb\x0b\x01\xa6g0\xfeQU\xa6\xc0\x87\xdbk9\xf9o\x88\x8dr\xec\xfe\xeb\xb38\x93W\xeb\xcb\xd3\xc4\x80\xf1\xda\x9b(\x8d\xa1\xbb\xf6\xf6\x9a\xd0:v\x81\xe5rF\xe09N\xda\xf3\x90\xcd\xf0.\xb0\xabf<\x96\xf2\x8d\xbd\x8b\x95\x99\x89:q[)\x0c\xf5X\xbd2\x083\xc1\x97\xb7\xee\x84S\xf2\xcfi\xf1\xa2\x93\x15\xe9kI\xaa\x9d*;\x06\x0e\x9c\x04\x13\x87\x88u\xe7]U]\xbc\xb2\x92\x91\x02;9p\x95\x081\xe9v\xa5\xc3\x7e+#Z\xb9\xb8Ka\x18\x96\x82K\xaf6\xb0f\xb8\x8d0\x17\xe2D\xc3&\xe5\xd9\x94\xad\x05,L\xb7\xcc\xfb\x7c",
raw data: 35666 bytes
gpg: invalid marker packet
Trying bytes: 25
gpg: unknown S2K 85
gpg: invalid symkey encrypted packet
gpg: [don't know]: invalid packet (ctb=3e)
Trying bytes: 26
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof
Trying bytes: 27
..................
Trying bytes: 43
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof
Trying bytes: 44
--- on this line I get the password for the prompt and I simply press enter
:encrypted data packet:
length: 12402
gpg: assuming IDEA encrypted data
gpg: packet(3) with unknown version 94
gpg: WARNING: message was not integrity protected
gpg: [don't know]: invalid packet (ctb=22)
Trying bytes: 45
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof
Trying bytes: 46
.........................
Trying bytes: 58
:literal data packet:
mode ? (1), created 2797635547, name="g0\xfeQU\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
raw data: 0 bytes
gpg: [don't know]: invalid packet (ctb=6b)
..........
//I get the password prompt again on this line
Trying bytes: 61
:encrypted data packet:
length: 1731264081
gpg: assuming IDEA encrypted data
Enter passphrase:
:encrypted data packet:
length: 1731264081
gpg: assuming IDEA encrypted data
gpg: encrypted_mdc packet with unknown version 235
gpg: WARNING: message was not integrity protected
:trust packet: flag=75 sigcache=00
gpg: [don't know]: invalid packet (ctb=21)
.....................
Trying bytes: 66
gpg: no valid OpenPGP data found.
gpg: processing message failed: eof
//here I get the password prompt again
Trying bytes: 67
:encrypted data packet:
length: 3230129003
gpg: assuming IDEA encrypted data
gpg: encrypted_mdc packet with unknown version 180
gpg: WARNING: message was not integrity protected
gpg: packet(2) with unknown version 59
I should mention that the file (which actually is a directory) was encrypted using PGP (now owner by Symantec)