Dear,

we have a customer using your library in java. They are sending us
encrypted xmls.
They use AES encryption for data, and the AES key is encrypted with RSA
as simple as is :)

Actually we do not want to use java nor C# to handle these documents.
After some research I downloaded your c# library, and managed to get the
AES Key with BouncyCastle after that I used our environment to decrypt
AES (working correctly).

So the question is, is there a way to decrypt RSA without BouncyCastle.
As I see the main problem is that the certificate file is in BCPG format
so I can not extract any information from that.
Are there any way to convert this file (.asc) to any other format?

I hope that I was clear enough. For further info here is some c# code:

PgpPrivateKey key = null;
PgpSecretKeyRingBundle pgpSec = new
PgpSecretKeyRingBundle(PgpUtilities.GetDecoderStream(privateKeyUrlStream));
foreach (PgpSecretKeyRing keyRing in pgpSec.GetKeyRings())
                {
                    foreach (PgpSecretKey secretKey in
keyRing.GetSecretKeys())
                    {
                        if (secretKey.IsSigningKey)
                        {
                            key =
secretKey.ExtractPrivateKey(password.ToCharArray());
                        }
                    }
                }

IAsymmetricBlockCipher eng = new RsaEngine();
eng.Init(false, key.Key);

byte[] encdata = System.Convert.FromBase64String(baseEncryptedKey);
byte[] AESKey= eng.ProcessBlock(encdata, 0, encdata.Length);

and from this point I'm able to pass these values to our system, and do
AES decryption there.

Are there anyway to skip this part with bouncycastle and read the
parameters for decryption from the privateKeyFile ?


Best regards,
   Zsombor Kovacs-Hum



Reply via email to