Solved

Urgent Help on CAPICOM Decrypt and Encrypt

Posted on 2004-09-27
4
602 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now