RSA Encryption

From: Nivek Eroom (kenmoore21_at_hotmail.com)
Date: 01/26/04


Date: Mon, 26 Jan 2004 15:28:05 -0500

Hi,
    I'm a little new with the System.Security.Cryptography in the .Net
framework...

string value = "Potatoe";

byte[] test =
RSAEncrypt(ByteConverter.GetBytes(value),RSA.ExportParameters(false),
false);

string l = Convert.ToBase64String(test);

// That doesnt work
SaveToXml()
GetFromXml()
// End

//If i ommit the line above...the code is working..any idea why

//I want to save that string to an xml file but when i save it and
// i get it back...decryptedData doesn't return me the
//same result as the encrypted data....

dataToEncrypt = Convert.FromBase64String(l);
decryptedData = RSADecrypt(dataToEncrypt,RSA.ExportParameters(true), false);

if(decryptedData!=null)
{
    string ret = ByteConverter.GetString(decryptedData)==value;
    // ret is not equal to "Potatoe"
}
else
{
    ret = false;
}

thanks...

-- 
Nivek Eroom
Post message to group, everyones got benefits


Relevant Pages

  • Re: some interesting perspectives on .NET from the other camp ...
    ... >> now rather use framework functionality directly. ... Do you really think a VB.NET writer is any more dependent on MS ... low platform or framework level functions altogether. ... Trimming a string just seems to me to be exactly ...
    (borland.public.delphi.non-technical)
  • Re: IE Hosts Windows Control
    ... statement in the "What's new in the .NET Framework 1.1" ... Internet-based Web page or Windows Forms assemblies ... could get my control to execute on a framework v1 sp1 ... >> assemblyName, String ...
    (microsoft.public.dotnet.security)
  • Re: Convert latin-1 characters to named HTML entities?
    ... >> characters and output the corret HTML entities, ... >> rset1.asp but if there is already something in the framework for this ... few custom string replacements turn out to insufficient. ... Joergen Bech ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Problem editing Data in form
    ... >>doesnt work well in this environment. ... >> Dim stDocName As String ... >> Dim stLinkCriteria As String ... >> Exit Sub ...
    (microsoft.public.access.forms)
  • Re: Implement a Case INsensitive string.Comtains method?
    ... The proper .NET way is to write a custom string class ... So switch your project to the 3.5 framework and it ... Call a Custom Extension Method " had mentioned ...
    (microsoft.public.dotnet.languages.csharp)