|
I was able to encrypt and decrypt the password with no problem at all. However, I needed to encrypt and decrypt the username also. When I copied my encrypt/decrypt password methods to encrypt/decrypt username...I can't decrypt the username anymore. The last 6 characters are correctly decrypted..but the first few characters are not.. Please help! I'm stuck with this!
Here's the code:
private string GetDecryptedUsername()
{
string strReturn = "";
try
{
Decryptor dec = new Decryptor(algorithm);
dec.IV = Convert.FromBase64String(enc_setting.IV);
byte[] key = Convert.FromBase64String(enc_setting.EncryptKey);
byte[] plainText = dec.Decrypt(Convert.FromBase64String(enc_setting.Username),key );
strReturn = ASCIIEncoding.ASCII.GetString(plainText);
}
catch(Exception ex)
{
throw ex;
}
return strReturn;
}
private string GetDecryptedPassword()
{
string strReturn = "";
try
{
Decryptor dec = new Decryptor(algorithm);
dec.IV = Convert.FromBase64String(enc_setting.IV);
byte[] key = Convert.FromBase64String(enc_setting.EncryptKey);
byte[] plainText = dec.Decrypt(Convert.FromBase64String(enc_setting.Password), key);
strReturn = Encoding.ASCII.GetString(plainText);
}
catch(Exception ex)
{
throw ex;
}
return strReturn;
}
//----working----
private void GenerateEncryptedUsername(ref Setting settingU)
{
try
{
Encryptor enc = new Encryptor(algorithm);
byte[] plainText = Encoding.ASCII.GetBytes(settingU.Username);
byte[] key = Convert.FromBase64String(settingU.EncryptKey);
byte[] cipherText = enc.Encrypt(plainText, key);
settingU.IV = Convert.ToBase64String(enc.IV);
settingU.Username = Convert.ToBase64String(cipherText);
}
catch(Exception ex)
{
throw ex;
}
}
private void GenerateEncryptedPassword(ref Setting setting)
{
try
{
Encryptor enc = new Encryptor(algorithm);
byte[] plainText = Encoding.ASCII.GetBytes(setting.Password);
byte[] key = Convert.FromBase64String(setting.EncryptKey);
byte[] cipherText = enc.Encrypt(plainText, key);
setting.IV = Convert.ToBase64String(enc.IV);
setting.Password = Convert.ToBase64String(cipherText);
}
catch(Exception ex)
{
throw ex;
}
}
Thanks much,
wo1noreen
|
|
|
|
|
i wanna read data form excel and show it into dataView in .net 2005.
please help me?
|
|
|
|
|
This article[^] might help you. Its about DataGrid and not DataGridViews but usage should be the same.
|
|
|
|
|
I want to Design Hierachy Model tab Control in C#.NET. Anybody can help me PLEASE.....................
Anybody can Help me please.............................................
Haridas.R
harisofttech@hotmail.com
"Achievement is not a destination, its a journey "
|
|
|
|
|
I tried every piece of code possible. The latest is:
comboSelect1.DataBindings.Add("DisplayMember", dsDenumiri1.Tables["Denumiri"], "Statie_Nume");
comboSelect2.DataBindings.Add("DisplayMember", dsDenumiri2.Tables["Denumiri"], "Statie_Nume");
comboSelect1.DataBindings.Add("ValueMember", dsDenumiri1.Tables["Denumiri"], "StatieID");
comboSelect2.DataBindings.Add("ValueMember", dsDenumiri2.Tables["Denumiri"], "StatieID");
but i just can't bind these 2 comboboxes to the datasets!
the error is the same:
An unhandled exception of type 'System.ArgumentException' occurred in system.dll
Additional information: Could not bind to the new display member.
Please Help me!!
rzvme
|
|
|
|
|
Hi
First you shouldn't add two bindings to the same cotrol.
Second for the combo you have the list datasource which is the datatable in your case and which uses DisplayMember and ValueMember and also you have the current record which you want to edit.
You should try to use only one binding on "StatieID" and when the combo value is changed change the name. ALso you should check that the datasource set on the combo contains the two columns ("Statie_Nume", "StatieID")
damianbc
|
|
|
|
|
what are the methods of DataGrid Class?
|
|
|
|
|
Alamzeb khan wrote: what are the methods of DataGrid Class?
A lot of the questions you are asking here are ones you should be able to find out by searching
http://msdn.microsoft.com/library (or http://msdn2.microsoft.com is more direct)
or, if you have Visual Studio, the online help.
In general the best way to get your questions answered here is to try something first and then ask when you get stuck.
Kevin
|
|
|
|
|
hi
i want to know, may I set the opacity for a usercontrol? if yes how?!
thanks
Salmani
|
|
|
|
|
how to display collection of video continusly .
i used component that in .net (COM component)
Amal
|
|
|
|
|
how to search a specific record in C#
|
|
|
|
|
how to search a specific row in DataTable and DataView in C#
|
|
|
|
|
hi
i couldnt find out your mean! but i think it would be useful for u.
dt_authorsDetails.Rows[0][0]
|
|
|
|
|
How to Search a specific record in a table in C#
|
|
|
|
|
you use a simple SELECT :
odbcCommand.CommandText="SELECT recordname FROM tableX WHERE recordname='something'";
first u must connect to the dAta base
this is for ODBC :
odbcCon = new OdbcConnection("DSN=The Data Source");
odbcComm = odbcCon.CreateCommand();
odbcCon.Open();
but it depends what data base u have
|
|
|
|
|
how can i make my own inputbox in C#
|
|
|
|
|
The easiest way is to make a class that inherits the standard input box, and add the funcionality that you want.
---
b { font-weight: normal; }
|
|
|
|
|
i need an example code on delegates and thier functionality
thanx
|
|
|
|
|
Instead of sending more questions to codeproject, you can try to search it in google.
http://www.akadia.com/services/dotnet_delegates_and_events.html
|
|
|
|
|
|
they are the same as function pointer in C++. But in C#, it's much easier to use once you figure out the syntax. Very useful and powerful, if you want to unify your code. there are full of articles on it.
Donkaiser
|
|
|
|
|
is it possible to make a child consistently active? if it is activates, all other children should not be given focus. is this possible? THanks!
|
|
|
|
|
hi,
how can i stream the sound live from the microphone with directx.net???
directx has a capture sound (managed) sample...but the problem here is:
public CaptureBuffer applicationBuffer = null;
applicationBuffer.Stop();
CaptureData = (byte[])applicationBuffer.Read(NextCaptureOffset, typeof(byte), LockFlag.None, LockSize);
...the buffer only could read if the applicationBuffer.Stop() is called...thats not fine for a live stream....
any other idea? will i need a any graphBuilder??? how does it work?
best regards, surf
|
|
|
|
|
I have a project that uses a COM DLL. .NET created an interop assembly for me. I want to embed the DLL and the interop (Type Library ?) within my application so as to have a single file execution(the executable). Is this possible?
I have tried adding the files as embedded resources, but still get a file not found exception when I run the application.
Thanks
www.lovethosetrains.com
|
|
|
|
|
Hi!
You can't embed other assemblies in your executable as resources and expect the framework to find them.
Resources are for images, strings and so on, not for compiled code!
There is a tool, though, that can wrap all assemblies your application needs into a single executable: http://research.microsoft.com/~mbarnett/ILMerge.aspx
But if you access COM objects, these cannot be merged into your application at all, only the interop assembly.
Regards,
mav
--
Black holes are the places where god divided by 0...
|
|
|
|