Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

PGP Encryption loading and changing the symmetric ciphering algorithm

Created: 15 Jun 2011 • Updated: 13 Jul 2011 | 1 comment
This issue has been solved. See solution.

Hello,

I'm using the PGP SDK library to cipher my data. I know that for ciphering and also for deciphering, PGP creates a symmetric session key to cipher the data. This key is saved with the ciphered data. I guess that the algorithm used to cipher the data is also saved with this data?

I know also that we can change the prefered symmetric algorithms for a PGP couple of keys by enabling/disabling some algorithms.

What I want to know is how (which API of PGP SDK) one may load in case of deciphering the symmetric algorithm used to cipher the data (AES, DES or another one) and how one may change the default symmetric algorithm before ciphering any data. Also the API that allows to knwo the prefered symmetric algorithms for a couple of public/Private PGP keys.

Thanks a lot

NAOT

Discussion Filed Under:

Comments 1 CommentJump to latest comment

dfinkelstein's picture

Hi,

It seems that you wan to know

1.  How to select the deciphering algorithm;

2.  How to change the preferred cipher;

3.  How to query the preferred cipher.

Is this correct?

As for the first point, you don't need to select a decryption algorithm.  The OpenPGP message contains information about what algorithm was used.  The SDK will decrypt your data with the algorithm used when the data was encrypted.

The preferred cipher can be changed by calling PGPUpdateKeyOptions().  You'll need to pass in PGPOPassphrase() and PGPOPreferredAlgorithms().  PGPOPreferredAlgorithms() takes an array of PGPCipherAlgorithm; the order they are in specifies the preference order for use.

You can query the preferred ciphers by calling PGPGetKeyDBObjDataProperty() and specify the kPGPKeyProperty_PreferredAlgorithms property.  There is an example of this in the SDK sample program optest in the file optestUtils.c.

Regards,

--------

David Finkelstein

Symantec R&D

SOLUTION