26292 total geeks with 3498 solutions
Recent challengers:
 Welcome, you are an anonymous user! [register] [login] Get a yourname@osix.net email address 

Articles

GEEK

User's box
Username:
Password:

Forgot password?
New account

Shoutbox
MaxMouse
It's Friday... That's good enough for me!
CodeX
non stop lolz here but thats soon to end thanks to uni, surely the rest of the world is going good?
stabat
how things are going guys? Here... boring...
CodeX
I must be going wrong on the password lengths then, as long as it was done on ECB
MaxMouse
lol... the key is in hex (MD5: of the string "doit" without the "'s) and is in lower case. Maybe i should have submitted this as a challenge!

Donate
Donate and help us fund new challenges
Donate!
Due Date: May 31
May Goal: $40.00
Gross: $0.00
Net Balance: $0.00
Left to go: $40.00
Contributors


News Feeds
The Register
Phones for the
elderly: Testers
wanted for senior
service
Lego X-wing fighter
touches down in New
York"s Times Square
Experts: Network
security
deteriorating,
privacy a lost
cause
Internet cafés
declared "illegal
businesses" in Ohio
SAP shuffles execs
to chase cloud
success
AT&T adds 61˘
"Mobility
Administrative Fee"
for users
Microsoft caves to
Google, pulls
YouTube app from
WinPhone Store
Amazon expands
Appstore reach,
gives devs more
user data
Now it gets
serious: Fracking
could RUIN BEER
Reports: New Xbox
could DOOM
second-hand games
market
Slashdot
Human Stem Cell
Cloning Paper
Contains Reused
Images
How the Smartphone
Killed the
Three-day Weekend
Spain"s New S-80
Class Submarines
Sink, But Won"t
Float
Can the Wii U
Survive Against the
PS4 and Xbox One?
World"s Biggest
"Agile" Software
Project Close To
Failure
Google Unable To
Keep Paying App
Developers In
Argentina
Ex-Marine Detained
Under Operation
Vigilant Eagle For
His Political Views
Sues
European Commission
Launches $12
Billion Chip
Support Campaign
Scanner Identifies
Malware Strains,
Could Be Future of
AV
AMD Launches New
Mobile APU Lineup,
Kabini Gets Tested
Article viewer

.NET Framework Cryptography



Written by:dimport
Published by:thinkt4nk
Published on:2003-06-21 07:19:46
Topic:Dot.Net
Search OSI about Dot.Net.More articles by dimport.
 viewed 11441 times send this article printer friendly

Digg this!
    Rate this article :
The .NET Framework contains a rich set of cryptography resources. This document answers some of the questions commonly asked about these resources

Frequently Asked Questions


1. What cryptography resources are available in the .Net Framework?

The .Net Framework Base Class Library’s System.Security.Cryptography namespace contains support for the most common symmetric (ie.DES, 3DES, RC2, Rijndael/AES), asymmetric (ie. RSA, DSA) and hash algorithms (ie. MD5, SHA1, SHA256, SHA384, SHA512). We also ship minimal support for public certificates in the System.Security.Cryptography.X509 namespace. Furthermore we ship a full implementation of the W3C standard for digitally signing XML. The classes supporting this standard can be found in the System.Security.Cryptography.XML namespace.


2. Can I use the cryptography resources from Visual Basic 7?

Yes. Like any other resources in the .Net Framework Base Class Library, the cryptography classes can be accessed and used from Visual Basic 7 without special preparations or precautions.


3. Do you ship with support for strong encryption?

Yes, we support the use of “strong” key lengths in all our encryption algorithms. However, for encryption algorithms that are implemented on top of CryptoAPI you may need to install a High Encryption Pack to upgrade your version of Windows:

For Windows 2000 users, Service Pack 2 includes the High Encryption pack. If you do not have Service Pack 2 installed you need to either (a) install the Windows 2000 High Encryption Pack from http://www.microsoft.com/windows2000/downloads/recommended/encryption/ or upgrade to Service Pack 2.

For Windows NT 4.0 users, Service Packs are distributed in both “standard” and “high” encryption versions. If you do not have a high encryption service pack already installed you can download the high encryption version of Service Pack 6a from this location: http://www.microsoft.com/ntserver/nts/downloads/recommended/SP6/allSP6.asp

For Windows ME, Windows 98 and Windows 95 users, Internet Explorer 5.5 includes the High Encryption Pack. If you are running a version of Internet Explorer earlier than 5.5 you can obtain the corresponding High Encryption Pack for your version of Internet Explorer here:

http://www.microsoft.com/windows/ie/ie6/downloads/recommended/128bit/default.mspx


4. Are the cryptography algorithms in System.Security.Cryptography implemented in managed code.

Most of the algorithms found in System.Security.Cryptography are implemented as managed wrappers on top of Microsoft CryptoAPI implementations. For, instance the RSACryptoServiceProvider class is a managed wrapper around the unmanaged RSA implementation provided by CryptoAPI. However, we ship a number of crypto algorithm implementations (SHA256, SHA384, SHA512, RijndaelManaged) that are not currently available in CryptoAPI. These algorithms are all implemented directly in managed code. We also ship a managed SHA1 implementation (the SHA1Managed class).


5. Is the programming model exposed in System.Security.Cryptography different from Microsoft CryptoAPI?

Yes. Our model is stream-based (see the CryptoStream class, which derives from the System.IO.Stream class). Cryptographic transformations, except for uses of asymmetric algorithms, are always performed on a stream (such as a file stream or another CryptoStream). The CryptoStream class takes care of all necessary buffering.

Furthermore, the default constructors for all our crypto algorithms always populate the algorithm parameters with strong defaults, subject to the availability of strong cryptography on the platform, so that users will get a strong crypto algorithm by simply instantiating the respective class.


6. Do I need to explicitly set algorithm parameters to securely use the crypto algorithms provided in
System.Security.Cryptography?


No. As mentioned in question 6, the default constructors for all our cryptography algorithms will populate the algorithm parameters with strong defaults (for instance, by default we set strong key size and chaining modes). All our cryptography algorithm classes when simply instantiated will represent strong versions of that algorithm. We furthermore always generate a random key when symmetric algorithm classes are instantiated and a random key pair when asymmetric algorithm classes are instantiated.


7. How do I generate an asymmetric key pair?

You do not explicitly need to generate an asymmetric key pair. As mentioned in question 7, on instantiation of the RSA or DSA algorithm classes in System.Security.Cryptography we will automatically generate a random key pair for that instance. Therefore, for randomly generating an asymmetric key pair, simply create a new instance of the asymmetric algorithm you wish to generate keys.


8. How can I reuse an asymmetric key pair?

You can instantiate asymmetric algorithms with the key container name of an existing key pair in CAPI key storage. In order to do this simply fill in the key container name in the CspParameters object and supply this object to the constructor of the asymmetric algorithm. For an example of how to store and retrieve asymmetric key pairs in CAPI key storage please see the sample on this site (www.gotdotnet.com/team/clr/about_security.aspx.).


9. How do I generate a symmetric key?

As is the case for the generation of asymmetric keys (see question 7), creating a new instance of an asymmetric algorithm will automatically generate a random key and initialization vector (IV) for that instance.


10. Does the crypto library have a key management system different from CryptoAPI?

No, we internally use CryptoAPI key storage and you can reference keys stored in CryptoAPI key containers by using the CspParameters object. For a sample of how to store and retrieve your own asymmetric key pair in CryptoAPI key storage see the sample on www.gotdotnet.com/team/clr/about_security.aspx.


11. Can I change the default algorithm instantiated by the abstract classes?

Yes.We ship with a configuration system for cryptography that maps algorithm names to their default implementation in our object hierarchy. You can change these settings by introducing a cryptography configuration section in the machine.config file.


12. Are the crypto algorithms in System.Security.Cryptography FIPS-140 compliant?

Yes, but only for those algorithms that (a) are FIPS-certifiable, and (b) that we implement by calling CryptoAPI on a platform that has been FIPS 140-1 certified. In practice, what this means is that the following managed classes are FIPS 140-1 compliant because they call FIPS 140-1 compliant implementations:

RSACryptoServiceProvider

DSACryptoServiceProvider

SHA1CryptoServiceProvider

DESCryptoServiceProvider

TripleDESCryptoServiceProvider

You can view Microsoft's FIPS 104-1 certificates here: http://csrc.nist.gov/cryptval/140-1/1401vend.htm

For the other algorithms, no FIPS 140-1 certification program currently exists.

This article was originally written by barnseyboy

Did you like this article? There are hundreds more.

Comments:
ObatAsamUrat
2011-06-16 07:31:40
Really very good information web page. I have to admit that we're definitely warm the idea ;) We've only this instant opted in for your current Rss in addition i restarted yet again :*) thankx.
obat asam urat
Anonymously add a comment: (or register here)
(registration is really fast and we send you no spam)
BB Code is enabled.
Captcha Number:


Blogs: (People who have posted blogs on this subject..)
bb
ASP.NET RadioButton GroupName when inside a Repeater on Sun 10th Jun 8am
I was thankful on finding this nugget of code, which makes the groupname work out when slamming in radiobuttons in an asp.net repeater. http://www.codeguru.com/csharp/csharp/cs _controls/custom/article.php/c12371/


     
Your Ad Here
 
Copyright Open Source Institute, 2006