Encrypting a File Using .NET DC

Our "Tacit Records" columnist shows you how .NET's cryptographic support works using the Cryptostream class, which you can implement within either C# or Visual Basic. Here's how to get started.

Local Companies

Capital Management Consulting,
(202) 527-2022
5411 13th St., NW
Washington, DC
Sophisticated Technologies, Inc.
(301) 731-1015
3311 Grayvine Lane
Washington, DC
Peyton McCall, Inc.
(202) 327-4902
7504 Alaska Ave
Washington, DC
Dantech Corporation Inc.
(888) 868-9015
1700 Verbena St., NW
Washington, DC
The Myta Corporation
(301) 468-7740
6901 Barrett Lane
Bethesda, DC
Symbiont, Inc.
(202) 887-6800
1320 Fenwick Lane
Silver Spring, DC
Enlightened, Inc.
(202) 783-4655
666 11th St., NW
Washington, DC
Evergreen Computer Services, Inc
(301) 758-2986
12421 Alamanco Way
Washington, DC
The Carrington Group, Inc
(202) 726-4441
1818 New York Ave., NE Suite 115
Washington, DC
NGEN, LLC
(301) 531-9700
1101 Mercantile Lane
Washington, DC

provided by: 
Originally published at Internet.com


Part of .NET's security framework is cryptographic support, and the System.Security.Cryptography namespace is the library that supports cryptographic operations. This namespace supports encryption, digital signatures, random number generations, hashing, and secure encoding and decoding. It implements these operations using common cryptographic algorithms, namely RSA, DSA, Rijandel, Triple DES, RC2, MD5, and the SHA family (SHA1, 256, 384, and 512).

Tom Gutschmidt

One class within System.Security.Cryptography, CryptoStream, is provided to encrypt or decrypt content as it is streamed out into a file. Cryptostream defines a stream that links data to cryptographic transformations. Microsoft provides full code versions for implementing CryptoStream within C# or Visual Basic. Following their examples, encrypting a file using CryptoStream is straightforward.

First the System.Security.Cryptography needs to be included, and then a key for encryption or decryption needs to be created or declared. The key must be a constant, and contained within a class or module. There are also other restrictions based on which algorithm is being used...

Read article at Internet.com site

Featured Local Company

Symbiont, Inc.

(202) 887-6800
1320 Fenwick Lane
Silver Spring, DC

Related Local Events
DC Chamber Technology Series: Session 4
Dates: 12/10/2009 - 12/10/2009
Location: Robert H. Smith School at the Ronald Reagan Building and International Trade Center
Washington, DC
View Details

ACIs 3rd Annual Carbon Capture and Sequestration Summit
Dates: 9/14/2009 - 9/15/2009
Location: Omni Shoreham Hotel
Washington, DC
View Details

3rd Carbon Capture and Sequestration Summit
Dates: 9/14/2009 - 9/15/2009
Location: Omni Shoreham Hotel
Washington, DC
View Details

Topics: 
Architecture & Design Languages & Tools Project Management Web Services
Database Microsoft & .NET Security Wireless
Java Open Source Techniques XML