Link to home
Start Free TrialLog in
Avatar of SkipFire
SkipFire

asked on

Certificate Encryption/Decryption Example

I need a good, and preferably simple, tutorial on how to create a X.509 certificate and then sample code using that certificate to encrypt and decrypt.  The application I need to integrate the encryption into is on .NET 2.0, and I will take C# or VB code.
ASKER CERTIFIED SOLUTION
Avatar of joechina
joechina

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of SkipFire
SkipFire

ASKER

Thanks joechina, I was hoping you would find and respond to this.  I'll give it a try and get back to you asap.  This is back on that java junk I was dealing with a month ago.  I can't get .NET to recognize their cert as valid, so I figured I would build a .NET sample end to end and make them encrypt with what I know I can decrypt.
I looked through both of the links, but I don't see how I get a PKCS12 certificate from Windows 2003.  I went into the certsrv site and I see a chain download which is a PKCS #7 and if I request a new certificate I see an option to generate a PKCS10.

What is it I am not understanding?
Hi, SkipFire,

Microsoft CA server is to sign the certificate. I think the browser generates the keys and send it to CA server for signing.
For some reason, IE won't let you export the private key. (PKCS12 file). But FireFox does. Please use FireFox and connect to MS CA server and request a personal cert and install it. After that you should be able to export a PKCS12 file from the option menu.

BTW, here is detail description of various PKCS standards.

http://en.wikipedia.org/wiki/PKCS

Good Luck
Ok, I've got a certificate that it seems to recognize.  What are the VerifyData and SignData function used for?  Nothing calls either function which is why I'm not seeing their purpose.
VerifyData and SignData are used for digital signature

For example, if I send you a message and don't care other person can see it or not, I will call SignData(with my private key) and send you both the data and the result string returned by SignData. When you receive them, you can call VerifyData(using my public key) to make sure the message is sent by me not by any other person.

Hope this explains,
(Sorry for the later reply)