Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

As many of you know WordPress uses "secret key" like thing for every AJAX request. Making each request unique and also 'somewhat' secure (just a step ahead than nothing). How would I implement the same using PageMethods (webservice methods inside aspx page) in asp.net application. Some things I have already taken care of are authentication and authorization to access the page.

I would like to know How to generate the same nonce/secret key whatever in C# for asp.net application?

Also doesn't this affect the performance of the application like 100 thousand users use it and each time the method has to go through encryption, random number generation etc..?

Is there any way I can check if posted data is what was actually posted. Checking the integrity of posted data?

Do you need to follow design patterns to secure application logic? Does one exist to make your application at the least somewhat secure?

share|improve this question

1 Answer 1

up vote 6 down vote accepted

I would like to know How to generate the same nonce/secret key whatever in C# for asp.net application?

Read up on HTTP Digest Authentication. It's described pretty well there.

http://en.wikipedia.org/wiki/Digest_access_authentication

Also doesn't this affect the performance of the application like 100 thousand users use it and each time the method has to go through encryption, random number generation etc..?

Hardly. Remember: the connection to the user's desktop is the bottleneck. Checking a nonce is generally trivial, since it's a simple hex digest of data already available.

Is there any way I can check if posted data is what was actually posted. Checking the integrity of posted data?

Read up on Cross Site Request Forgery (CSRF).

http://en.wikipedia.org/wiki/Cross-site_request_forgery

Do you need to follow design patterns to secure application logic?

Yes.

Does one exist to make your application at the least somewhat secure?

Not "One".

Lots and lots.

There is no "somewhat" secure. There's secure and there's broken.

Start with the OWASP top-ten list and read up on the vulnerabilities.

https://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project

Then, find a framework that does this for you and use the framework.

Don't build your own. It's already been done for you. Just pick a framework that does it.


Why security is binary. "perfect security" is an oxymoron -- it only exists where there is no information exchanged.

"Security" doesn't mean "perfect". It means "as good as present technology permits under the circumstances that we've agreed to share information, and I have to assume you're not lying."

If you want "somewhat secure", then you are implementing "somewhat insecure".

If you're going to implement somewhat insecure, you must actually choose the specific kind of insecurity you are going to implement. Generally, you will must either give private information away, allow information to be adulterated or allow a denial of service attack. Pick some combination of things you are going to implement in a "somewhat secure" application.

Try to avoid choosing the "give away the root password" insecurity if you can. Usually, that is isomorphic to "as secure as possible".

share|improve this answer
    
Good answer, an improvement would be to add links to referenced material. –  Josh K Apr 12 '11 at 11:36
1  
Security isn't binary. Do you want something that's proof against my mother-in-law poking around for a few minutes, or something that you're sure the NSA won't be able to crack thirty years from now?, or (more likely) something in between? Perfect security is unattainable, but no security isn't the answer either. –  David Thornley Apr 12 '11 at 13:57
    
it would help me more on the decision if you could provide insightful links to articles, accepted as answer –  Deeptechtons Apr 12 '11 at 14:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.