Encrypt your hard disk in C# [closed] - encryption

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
How to secure a hard disk programmatically through C#?
Like if a user wants to open a hard disk and first he/she has to give a password to access it. If the password is wrong then the hard disk is hidden from that user..

If you're trying to do this inside an app written in C#:
Get logical drives:
string[] drives = Directory.GetLogicalDrives();
Also check this out:
http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_23825199.html
http://bytes.com/topic/c-sharp/answers/276247-get-drive-letter-win32_diskdrive
You'll need to expand that more. Associate a drive letter with a password and keep that stored somewhere. If the entered password is correct, show that drive as you already have a list/array of them. (note it's too early for me to write this all out and I have a cold - but it's fairly simple).
You have your list of drives, you check a password to see if they can see a drive, if so let them see it.
If you are trying to restrict the entire windows system from showing drive letters based on a password, I would say do not use C#. This is a windows security issue.
I would recommend reading abot MS Group Policies. This article can help you:
http://support.microsoft.com/kb/231289

I don't think this can be done transparently (you can access the file with any program) and securely (that is, the disk is actually encrypted, not just hidden from the shell) in C# (on Windows, not on Singularity). To decrypt the disk on the fly you need a kernel mode driver. And you can't write that in .NET.
On Linux you might be able to write a FUSE (usermode) driver in C#+Mono.

Related

Keep running an action after user closes broswer

I know this may not be an ideal stackoverflow question but I'm not sure where else to ask. To cut a long story short, I've built a web app running on a LAN network. The reason for this is that it is located somewhere there is very limited internet access. But there is one part of the app that needs to connect to the outside internet with Twilio.
So basically my question is, how do I get the script to keep trying to send the text message even if the user exits the session? Would some kind of cron job work or would I better off using asp.net or node.js? Or could a cgi script do it? Sorry if this is a silly question, I'm not overly familiar with how servers and all that actually work.
Thanks guys, let me know if anything needs clarifying
You can use fire and forget approach; however, it is not recommended.
Task.Run(() => StartLongRunningProcess());
Instead, you might want to consider using Background Tasks such as hangfire.
How to run Background Tasks in ASP.NET

Decrypt an encrypted file/folder. [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I have a encrypted file and i am aware of its password. I am trying to decrypt it but i could not find any properties of this file such as the type of algorithm/program that was used to encrypt the file originally.
I am thinking to try 'gpg' and 'openssl' and other techniques that can be used to decrypt this file without corrupting it. Although i have taken the backup, it's a huge file which takes roughly 3hrs for backing up. Hence i am extra careful so that it does not goes corrupt.
Thanks,
The general idea of encryption is that the result should be indistinguishable from the noise.
That automatically means, that unless you know all the parameters, you won't be able to infer it from the encrypted file if it was done right.
Unless you brute force all the possible types of encryption and their parameters (good luck with that!).
In a nutshell, you are going to have to find out what program was used to encrypt the file, and maybe, possibly (but probably not) have to know how the program was configured. People have been using computers for encryption almost as long as computers have existed. There are hundreds of different encryption programs that have been published over the years.
Your best bet is to get the developer to tell you which program he used and how to use it.
Your next best bet is to search through your backups of every machine he used looking for some clue as to what program he used.
If that doesn't help, it's time to start trying every encryption program you can get hold of. Obviously, you'll want to start with the newer ones, and the more popular ones, and the ones that run on whatever operating systems he was known to use.
Considering the size of the file, it's likely that you're dealing with an encrypted archive or, an image of an encrypted file system. So, don't limit your search to specialized encryption utilities. You'll also want to try all of the different archivers and all of the different file systems and operating systems that offer encryption as a feature.
If you've tried every encryption program without success, and you still haven't blown your budget; then the next step is going to blow your budget. I'm pretty confident in saying that because if your organization was the kind that could afford to take the next step, then you wouldn't be asking how to do it on StackOverflow. Heck! You probably would not even be allowed to use StackOverflow without written permission from three levels up the hierarchy.

Decoding MIME/SMIME Messages in Biztalk [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am developing a sample Encryption/Decryption solution in biztalk. for that purpose I created Test certificate by using Testcert utility. Then I successfully encrypted a message through MIME/SMIME encoder using test certificate. My problem is when I try to decrypt the previously encrypted file I get following error message:
There was a failure executing the receive pipeline: "EncryptionDecryption.ReceivePipeline1, EncryptionDecryption, Version=1.0.0.0, Culture=neutral, PublicKeyToken=de95fc107454e1ca" Source: "MIME/SMIME decoder" Receive Port: "ReceivePort4" URI: "C:\BIZTalkProjects\EncryptionDecryption\DecIN*.xml" Reason: There was an authentication failure. "Failed to decode the S/MIME message. The S/MIME message may not be valid.
What could be the reason? please help me. I am using biztalk server 2010.
Regards,
Shabbir
Did you check the procedures to write and read out the data? Decoding usually happens before the content is decrypted. Make sure that the file is complete and fully available in memory before the decrypt methods are called.

Get Website Name using asp.net [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
i want to get website name using asp.net
i have one website that website contain generic handler page. so my client's website send http request to my site. that time i want to validate whether the request come from my client website or any other site?. so how to find the website name?
I want to create api to send and receive http request. so thats way i need this coding.
Request Example:
http://MySite.com/GetRequest.ashx?mobile=9894380156&opt=RA&amt=10"
Response Example:
Recharge Accepted
Websites don't have a name property that you can pickup, but you can check various properties of the Request object and attempt to infer the origin of the request. For what I think you're trying to do you'd probably need to maintain a list of IP addresses/domains for your client sites and code some logic for this yourself.
Hope this helps.
I think what links between you and another website is the URL and you can use the information available in the new Uri("Your Site URL") and it can provide you with some valuable information about the url u are calling.

How to restrict a user to enter data when a session expired in ASP.NET? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
I have developed a ASP.NET application,I have used sessions for parameter passing.
I dont want to let the user to enter data when the session expired.Please suggest me how to do that.
Create a base page, inheriting from System.Web.UI.Page and in the on load event check your sesion object and if its null then redirect to the homepage and then have all your pages inheriting from that.
However as already commented on by others you database connection should not be left open anyway. Your UI shouldn't have any knowledge of your db connection. Your business layer is where you should be using your db connection.
In your business layer assuming your are using SQL you should have a statement something like:
using (SqlConnection con = new SqlConnection(connectionString))
{
}
At the end of the using statement your sql conection will be disposed. For more information, you might want to look at this article:
MSDN SqlConnection
Thanks
Paul

Resources