Try with the BouncyCastle downloadable version without IDEA algorithm.
I had the same problem and as I didn't need to use the IDEA algorithm I
used the other version and worked like a charm.

You will find the version in the download section:
http://www.bouncycastle.org/csharp/

You can see the first and third download links are the same but without
IDEA.

Enviado desde mi iPhone

El 10/10/2012, a las 17:56, Rodrigo Vieira <[email protected]> escribió:

 From: [email protected]
To: [email protected]
Subject: Help Exception creating cipher
Date: Wed, 10 Oct 2012 18:35:33 +0300

 Hello all.

There are times I'm trying to decrypt a file with pgp library Bouncy
Castle, but after using several examples of internet'm still with the same
error.

Exception creating cipher

Inner Exception - {"Cipher IDEA/CFB/NOPADDING not recognised."}

I tried these forms:

#1
private static PgpPrivateKey FindSecretKey(PgpSecretKeyRingBundle pgpSec,
long keyId, char[] pass)
        {
            PgpSecretKey pgpSecKey = pgpSec.GetSecretKey(keyId);

            if (pgpSecKey == null)
                return null;

            return pgpSecKey.ExtractPrivateKey(pass);
        }

#2
private PgpPrivateKey GetPrivateKey(string privateKeyPath, string pass)
        {

            using (Stream keyIn = File.OpenRead(privateKeyPath))
            using (Stream inputStream =
PgpUtilities.GetDecoderStream(keyIn))
            {
                PgpSecretKeyRingBundle secretKeyRingBundle = new
PgpSecretKeyRingBundle(inputStream);

                PgpSecretKey key = null;
                foreach (PgpSecretKeyRing kRing in
secretKeyRingBundle.GetKeyRings())
                {
                    foreach (PgpSecretKey secretKey in
kRing.GetSecretKeys())
                    {
                        PgpPrivateKey privKey =
secretKey.ExtractPrivateKey(pass.ToArray());


return privKeyF = privKey;


                    }
                }
            }

            return null;
        }



Does anyone know what is happening?

They would have to send me other examples?

Thank you.

Sorry for my bad English.

Atenciosamente

*Rodrigo Vieira da Silva
*[email protected]
[email protected] <[email protected]>
[email protected]
Tel.: (15) 3213-2014
Cel.: (15) 9757-0068
**

Reply via email to