generates empty private and publickey

Nov 15, 2012 at 10:31 AM

Hi,

 

I have download scrypt_v1030_RSA_Silverlight. There is no problem on creation of privatekey and publickey. But the problem is that they are empty files.

  private void KeysGenerated(Object sender)       

{            RSACrypto oRSA = (RSACrypto)sender;        

 }

partial void RSA_Execute()       

{                     

RSACrypto oRSA = new RSACrypto(2048);                

oRSA.PaddingProvider = new RSA.PaddingProviders.PKCS1v1_5();           
            int cipherStrength = 2048;           

    int pubExponent = 17;           
            //Attach the KeysGenerated event handler           

oRSA.OnKeysGenerated += KeysGenerated;                      oRSA.GenerateKeys(cipherStrength);           

string xmlKeys;            xmlKeys = oRSA.ToXmlString(true);            //oRSA.FromXmlString(xmlKeys);
                                              //Override cipher strength and public exponent     

  /////////// oRSA.GenerateKeys(cipherStrength, pubExponent);
     
            File.WriteAllText(@"C:\Temp\privateKey.xml",xmlKeys);  // Private Key            File.WriteAllText(@"C:\Temp\publicKey.xml", oRSA.ToXmlString(false));  

// Public Key
            //Import the keys from XML           

/////////////////// oRSA.FromXmlString(xmlKeys);
 StreamWriter writer = new StreamWriter(@"C:\Temp\PublicPrivateKey.xml");           

string publicprivatexml = oRSA.ToXmlString(true);           

writer.Write(publicprivatexml);           

writer.Close();
        }

 

Can anybody help me  get NO empy privatekey and publickey files ?

Regards....