|
Hello, I'm trying to send an encrypted picture with C#.
First I read the picture with a FileStream and get its bytes with this code:
public static byte[] Serializa(string Name)
{
FileInfo FichInfo = new FileInfo(Name);
if (!FichInfo.Exists)
return null;
MyFile = new FileStream(Name, System.IO.FileMode.Open);
BytesContent = new byte[MyFile.Length];
MyFile.Read(BytesContent, 0, (int)Fichero.Length);
MyFile.Flush();
MyFile.Close();
FichInfo = null;
return BytesContent;
}
Then I try to encrypt with Managed Rijndael and it throws an exception with the message "Length of the data to decrypt is invalid".
My code to encrypt is as follows:
public byte[] cifrar(byte[] obj)
{
return cifrador.TransformFinalBlock(obj, 0, obj.GetLength(0));
}
Thank you
|
|
|
|
|
It sounds like you have created a decryptor instead of an encryptor.
---
Year happy = new Year(2007);
|
|
|
|
|
No, I have created both of them because my program needs to encrypt and decrypt data. I use the decryptor to decrypt data and the encryptor to encrypt data.
My program seems to deal ok with strings (I can encrypt and decrypt strings correctly) but the problem comes when I try to encrypt the picture.
|
|
|
|
|
The error message that you quoted refers to decrypting. Are you really sure that you get it when you are encrypting?
Have you checked the length of the array, so that you are not trying to encrypt an empty array?
---
Year happy = new Year(2007);
|
|
|
|
|
Hi,
Im trying to retrieve data from my database in Microsoft Access and input it into the spaces in the checkedlistbox. I also want to ensure whatever that is checked to be reflected into the next form. Can someone help please? Greatly appreciate it..! =)
Nicholas
(Student @ Temasek Polytechnic (SIN))
Nicholas Neo
|
|
|
|
|
You must be more specific.
Generally You acquire your data, insert them in the listbox aw though it was a simple one. Based on acquired data you check or uncheck certain items and then through CheckedItems property you continue on your next step that i didnot understand,.
|
|
|
|
|
Hi! Thanks for replying, I've switched to a listbox instead. I want to add items into the listbox. The items added are coming from my database.mdb I've set the listbox properties Datasource to database.mdb(which is my database name). For the case of the display member I set it to the column that I want to display. For the selection mode it will be multi-simple. I'm actually doing a selection of multiple student IDs to be reflected back into the database when a user selects the IDs that he/she wants. Is my way of doing it right?
Nicholas Neo
Nicholas Neo
|
|
|
|
|
I want to export Crystal report in txt format.and throw it printer.
how to implement using ASP.NET and C#.without reportviewer and no data loss
-- modified at 6:27 Monday 22nd January, 2007
i use Crystal Report 10.I implement export method but output data some text missing.And Alignment is incorrect.
have any class file that Configure Crystal report 10.
|
|
|
|
|
Obviously, that it's ASP.NET is irrelevant, you will do this on the server.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i can export crystal report txt format using crystal report 10 dll.but page header,page footer and special field's data not show.
how to solve this
|
|
|
|
|
i am geting config error
Access is denied: 'GotDotNet.Elmah'.
gotdotnet.elmah could not be loaded,
but the reference is added,build succeded butunable to run in browser
PLz send me Slutions
Thanks and regards,
-- modified at 9:52 Saturday 20th January, 2007
surendra
|
|
|
|
|
Hi All,
We are starting a project (.NET/C# DB: SQL Server) and one of the main requirements is performance and reliability (the system is a "critical mission" one).
Could you please indicate articles/books/sites that could help us on:
- Defining the minimum hardware requirements (how many redundant servers should be considered, RAIDs, etc.) based on the expected number of user/requests,ammount of data etc.
- Technologies that could be used in order to support the desired reliability ( distributed services, load balance for example)
Thanks a lot,
Sergio
|
|
|
|
|
Microsoft lists System.Object as a reference type but how a value type like int or bool descends from System.Object?
There's arms,
Caetano
|
|
|
|
|
Caetano wrote: but how a value type like int or bool descends from System.Object
They're not a direct decendant of Object. There's an intervening class, called System.ValueType[^], that overrides the virtual methods in Object and supplies versions that are more appropriate for Value types. The IL for something like System.Int32 says that Int32 is really a structure. Structures decend directly from ValueType.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
hi..
the web pages made with asp.net look fine in internet explorer but with netscape navigator some of the elements behave strangely..
i have a tree control with tables.it loads all data at once in IE (which is how i coded it) but in netscape it refreshes each time i open the parent node ( i dont know why?) and also the tree parent-child positions are distorted in netscape.
so can anyone suggest me how to make my website browser independent
enjoy..
|
|
|
|
|
Use Cascading style sheet to set the size , color etc
Regards,
Sylvester G
Senior Software Engineer
Xoriant Solutions
|
|
|
|
|
hi..
how to clear data in a crystal report viewer in console applications using vb.net.
thanks in advance
enjoy..
|
|
|
|
|
Hi
Can somebody point me to a standard/common method of storing and retrieving constants in code?
The things that come to my mind:
1) Strore them in a module.
Drawback: Would not know the origins of the constant by reading the code. There can be more than one module and constants can be spread across them..
2) Store them in a class as Shared (static in C#) variables.
Drawback: Cannot define them as const, hence the probability of somebody changing the value remains.
3) Store them in a class as Shared (static in C#)ReadOnly Properties.
Drawback: None that I can see (actually this occurred to me while typing this post).
What would be your suggestions and what do you do?
As an aside, do you follow some naming convention for these constants to denote what they might contain and to help in classification?
Shreekar
|
|
|
|
|
There are two types of constant values, constants and read-only members. You have to decide what type you want to use.
Constants are compiled into the code, so if you use a constant from a different project, and then change the constant in that project, you have to recompile the code that uses the constant in order for it to change there too.
Read-only members are read from the source every time, so if you change the value, it's guaranteed to change everywhere it's used. Also, a read-only member can get it's value from an external source like AppSettings. If the external source is expensive to read (like a file or a web service), you can read it the first time it's used and cache it in a local variable.
I usually create a static class called Settings where I put application wide constants and settings. It will contain constants and read-only static properties.
---
Year happy = new Year(2007);
|
|
|
|
|
Hi
Does anybody have any insight as to what exactly this method does?
MSDN shows This[^]
not really helpful. Has somebody used this?
Any ideas?
Shreekar
|
|
|
|
|
Hello,
Any simple way to create custom MSBuild or customize VS.NET 2005 to be
able to build say "Standard", "Professional" and "Enterprise" versions
of a product from the same sources?
Any available tools?
I want to build different versions from the sample source, including
and excluding some features/codes from some versions.
With love,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
I see three different approaches, all with their specific drawbacks:
You could use conditional compilation:
- add #if SYMBOL ... #endif to your source code
- create a new configuration with Configuration Manager
- set the appropriate symbols in Project Properties/Build/Conditional Compilation Symbols
This is only practicle for small differences though.
Or you could just make different projects. Now you must solve the problem anout sharing source
code. Two methods are available:
- since Visual insists on each project having its own directory, create them first,
then move the project files to the original folder and restart Visual.
- or keep the different directories, but rather than adding the source files, use the
"add as link" option hidden under the right arrow of the Add button.
This solution gets painful if you often add files, since now you must repeat this for
each project.
Finally, you could just build one version and cripple it in some way. Of course this
approach is vulnerable, the crippling code could be hacked by the end-user.
Luc Pattyn
|
|
|
|
|
Can someone tell me what the caspol command would be to "My Computer / Runtime Security Policy / Machine / Code Groups / All_Code / LocalIntranet_Zone" to "FullTrust"????
Something like:
Caspol -cg localintranet_zone fulltrust
perhaps?????
I don't want to screw this stuff up.
Thanks
|
|
|
|
|
Is there any particular order you need to follow to install
.net framework, IIS6.0, SDK, sql express 2005, msxml 6.0 parser.
Our network admin configured the server and I'm not sure if the configuration is correct. My .net application isn't working. Any suggestions?
|
|
|
|
|
IIS6 should have been first, MSXML 6.0, then the .NET Framework, whatever that SDK is, then SQL Express.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|