|
Do you have sample code that produces the decrypted file on disk?
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
I'm using the code from http://www.codeproject.com/csharp/cryptosafe.asp
|
|
|
|
|
There is a part that says:
fout = new FileStream(outName, FileMode.Create, FileAccess.Write);
Replace it with:
MemoryStream mout = new MemoryStream();
And also, replace:
while(true)
{
len = decStream.Read(bin,0,bufLen);
if (len == 0)
break;
fout.Write(bin,0,len);
rdlen += len;
fireMessage(inName,(int)totlen,(int)rdlen);
}
with:
while(true)
{
len = decStream.Read(bin,0,bufLen);
if (len == 0)
break;
mout.Write(bin,0,len);
rdlen += len;
fireMessage(inName,(int)totlen,(int)rdlen);
}
Remember to carry the variable mout around to have access to the decrypted data. I also suggest that you set all mout bytes to zero, so when the program exits, the decrypted data does not stick in memory:
<code>
mout.Position = 0;
for (int i = 0; i < mout.Length; ++i) mout.WriteByte((byte)0);
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
Dear Michel,
Thank you very much. I'll try this up and will inform you with the results
Thank you again.
|
|
|
|
|
Dear Michel,
How can open the retuned MemoryStream Object ? in my case this object is a video file and I want to play it in media player .. the media player needs a path .. how can I get the path ?
Thanks in advance .
|
|
|
|
|
The MemorySTream object resides in memory, unlike a FileStream, which is on disk. If the player needs a path, you are screwed, because you will need to have the decrypted data on disk.
Read the player's documentation to see if there is a possibilty of streaming to it.
--------
"I say no to drugs, but they don't listen."
- Marilyn Manson
|
|
|
|
|
Hi,
Is there any way for creating and removing the ODBC DSN entries using .Net?
Please let me know about the namespaces or classes that are available(if any) for doing this operation.
Thanks,
King
|
|
|
|
|
I have a really strange problem in my ASP.NET app.
the situation is really usual
Do some changes to DB and then refresh data for client
---
SqlCommand myCmd = new SqlCommand ('UPDATE TBL SET ....');
MyTypedDataTable tbl = MyTypedTableAdapter.GetData();
--
so everybody have done something like this. update and refresh.
BUT! Last GetData() returns table without any update.
If I will add Thread.Sleep() between this to lines of code, then everything is working fine.
Do anybody has any ideas why this happens?
all these components are default without any "starnge" settings. there is no cashing and no async calls. just normal SqlCommand and SqlTableAdapter.
|
|
|
|
|
Why don't you make changes to the data in the TableAdapter then use TableAdapter.Update to send the changes back to the database?
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Hi all:
In VS2005.NET, when I select an item from a dropdown list(combobox), I want the detail view to display the corresponding content of the row. I added the following code into the SelectedIndexChanged event of the combobox
DetailsView1.DataBind();
But this doesn't work. Does anybody know how to achieve this functionality please?
Thanks in advance!!!
Asura
|
|
|
|
|
Hi,
How can I copy a file from PC to Pocket PC Emulator? (I'm using VS .NET 2005)
Thanks much,
Hung.
Hung
|
|
|
|
|
You use the remote file viewer and select the emulator that is running.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Can you explain more details! Thanks!Hung
Hung
|
|
|
|
|
Run the application so that the Emulator is running.
Goto:
Program Files->Microsoft Visual Studio 2005->Visual Studio Remote Tools->Remote File Viewer
It will ask what you want to connect to, choose the Emulator.
You can copy files back and forth in the same way you use Explorer.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
mmmm, What if I wanna do this in Visual Studio 2003??
In its directory I only found "Visual Studio .Net tools" which doesn't contain "Remote File Viewer"
|
|
|
|
|
|
Hi,
I'm writing a Chess program. I have a problem with inheritance in .NET:
I think the Queen can inherit both Rock, Elephant because the queen move like the rock + elephant. But .NET does not support multi inheritace.
So, what must I do to implement the move() function of the queen?
Thanks in advance!
Hung.
Hung
|
|
|
|
|
Use interfaces
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
But both Elephant and Rock are "class". I can't change it to "interface" because some object of those need to be created.
Hung
|
|
|
|
|
The interfaces would declare the functions. You would implement the functions in the class that derives from the interface.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
-- modified at 6:40 Thursday 30th March, 2006
|
|
|
|
|
I'm fairly new to C# and .NET (I have not done anything before .NET 2.0) so please bare with me.
It appears that the epoch for System.DateTime within .NET 2.0 is 30/12/1899 where as the epoch for smalldatetime within MSDE (v8 stuffs) is 1/1/1900.
Therefore when using the ToOADate() method the value returned is 2 days out (i.e. 2.0 greater than the value I ought to be passing to the database)
I know I can adjust the value so that the difference is taken into account but I was wondering whether this is a mistake introduced in .NET 2.0 or is a known difference that we need to accommodate for.
Thanks for your time
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
I'm developing a windows application which must have a user login procedure, to provide different system access capabilities to different users.
Each user must be allowed to change his password at any time (so the passwords (or better: the password md5 hashes) cannot be "hard coded" in the software); therefore I'm looking for the best way to store the passwords, and I would like to avoid using the windows registry.
Of course I cannot simply write the user/md5hash pairs in a regular text file, otherwise anyone could simply replace the md5 hashes with the hashes of known passwords and get full access to the system.
Can anybody help me?
Thank you.
|
|
|
|
|
It is probably best practice to encrypt the storage data file and therefore not possible for someone to tamper with the contents.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
Yes, but what kind of encryption do you think would be the best for this kind of problem?
Thanks.
|
|
|
|
|
Use any symmetric-key algorithm such as AES (aka Rijndael), Blowfish, RC4, TDES.
|
|
|
|