Discussion:
PGPOnePassSignatureList
John Ferron
2005-09-13 20:00:32 UTC
Permalink
Hello,

Mike Perry had posted a question about the PGPOnePassSignatureList class in this post

http://www.bouncycastle.org/devmailarchive/msg03400.html

And since there was no follow-up, I am getting the same error and wondering how to resolve it.

PLEASE ADVISE

John
David Hook
2005-09-13 22:13:15 UTC
Permalink
Although it may look it, it's probably not the same problem.

Can you provide some more specifics about your situation? What version
of the BC OpenPGP library are you using?

Regards,

David
Post by John Ferron
Hello,
Mike Perry had posted a question about the PGPOnePassSignatureList class in this post
http://www.bouncycastle.org/devmailarchive/msg03400.html
And since there was no follow-up, I am getting the same error and
wondering how to resolve it.
PLEASE ADVISE
John
John Ferron
2005-09-14 13:14:43 UTC
Permalink
Acutally its very similar. What I am trying to do is to use an already established GPG key to decrypt and encrypt files. Right now, I'm only using them to decrypt because I have data files that I can test it on. I will be shortly working on the encryption part and having a vendor decrypt them once I know this decrypt works. I am using BC 1.28 with Java 1.4.2_03. The code was written using PGPkeys so we know that the code works with PGP keys. I am assuming that the problem that I am experiencing is related to GPG implementation of PGP. Any questions, feel free to ask

John
Although it may look it, it's probably not the same problem.

Can you provide some more specifics about your situation? What version
of the BC OpenPGP library are you using?

Regards,

David
Post by John Ferron
Hello,
Mike Perry had posted a question about the PGPOnePassSignatureList
class in this post
http://www.bouncycastle.org/devmailarchive/msg03400.html
And since there was no follow-up, I am getting the same error and
wondering how to resolve it.
PLEASE ADVISE
John
John Ferron
2005-09-15 15:09:20 UTC
Permalink
Has anyone dealt with the problem of encryption with PGP or GPG keys and when you use BouncyCastle to read in the key to create the PGPPublicKey. What is happening to me is when I call the method on the PGPPublicKey isEncryptionKey, false is returned. But when I call isMasterKey, that is true. In my key file, I only have the public key. Anyone have any ideas. I'm using BC 1.28 with java 1.4.2_03

John
O'Rourke, Brian
2005-09-15 20:34:45 UTC
Permalink
I would guess that your key file has only the "public key pair", which
is slightly different. When you use most software to export a key, you
actually export a pair of keys: one for encryption, and one for
signature verification.

It's very common for the master key in a public key pair to be a
signature verification key. Your PGPPublicKeyRing object probably
contains at least two keys. Use the getPublicKeys() method rather than
getPublicKey() - or better yet, access the encryption key using the
getPublicKey( long ) method.

If you're parsing a typical GPG pubring.gpg file, your simple reading
algorithm is something like this:

Use a PGPObjectFactory to access the file, and loop over the objects in
it.

For each PGPPublicKeyRing object, loop over each of the keys

For each PGPPublicKey, do whatever is necessary.



-Brian

________________________________

From: John Ferron [mailto:johnferron-XLA/NT/1L0yc6Wr4J9gsBQC/***@public.gmane.org]
Sent: Thursday, September 15, 2005 10:09 AM
To: dev-crypto-***@public.gmane.org
Subject: Re: [dev-crypto] PGPOnePassSignatureList



Has anyone dealt with the problem of encryption with PGP or GPG keys and
when you use BouncyCastle to read in the key to create the PGPPublicKey.
What is happening to me is when I call the method on the PGPPublicKey
isEncryptionKey, false is returned. But when I call isMasterKey, that
is true. In my key file, I only have the public key. Anyone have any
ideas. I'm using BC 1.28 with java 1.4.2_03



John
John Ferron
2005-09-15 20:51:34 UTC
Permalink
Brian,

Our readPublicKey() method to get the public key is the exact same method as in the KeyBasedFileProcessor example in the BouncyCastle source code. When I look at the actual key file, there is both the private and public key stored in it. One thing that I did learn that is the key might have generated using PGP's implementation of the key, not GPG. A few years ago, we switched products, but that shouldn't make a difference. Any other questions?

John
I would guess that your key file has only the "public key pair", which is slightly different. When you use most software to export a key, you actually export a pair of keys: one for encryption, and one for signature verification.It's very common for the master key in a public key pair to be a signature verification key. Your PGPPublicKeyRing object probably contains at least two keys. Use the getPublicKeys() method rather than getPublicKey() * or better yet, access the encryption key using the getPublicKey( long ) method.If you're parsing a typical GPG pubring.gpg file, your simple reading algorithm is something like this:Use a PGPObjectFactory to access the file, and loop over the objects in it. For each PGPPublicKeyRing object, loop over each of the keys For each PGPPublicKey, do whatever is necessary. -Brian
From: John Ferron [mailto:johnferron-XLA/NT/1L0yc6Wr4J9gsBQC/***@public.gmane.org]
Sent: Thursday, September 15, 2005 10:09 AM
To: dev-crypto-***@public.gmane.org
Subject: Re: [dev-crypto] PGPOnePassSignatureList
Has anyone dealt with the problem of encryption with PGP or GPG keys and when you use BouncyCastle to read in the key to create the PGPPublicKey. What is happening to me is when I call the method on the PGPPublicKey isEncryptionKey, false is returned. But when I call isMasterKey, that is true. In my key file, I only have the public key. Anyone have any ideas. I'm using BC 1.28 with java 1.4.2_03

John
Chakraborty, Debanjan [WHQEO]
2005-09-15 22:09:29 UTC
Permalink
Hi Brian,
I am facing some similar problems, and I was looking forward to some inputs, and then I saw your mail in the group, and it helped a lot. Thanks a lot for that.
I have a few more questions, and I would be grateful if any of you can give some inputs on that too.
We have a scenario where we need to encrypt a CSV file and FTP it out to some 3rd party service provider. Now, in order to encrypt, we have been provided the public key by the 3rd party service provider (to whom we are sending out the file). The public key seems to have 2 keys (I observed this, both by using the PGP Desktop as well as by iterating through the key using the KeyBasedLargeFileProcessor.java), the pubic key and a sub-key (for signature verification purposes). We would like to do the encryption using the PGP APIs of BouncyCastle 1.29.
My questions are :
a) What would be the best way to identify the public key from within the class? Should we go ahead and use the ID of the key in order to identify the public key that we need? If no, then what is the recommended attribute to use for picking out the public key from the public key collection?
b) While encrypting the file, we would like to create the encrypted file with .PGP extension. As of now, using the sample, we are being able to create a file with the .ASC extension. However, when we try to override the extension (by modifying the sample), it gives us an exception (java.lang.SecurityException: SHA1 digest error for org/bouncycastle/openpgp/ examples/KeyBasedLargeFileProcessor.class). Any idea as to what would be the best way to go about doing this?
Regards,
Debanjan

-----Original Message-----
From: O'Rourke, Brian [mailto:borourke-***@public.gmane.org]
Sent: Thursday, September 15, 2005 3:35 PM
To: John Ferron; dev-crypto-***@public.gmane.org
Subject: RE: [dev-crypto] PGPOnePassSignatureList

I would guess that your key file has only the "public key pair", which is slightly different. When you use most software to export a key, you actually export a pair of keys: one for encryption, and one for signature verification.
It's very common for the master key in a public key pair to be a signature verification key. Your PGPPublicKeyRing object probably contains at least two keys. Use the getPublicKeys() method rather than getPublicKey() - or better yet, access the encryption key using the getPublicKey( long ) method.
If you're parsing a typical GPG pubring.gpg file, your simple reading algorithm is something like this:
Use a PGPObjectFactory to access the file, and loop over the objects in it.
For each PGPPublicKeyRing object, loop over each of the keys
For each PGPPublicKey, do whatever is necessary.

-Brian
_____

From: John Ferron [mailto:johnferron-XLA/NT/1L0yc6Wr4J9gsBQC/***@public.gmane.org]
Sent: Thursday, September 15, 2005 10:09 AM
To: dev-crypto-***@public.gmane.org
Subject: Re: [dev-crypto] PGPOnePassSignatureList

Has anyone dealt with the problem of encryption with PGP or GPG keys and when you use BouncyCastle to read in the key to create the PGPPublicKey. What is happening to me is when I call the method on the PGPPublicKey isEncryptionKey, false is returned. But when I call isMasterKey, that is true. In my key file, I only have the public key. Anyone have any ideas. I'm using BC 1.28 with java 1.4.2_03

John
David Hook
2005-09-16 23:42:32 UTC
Permalink
In the case where you have the standard two key ring the easiest way to
pick up the key is to use the isEncryptionKey method.

The SHA1 error is probably being caused by attempting to replace the
example class in the signed jar file. You would be better to simply copy
it and modify it your own ends.

Regards,

David
Post by Chakraborty, Debanjan [WHQEO]
Hi Brian,
I am facing some similar problems, and I was looking forward to
some inputs, and then I saw your mail in the group, and it helped a
lot. Thanks a lot for that.
I have a few more questions, and I would be grateful if any of
you can give some inputs on that too.
We have a scenario where we need to encrypt a CSV file and FTP it out
to some 3rd party service provider. Now, in order to encrypt, we have
been provided the public key by the 3rd party service provider (to
whom we are sending out the file). The public key seems to have 2
keys (I observed this, both by using the PGP Desktop as well as by
iterating through the key using the KeyBasedLargeFileProcessor.java),
the pubic key and a sub-key (for signature verification purposes). We
would like to do the encryption using the PGP APIs of BouncyCastle
1.29.
a) What would be the best way to identify the public key from
within the class? Should we go ahead and use the ID of the key in
order to identify the public key that we need? If no, then what is the
recommended attribute to use for picking out the public key from the
public key collection?
b) While encrypting the file, we would like to create the
encrypted file with .PGP extension. As of now, using the sample, we
are being able to create a file with the .ASC extension. However, when
we try to override the extension (by modifying the sample), it gives
us an exception (java.lang.SecurityException: SHA1 digest error for
org/bouncycastle/openpgp/ examples/KeyBasedLargeFileProcessor.class).
Any idea as to what would be the best way to go about doing this?
Regards,
Debanjan
-----Original Message-----
Sent: Thursday, September 15, 2005 3:35 PM
Subject: RE: [dev-crypto] PGPOnePassSignatureList
I would guess that your key file has only the “public key pair”, which
is slightly different. When you use most software to export a key, you
actually export a pair of keys: one for encryption, and one for
signature verification.
It’s very common for the master key in a public key pair to be a
signature verification key. Your PGPPublicKeyRing object probably
contains at least two keys. Use the getPublicKeys() method rather than
getPublicKey() – or better yet, access the encryption key using the
getPublicKey( long ) method.
If you’re parsing a typical GPG pubring.gpg file, your simple reading
Use a PGPObjectFactory to access the file, and loop over the objects in it.
For each PGPPublicKeyRing object, loop over each of the keys
For each PGPPublicKey, do whatever is
necessary.
-Brian
______________________________________________________________________
Sent: Thursday, September 15, 2005 10:09 AM
Subject: Re: [dev-crypto] PGPOnePassSignatureList
Has anyone dealt with the problem of encryption with PGP or GPG keys
and when you use BouncyCastle to read in the key to create the
PGPPublicKey. What is happening to me is when I call the method on
the PGPPublicKey isEncryptionKey, false is returned. But when I call
isMasterKey, that is true. In my key file, I only have the public
key. Anyone have any ideas. I'm using BC 1.28 with java 1.4.2_03
John
Loading...