By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,529 Members | 864 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,529 IT Pros & Developers. It's quick & easy.

DESCryptoProvider

P: n/a
Hi,
How can I use the DES Crypto Provider to take in a string and encrypt that
with a key then return an encrypted string and vica versa? All the examples
I have seen are based on files and streams.

Thanks.
Jul 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You don't have to use a filestream. This example uses a memorystream.

http://msdn.microsoft.com/library/en...yptortopic.asp
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
For a laugh, try web browsing with Opera's User Mode and Nostalgia enabled
Jul 21 '05 #2

P: n/a
If you use the CreateEncryptor/CreateDecryptor method, you will get an
object that implements ICryptoTransform. From there, you can use the
TransformBlock and TransformLastBlock methods directly (you must always use
TransformLastBlock when you pass in the last block of data, as padding is
often involved). Most block ciphers (like DES) support encrypting/decrypting
multiple blocks at a time, so you can actually pass in the entire "string".
I quoted string, becuse the method actually deals with byte arrays instead
of strings.
The CryptoStream is simply a mechanism that simplifies the process of moving
that byte data to a stream.

-Rob Teixeira [MVP]

<di********@discussion.microsoft.com> wrote in message
news:O2**************@TK2MSFTNGP09.phx.gbl...
Hi,
How can I use the DES Crypto Provider to take in a string and encrypt that with a key then return an encrypted string and vica versa? All the examples I have seen are based on files and streams.

Thanks.

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.