Click here to Skip to main content
16,008,942 members
Home / Discussions / C#
   

C#

 
QuestionSDL.Net on WinForm possible? Pin
RATC16-Apr-05 1:56
RATC16-Apr-05 1:56 
AnswerRe: SDL.Net on WinForm possible? Pin
Heath Stewart16-Apr-05 8:37
protectorHeath Stewart16-Apr-05 8:37 
GeneralRe: SDL.Net on WinForm possible? Pin
RATC16-Apr-05 10:01
RATC16-Apr-05 10:01 
GeneralRe: SDL.Net on WinForm possible? Pin
Heath Stewart16-Apr-05 10:38
protectorHeath Stewart16-Apr-05 10:38 
GeneralRe: SDL.Net on WinForm possible? Pin
RATC16-Apr-05 10:53
RATC16-Apr-05 10:53 
GeneralRe: SDL.Net on WinForm possible? Pin
Heath Stewart16-Apr-05 11:12
protectorHeath Stewart16-Apr-05 11:12 
GeneralRe: SDL.Net on WinForm possible? Pin
RATC16-Apr-05 11:16
RATC16-Apr-05 11:16 
GeneralEncryption/decryption problem Pin
Kordzik16-Apr-05 0:38
Kordzik16-Apr-05 0:38 
I've got two methods:
public void Decrypt()<br />
		{<br />
			ASCIIEncoding text = new ASCIIEncoding(); <br />
			RijndaelManaged szyfr = new RijndaelManaged();<br />
			szyfr.Key=key;<br />
			szyfr.IV=iv;<br />
			byte[] tmp = text.GetBytes(password);<br />
			MemoryStream in = new MemoryStream(tmp);<br />
			CryptoStream deszyfr = new CryptoStream(in, szyfr.CreateDecryptor(), CryptoStreamMode.Read);<br />
			byte[] dPassword = new byte[tmp.Length];<br />
			deszyfr.Read(dPassword, 0, dPassword.Length);<br />
			password = text.GetString(dPassword);<br />
<br />
			<br />
<br />
<br />
		}<br />
<br />
		public void Encrypt()<br />
		{<br />
			ASCIIEncoding text = new ASCIIEncoding(); <br />
			RijndaelManaged szyfr = new RijndaelManaged();<br />
			szyfr.GenerateKey();<br />
			szyfr.GenerateIV();<br />
			key=szyfr.Key;<br />
			iv=szyfr.IV;<br />
			byte[] in = tekst.GetBytes(password);<br />
			MemoryStream out = new MemoryStream();<br />
			<br />
			CryptoStream zaszyfr = new CryptoStream(out, szyfr.CreateEncryptor(), CryptoStreamMode.Write);<br />
			zaszyfr.Write(in, 0, in.Length);<br />
			zaszyfr.FlushFinalBlock();<br />
			password = text.GetString(out.ToArray());<br />
		}


Don't worry about some of these variable names - they're "culturally-influenced"Smile | :)
password, key and iv are members of the class which owns these methods.
This code is virually re-written from msdn and even though it doesn't work. password is encrypted, but the an exception is thrown at
deszyfr.Read(dPassword, 0, dPassword.Length);<br />
, in the Decrypt() method. It says PCKS7 padding is incorrect and cannot be removed (from the decrypted message I guess). When I change paddingMode of szyfr to Zeros, the decrypted password doesn't match the original. It seems that used key or iv don't match, but they actually do, as you cans see from the code. Any idea how I can get the things going?
Questionanyone help with this ??? Pin
Imran Adam16-Apr-05 0:33
Imran Adam16-Apr-05 0:33 
AnswerRe: anyone help with this ??? Pin
DavidNohejl16-Apr-05 1:13
DavidNohejl16-Apr-05 1:13 
AnswerRe: anyone help with this ??? Pin
Heath Stewart16-Apr-05 8:30
protectorHeath Stewart16-Apr-05 8:30 
QuestionHow to use CStringArray in C# using p/invoke Pin
shusong15-Apr-05 23:57
shusong15-Apr-05 23:57 
AnswerRe: How to use CStringArray in C# using p/invoke Pin
Heath Stewart16-Apr-05 8:23
protectorHeath Stewart16-Apr-05 8:23 
GeneralRe: How to use CStringArray in C# using p/invoke Pin
shusong16-Apr-05 15:00
shusong16-Apr-05 15:00 
GeneralRe: How to use CStringArray in C# using p/invoke Pin
Heath Stewart16-Apr-05 22:53
protectorHeath Stewart16-Apr-05 22:53 
GeneralRe: How to use CStringArray in C# using p/invoke Pin
shusong16-Apr-05 23:19
shusong16-Apr-05 23:19 
GeneralRe: How to use CStringArray in C# using p/invoke Pin
Heath Stewart16-Apr-05 23:47
protectorHeath Stewart16-Apr-05 23:47 
GeneralRe: How to use CStringArray in C# using p/invoke Pin
shusong17-Apr-05 1:04
shusong17-Apr-05 1:04 
GeneralRe: How to use CStringArray in C# using p/invoke Pin
shusong17-Apr-05 15:15
shusong17-Apr-05 15:15 
GeneralRe: How to use CStringArray in C# using p/invoke Pin
Heath Stewart17-Apr-05 16:28
protectorHeath Stewart17-Apr-05 16:28 
GeneralRe: How to use CStringArray in C# using p/invoke Pin
shusong17-Apr-05 16:49
shusong17-Apr-05 16:49 
GeneralRe: How to use CStringArray in C# using p/invoke Pin
Heath Stewart18-Apr-05 6:59
protectorHeath Stewart18-Apr-05 6:59 
GeneralRe: How to use CStringArray in C# using p/invoke Pin
ttcchh200812-Jun-10 3:14
ttcchh200812-Jun-10 3:14 
Questionhow to implement WHITEBOARD for many users Pin
xinxin_52515-Apr-05 23:33
xinxin_52515-Apr-05 23:33 
AnswerRe: how to implement WHITEBOARD for many users Pin
Colin Angus Mackay15-Apr-05 23:48
Colin Angus Mackay15-Apr-05 23:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.