Solved

Urgent Help on CAPICOM Decrypt and Encrypt

Posted on 2004-09-27
4
610 Views
Last Modified: 2012-06-22
Dear all,

I'm new to CAPICOM not sure how to use it in C# Web application. As I know, CAPICOM does have a function to decrypt and encrypt some string. The question is, how to use CAPICOM to encrypt and decrypt given string ?

Below is the encrypted string, but how to decrypt it back to original string ?

EncryptedDataClass Crypt1= new CAPICOM.EncryptedDataClass();
Crypt1.SetSecret("MyPassword",CAPICOM_SECRET_TYPE.CAPICOM_SECRET_PASSWORD);
Crypt1.Content = "Some text to encrypt";
string data = Crypt1.Encrypt(CAPICOM_ENCODING_TYPE.CAPICOM_ENCODE_BASE64);
this.Label1.Text = data;

Please give some example on method to decrypt.

Thanks in advance


Cheers,
yymae
0
Comment
Question by:yymae
4 Comments
 
LVL 6

Accepted Solution

by:
mogun earned 100 total points
ID: 12167741
Use the Decrypt method of the encrypteddata class.. You will have to specify same secret password that used for encrypting.

string decrypteddata = Crypt1.Decrypt(data);

where "data" is your encrypted data.

BTW, why are you using CAPICOM, when you have System.Security.Cryptography ?

Cheers
Mohan

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question