RE: PGP v7 software unable to decrypt BCPG encryption

Even when I do not sign the file, but only
encrypt using their public key, their software is not able to recognize that
the file has been encrypted by their file. Instead throws an error ?Not
encrypted to our key?.

RE: PGP v7 software unable to decrypt BCPG encryption

Message

Make
sure you use their public key when encrypting. If you are working with a keyring
file the code I'm about to show you may not do you any good as I've only worked
with keys stored in by themselves in individual files (keys gotten by doing an
key export from the PGP program itself):

This
code will take a key stored in a file by itself and look through all the parts
to make sure that it finds the "encrypting key" part using the
isEncryptionKey() method. Some files contain more than one key (some keys have
different parts) so this method make sure the right key/part is chosen. For
example some files may have both the public and private keys in them, some have
what's called a signing key part and an encrypting key part.

If you
have a real key ring file I think before you do the steps I have shown, you
first have to make sure you find the right key with the right key ID #. I'm not
much help after this as I've always done this one way (one key per file) and
haven't taken the time to learn about real key ring files that contain multiple
keys.

Even when I do not
sign the file, but only encrypt using their public key, their software is not
able to recognize that the file has been encrypted by their file. Instead
throws an error “Not encrypted to our key”.

RE: PGP v7 software unable to decrypt BCPG encryption

After
writing what I wrote earlier I realized you must be using an encrypting key
otherwise BC throws an exception. All I can think is that you may be using the
wrong key. I would debug it by printing out the ID of the key you are using to
encrypt with during the process and then check with them to make sure it matches
up with what they are expecting you to use.

Even when I do not
sign the file, but only encrypt using their public key, their software is not
able to recognize that the file has been encrypted by their file. Instead
throws an error “Not encrypted to our key”.

RE: PGP v7 software unable to decrypt BCPG encryption

Justin Kolb said:
> If you are using signatures PGPv7 can only decode
> version 3 signatures.

You could try going further than that and using older format for the
encryption as well. The following extracts are from BCRampage in the
full BouncyCastle distribution (oldFormat is a boolean value indicating
whether the older format should be used).