.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Strongest Encyption and Decryption

Posted By:      Posted Date: September 01, 2010    Points: 0   Category :ASP.Net
Good morning to all,      Just want to ask, what is the strongest encryption and decrption that i can use using c#..? Using your suggested encryption and decryption.. Can i use this to encypt and decrypt some part of the  script..? for example i have a account number 1234567890.. when displaying this account number it should be "123456xjoh" is this possible..?     Hope to hear from you soon.. Thanks, Link 

View Complete Post

More Related Resource Links

Encryption/Decryption OAEP

I have some code: string newKey = AmazonFeedBrowser.Security.CryptoKeyContainer.GetKeyFromContainer("KeyContainer", true); RSACryptoServiceProvider trsa = new RSACryptoServiceProvider(); trsa.FromXmlString(newKey); string tu = Convert.ToBase64String(trsa.Encrypt(Encoding.UTF8.GetBytes("Administrator"), true)); Debug.WriteLine(tu); newKey = AmazonFeedBrowser.Security.CryptoKeyContainer.GetKeyFromContainer("KeyContainer", false); trsa = new RSACryptoServiceProvider(); trsa.FromXmlString(newKey); Debug.WriteLine(Encoding.UTF8.GetString(trsa.Decrypt(Convert.FromBase64String(tu), true))); I get a cryptographic exception indicating that the OAEP padding cannot be processed. The RSACryptoServiceProvider (trsa) is initialized with just the public key. It seems to work OK with the public and private key. Is there a way to use OAEP with just the public key? Error occurred while decoding OAEP padding. System.Security.Cryptography.CryptographicException was unhandled Message=Error occurred while decoding OAEP padding. Source=mscorlib StackTrace: at System.Security.Cryptography.RSACryptoServiceProvider.DecryptKey(SafeKeyHandle pKeyContext, Byte[] pbEncryptedKey, Int32 cbEncryptedKey, Boolean fOAEP, ObjectHandleOnStack ohRetDecryptedKey) at System.Security.Cryptography.RSACryptoServiceProvider.Decrypt(Byte[] rgb, Boolean fOAEP) .

Encryptipn Decryption from a Java generated key

I have a Triple DES Key generated by java code from a third party vendor. It is a 3 part key. We need to use this key in our VB.NET application.  When I try to combine this key and use it in my app 'Dim desTransform As ICryptoTransform = desCrypto.CreateEncryptor(EncryptKey(Key), EncryptIV(IV))' gives me an error ' Specified key is not a valid size for this algorithm) I am new to cryptography and do not understand the algorithms well. How can I use the java generated key in our app for encrypt/decrypt.   Any help will be appreciated.  

office search & Error 6482 during encryption or decryption. System error code 0


Occured when changed the password, all steps were successfull.

Same problem :http://social.technet.microsoft.com/Forums/en-US/sharepointsearch/thread/6194945b-1ec5-48b4-b827-d4ab998e046c

 Error Information:

04/05/2010 20:08:09.56 OWSTIMER.EXE (0x125C) 0x101C Office Server Office Server Shared Services 7u16 Critical Application Server Administration job failed for service instance Microsoft.Office.Server.Search.Administration.SearchAdminSharedWebServiceInstance (3a49bdd9-0f3e-4044-8def-78a59dd567c1). Reason: Error during encryption or decryption. System error code 0. Techinal Support Details: System.ArgumentException: Error during encryption or decryption. System error code 0. at Microsoft.SharePoint.Administration.SPCredentialManager.DecryptWithMasterKey(Byte[] rgbEncryptedPassphrase) at Microsoft.SharePoint.Administration.SPEncryptedString.GetSecureStringValue(Byte[] rgbEncryptedAlternateKey) at Microsoft.SharePoint.Administration.SPEncryptedString.GetSecureStringValue() at Microsoft.SharePoint.Administration.SPEncryptedString.get_SecureStringValue() at Microsoft.SharePoint.Adm... 04/05/2010 20:08:09.56* OWSTIMER.EXE (0x125C) 0x101C Office Server Office Server Shared Services 7u16 Critical ...inistration.SPProcessIdentity.get_

No exception yet no correct result while decryption


Hii.....i made a program for encryption and decryption of files usign rijndael.can anyone guide me what's the problem with this code because it is not giving me any error or exception yet no correct decryption takes place.Button1_click is for encryption and button2_click is for decryption.

byte[] tmpSource;
        byte[] tmpHash;

protected void Button1_click(object sender, EventArgs e)
            if (FileUpload.HasFile)
                tmpSource = ASCIIEncoding.ASCII.GetBytes(this.TextBox1.Text);
                tmpHash = new MD5CryptoServiceProvider().ComputeHash(tmpSource);
                string rturn = ByteArrayToString(tmpHash);
                byte[] key = Encoding.ASCII.GetBytes(rturn);
                FileStream outputStream = new

The signature or decryption was invalid



         We are using wse 2.0 sp2 and I recently installed a new webservice as windows service previously it worked fine but once I re-installed it as windows service it throws an error

The signature or decryption was invalid

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.Services.Protocols.SoapException: The signature or decryption was invalid

Source Error:

[SoapException: The signature or decryption was invalid] Microsoft.Web.Services2.Messaging.SoapClient.SendRequestResponse(String methodname, SoapEnvelope envelope)

This is really imp

Encrypting and Decryption in Sql; server


Following is the Link for Encryption and Decryption I searched for but it is Not working properly


Can AnyBody please provide me the correct form for encrypting and Decrypting. It has to be a solid to work .

Its Very urgent.

Decryption logic


want to find a way to decrypt a password in the database. I have an encrption key and the algorithm used for encryption was Rijndael/AES (32 bit). 

Certificates: Cannot find the certificate and private key for decryption Error when sign

Note: from stackoverflow: I think is better for system administrators.

I work in company with many servers and Pcs for developers. Servers are win2003, PC developers Windows XP.

In a server Win2003 named preiis01, in preproduction environment, other people in company install a client certificate using any other user (domainCompany\adminsystems) for logging in server preiis01.

Anyone admin uses the user "domainCompany\adminsystems" for log in server preiis01 (using Terminal Server, Remote Desktop for Windows XP).

the admin user is domainCompany\adminsystems", which installs certificate.

Admin user install it like this:

Session login like "domainCompany\adminsystems"
Certificate is PFX file. Do Install PFX and using Wizard. The key private not check for export.
Input the password and install.

There is an application Web which AppPool Identity is: NETWORK SERVICE account.

web server is IIS 6.0.

in preiis01,

That admin user executes mmc -> Snap in -> Certificates for Local Machine. In no

Decryption problem at different machine.



I have one problem with encrypting data at one server and decrypting that on other server.

We have Sql server 2008 Cluster on Win2K3 64 bit server. and client machines are 32 bit XP machines.

I also have a library that encrypt and decrypt data using AES 128 bit using RijndaelManaged class.  I have registered this Dll in SQL Sever and using this dll at client application as well.

now problem is that when I encrypt the data at SQL Server using a fix key and IV, the encrypted data is not decrypted at client machine. It throws the error "Padding is invalid and cannot be removed."

Though when decrypting the same text at SQL Server end, it works fine.

How can this  be achieved?




Encryption and Decryption in SQL Server 2005


Hai All,


 I want to do Encryption and Decryption in SQL Server 2005. I'm using the follwing coding:


Insert tblSymmetrictblEmp ([SYM_Id],[SYM_Designation],[SYM_Firstname],[SYM_Department])values
 encryptbykey(key_guid('SymmetrictblEmp'),'29'), 'Vadivel'


The Value gets inserted but the field [SYM_Firstname] is Blank.. Not even Null. Its just Empty. Can anyone help on this ???

Best Regards, Suderson P If this is helpful, please Vote as Helpful If this answers your doubt, Mark As Answered

encryption and decryption is web.config


Hi there,

I walk through this article about encryption and decryption http://msdn.microsoft.com/en-us/library/2w117ede.aspx

but if i move my encrypted application to another server  i can decrypt it easily using the following command :

aspnet_regiis -pd " connectionStrings" -app "/myapplication"

so anyone who knows this command can decrypt it easily. so what is the use of the rsa key in this case.

how can i prevent anyone from decrypting my web.config

thxs for ur help

Problem with decryption data in stored procedure if local date on my machine was changed


Hi people!

Can anybody help me with my problem?

I have one machine (Server 2003 x64 SP2, SQL Server Standard Edition (64-bit) version 9.00.4053.00). Also I have a stored procedure in database that doing a validation of users, and contains the next code:

OPEN SYMMETRIC KEY PasswordFieldSymmetricKey
  CONVERT(varchar, DecryptByKey(EncryptedPassword)) AS 'Password'
  FROM [User]
  WHERE ([Login] = @Login)
        AND (CONVERT(varchar, DecryptByKey(EncryptedPassword)) = @Password);
CLOSE SYMMETRIC KEY PasswordFieldSymmetricKey;

All works correctly but if i change the "Date and Time Properties" on my machine i receive the next error

(0 row(s) affected)
Msg 15315, Level 16, State 1, Procedure user_login, Line 111
The key 'PasswordFieldSymmetricKey' is not open. Please open the key before using it.

If i set the current date it will work correctly again.
One strange thing:
if execute the query "SELECT * FROM sys.symmetric_keys" i have the next date of creation for my symmetric keys

2010-11-04 11:18:49.300

And if i set a date less then date of

Decryption leading to unreadable data .



       I Encrypted a column using symmetric key encryption .later i tried to decrypt it where i ended with data in chinese language.How to resolve this.Please help me,



Chaithanya M


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend