 |
|
 |
I am a in disbelief.
I was experimenting with strongly signed libraries lately and found a couple of surprising things.
Scenario 1:
I create a program and sign it using a strong name key file:
public main()
{
Console.WriteLine(0x42);
}
My first surprise was that if I edit the executable file with a binary editor I can make it display any other number.
It appears that the signatures are not checked at run-time.
I then pushed it a bit further.
I can push the original assembly to the GAC but not the modified version.
As it returns :
"Failure adding assembly to the cache: Strong name signature could not be verified."
This is expected and I felt a bit better about it.
Scenario 2:
...Until I tried to copy the modified assembly directly into the assembly cache folders.
If I overwrite the assembly in : c:\windows\assembly\gac_64\MyAssemby\2.0.0.0__ba22423234234234a
(you might have to check that the library is not already ngen'd)
Then the tempered library will be used successfully by any program despite the fact that the signature is wrong...
In other word someone could make an alternative version of System.dll or System.Web and any .Net program on the machine will obliviously run it.
...
I'd love to have missed something.
Please tell me I am wrong.
|
|
|
|
 |
|
 |
If you look at older publications such as this http://msdn.microsoft.com/en-us/magazine/cc163583.aspx[^] from 2006 you would come to the conclusion that strong naming signing an assembly would give some measure of tamper proofing. So it does come as a bit of a suprise to find that you can fire up a binary editor, change some data and it will still load.
It turns out that load time checks for applications operating in a Full Trust environment were disabled by default when .NET3.5 SP1 was released, a change that affected the behaviour of .NET2.0 as well. This Strong-Name Bypass feature can be enabled or disabled on a system wide basis via a registry setting or a per application basis with an entry in the app.config file.
It's explained in MSDN .NET4 docs[^] although I only found out about this after I had discovered that an edited strong named signed assembly would load without complaint. One would hope that the Authenticode signature mentioned in that reference is protecting the core system assemblies.
Alan.
|
|
|
|
 |
|
 |
Hello,
I want to develop a Metro App which needs to read e-mails from the Mail app, provided by Windows 8. Do you know a way of accessing the Mail app from my code?
|
|
|
|
 |
|
 |
I'm just guessing here, but I think this isn't going to work because of the sandboxing of Metro apps. My understanding from talking with some MS guys at Build was that if it wasn't available through one of the share contracts, you were going to be able to do anything with another Metro App.
|
|
|
|
 |
|
 |
Hi guys, i'm trying to fetch details of images from a folder like their name and path and i want to save these details in an xml format. can anybody give me some sample code on how to write those details to xml? and then fetch those details on page_load? i just need the xml part.. im stuck. please help. Thanks in advance.
Thanks and regards,
Prashanth
|
|
|
|
 |
|
 |
You can use Linq 2 XML in Metro apps. That would be my preferred way of solving this.
|
|
|
|
 |
|
 |
Hi,Thanks for ur quick response.can you give me a sample please? in asp.net i used to to do this
XmlTextWriter writer = new XmlTextWriter("c:/test.xml", null);
DirectoryInfo d = new DirectoryInfo("c:/images");
FileInfo[] files = d.GetFiles("*.jpg");
writer.WriteStartDocument(true);
writer.WriteStartElement("Images");
for (int i = 0; i < files.Length; i++)
{
writer.WriteStartElement("Image");
writer.WriteStartElement("Filename");
writer.WriteString(files[i].Name);
writer.WriteEndElement();
writer.WriteStartElement("FileSize");
writer.WriteString(files[i].Length.ToString());
writer.WriteEndElement();
writer.WriteEndElement();
}
writer.WriteEndDocument();
writer.Close();
Thanks and regards,
Prashanth
|
|
|
|
 |
|
 |
Off the top of my head, I'd expect it to look something like this:XElement xml = new XElement("Images",
from file in files
select new XElement("Image",
new XElement("Filename", file.Name),
new XElement("FileSize", file.Size)
)
);
xml.Save(path...);
|
|
|
|
 |
|
 |
Hi pete,Thanks for the reply. I tried doing that but i'm getting an error. I forgot to mention that i'm trying to do this in a metro app. That is win 8 consumer preview with vs 2011 exp beta. Here is my code. Can u tell me what changes should i make?
StringBuilder output = new StringBuilder();
StorageFolder folder = await Windows.ApplicationModel.Package.Current.InstalledLocation.GetFolderAsync("Big");
IReadOnlyList<StorageFile> file = await folder.GetFilesAsync();
string r= file.Count.ToString();
foreach (StorageFile file1 in file)
{
output.AppendLine(file1.Name);
}
this.one.Text = output.ToString();
XElement xml = new XElement("Images",
from file1 in file
select new XElement("Image",
new XElement("Filename", file1.Name),
new XElement("FileSize", file1.Size)
)
);
xml.Save("Data.xml");
when i run this im getting an error in " xml.save("Data.xml");"
Error 1 The best overloaded method match for Error 2 Argument 1: cannot convert from
Thanks and regards,
Prashanth
|
|
|
|
 |
|
|
 |
|
|
 |
|
 |
You can do following:
1. Create a class with all the properties which you want to save in an XML file.
2. Fetch the details of images from a folder and store it in an object of this newly created class.
3. And then with few lines of code, you can convert this object into XML
I have created a generic Serializer method which you can use. View the whole article on my Blog:
http://www.darshansblog.com/xml-serialization-and-deserialization/
There is a sample project which can properly explain you how to use it.
Good Luck
|
|
|
|
 |
|
|
 |
|
 |
Hi all,
At my company we are using excel to register our working hours. I created a very intelligent xls file but because some people use open office i had to remove a lot of it. Now that means that the HR person needs to do a lot of work entering the data from the basic excel sheet to my intelligent work sheet so the calculations are done for her.
For the moment i am trying to create an Excel Add-in using vb.net to do this.
The purpose of the add-in is to import the data from the basic to the intelligent sheet. but i seem to have run in to a problem:
How can i write data into the current XLS file. normally you open the file using code but because it is an excel add-in the file is already open in excel. So how can i use the current open file
any help is welcome.
Cornille Michiel
|
|
|
|
 |
|
 |
Hi, this is not the correct forum for this question. You will probably get a better response asking your question here[^].
|
|
|
|
 |
|
 |
Hello all .Net Addicts, seekers, masters and developers
first of all i want to avail the chance to say that i'm very glad now i'm in the .Net world and now that i'm capable to develop under Visual Studio, and as a student, software developing and programming is the best field out there. and now that i'm continuing my engineering studies i need to implement an application for my final project assignment..
and for that purpose i'm looking to create a WPF/WCF chat application that allows the following functionalities :
- communication via lan
- chatting via text, video(webcam) and audio
- exchange files
- save conversation logs
i'm seeking your help to achieve the implementation of this application, so please if there is any samples that i can follow i'll be glad to hear you.
ps: i've already implemented the chat application in this article. WCF / WPF Chat Application[^]
any help would be more than appreciated !!
|
|
|
|
 |
|
 |
help me....!
how to use automation applications and give some examples ?
|
|
|
|
 |
|
 |
This has nothing to do with .NET 4.5 or VS11. Could you please ask this in a more relevant forum?
|
|
|
|
 |
|
 |
Not sure what you're trying to achieve... not only is this not in an appropriate forum, the question is vague (at best).
|
|
|
|
 |
|
 |
I am using .net 4.0, visual studio 2010. I have a requirement to get a list of group names from AD (Active directory) of a network folder. Can somebody guide me on or send me the code to achieve this.
|
|
|
|
 |
|
 |
This has nothing to do with .NET 4.5 or VS11. Could you please ask this in a more relevant forum?
|
|
|
|
 |
|
 |
can any one tell me the way how to download an attachment file from gridview ???
|
|
|
|
 |
|
 |
I'm sorry but it looks like you have posted this in the wrong forum. You may want to try this in the ASP.NET forum instead.
|
|
|
|
 |
|
 |
Post this question in questions forum man..
|
|
|
|
 |
|
 |
I write as a novice and happen to own Visual Studio. I have been asked about a business programming language... XBRL which is extensible business reporting language. Can Visual Studio understand XBRL so that applications can be written? Much thanks for an informed reply.
|
|
|
|
 |