Thanks theberserk.

I tried with all versions and nothing.Now following error:
exception decrypting secret key
{"unknown block type"}
versions without IDEA.
Again the code I'm using:#1:
public void Decrypt(Stream input, string outputpath, String privateKeyPath, 
string pass)        {            input = PgpUtilities.GetDecoderStream(input);  
          try            {                PgpObjectFactory pgpObjF = new 
PgpObjectFactory(input);                PgpEncryptedDataList enc;               
 PgpObject obj = pgpObjF.NextPgpObject();                if (obj is 
PgpEncryptedDataList)                {                    enc = 
(PgpEncryptedDataList)obj;                }                else                
{                    enc = (PgpEncryptedDataList)pgpObjF.NextPgpObject();       
         }
                var akp = new AsymmetricKeyParameter(true);
                PgpPrivateKey privKey = GetPrivateKey(privateKeyPath, pass);
                PgpPublicKeyEncryptedData pbe = 
enc.GetEncryptedDataObjects().Cast<PgpPublicKeyEncryptedData>().First();        
        Stream clear;                clear = pbe.GetDataStream(privKey);        
        PgpObjectFactory plainFact = new PgpObjectFactory(clear);               
 PgpObject message = plainFact.NextPgpObject();                if (message is 
PgpCompressedData)                {                    PgpCompressedData cData 
= (PgpCompressedData)message;                    Stream compDataIn = 
cData.GetDataStream();                    PgpObjectFactory o = new 
PgpObjectFactory(compDataIn);                    message = o.NextPgpObject();   
                 if (message is PgpOnePassSignatureList)                    {   
                     message = o.NextPgpObject();                        
PgpLiteralData Ld = null;                        Ld = (PgpLiteralData)message;  
                      Stream output = File.Create(outputpath + "\\" + 
Ld.FileName);                        Stream unc = Ld.GetInputStream();          
              PipeAll(unc, output);                    }                    
else                    {                        PgpLiteralData Ld = null;      
                  Ld = (PgpLiteralData)message;                        //Stream 
output = File.Create(outputpath + "\\" + Ld.FileName);                        
Stream output = File.Create(outputpath);                        Stream unc = 
Ld.GetInputStream();                        PipeAll(unc, output);               
     }                }            }            catch (Exception e)            
{                throw new Exception(e.Message);            }        }



Thanckyou


Atenciosamente

Rodrigo Vieira da Silva
rvsi...@live.com
rvsi...@cloudwar.com.br
111...@li.facens.br
Tel.: (15) 3213-2014
Cel.: (15) 9757-0068


From: thebers...@gmail.com
Date: Wed, 10 Oct 2012 19:16:53 +0200
Subject: Re: [dev-crypto-csharp] Help Exception creating cipher
To: rvsi...@live.com
CC: dev-crypto-csharp@bouncycastle.org

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 <rvsi...@live.com> escribi¾:




From: rvsi...@live.com
To: dev-crypto-csharp-requ...@bouncycastle.org
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);á á á á }

#2private 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
rvsi...@live.com

rvsi...@cloudwar.com.br
111...@li.facens.br

Tel.: (15) 3213-2014
Cel.: (15) 9757-0068

                                                                                
  
                                                                                
  

Reply via email to