PC Review


Reply
Thread Tools Rate Thread

DESCryptoProvider

 
 
Guest
Posts: n/a
 
      21st Jan 2004
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.


 
Reply With Quote
 
 
 
 
Morten Wennevik
Guest
Posts: n/a
 
      21st Jan 2004
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
 
Reply With Quote
 
Rob Teixeira [MVP]
Guest
Posts: n/a
 
      22nd Jan 2004
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]

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
DESCryptoProvider Microsoft C# .NET 2 22nd Jan 2004 02:20 AM
DESCryptoProvider Microsoft Dot NET 2 22nd Jan 2004 02:20 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:37 PM.