DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Questions re: Asymmetric cryptography

  1. #1
    Join Date
    Jun 2005
    Location
    Northern hemisphere
    Posts
    5

    Questions re: Asymmetric cryptography

    Here's what I want to do, in a nutshell:
    Using asymmetric crypto, I'd like to set a hidden ASPX page that takes 4 items, passed to it in a form (let's say), encrypt them, then stuff them into a SQL database. Reason for using an asymmetric algorithm: encrypt with a public key, decrypt with a private key. Once the row has been inserted into SQL, go back to the originating app. This is basically a web app that sits in SSL, which will capture certain timely information, encrypt it (HIPAA/SOX reasons) & store it in a DB, until such time as the Admin staff (with the private key) can retrieve it and process it. This page has no output; success or failure of the DB transaction will dictate its next move.

    So my question(s) - being a crypto n00b:
    1. Is there a better/cheaper/faster/costs less/less filling way to do this?
    2. If I go forward with this as described:
    2a. What's the best way to create a public/private key pair?
    2b. How do I make the public key accessible to the ASPX page for encryption purposes? A key container?
    3. What am I missing here?

    I'm considering posting this outside of the security forum, too - think there's any merit?

    Thanks in advance! All suggestions, advice, (code! haha) and help greatly appreciately!
    Jake

  2. #2
    Join Date
    Feb 2006
    Posts
    2
    Hi

    You may want to keep all of the encryption/decryption server-side. If you exposed the insert functionality via a web service, but only exposed the select query functionality internally, then you could use symmetric encryption, which is faster and needs less setting up.

    I presume your suggested setup means that the encyption functionality would actually be on the client, or the keys would be exposed to the client. In this case, using asymmetric crypto, you'd have to distribute certificates to the clients, and ensure that those clients trusted the CA.

    If you don't associate asymmetric keys with certificates, then your communications are susceptible to a man in the middle attack:
    A sends public key to B
    B encrypts message using A's public key
    B sends message to A
    A decrypts using A's private key

    Everything secure? No.

    A sent public key, which was intercepted by C
    C sends C's public key to B instead of A's
    B encrypts message with C's public key (thinking it was A's public key)
    C intercepts message
    C decrypts message with C's private key
    C changes message
    C encrypts with A's public key (intercepted earlier)
    C sends message to A
    A decrypts, thinking message was from B

    Using certificates means that you can trust the public key ie. it was verified by a Certificate Authority that you both trust.

    If you want to create public key certificates, then install Windows Certificate Services on your machine (for Win 2000 and 2003 Server). Just pop in the 2000/2003 Server install disc and choose to install Certificate Services.

    The only encryption and decryption I've done using this is using encryption/decryption of XML. However, look in the System.Security namespace for .Net 2.0 and there'll be rich functionality to cover what you need.

    If you're still using .Net 1.1, then don't use the system.Security namespace. .Net 1.1 did not link cryptography to private keys in the certificate store. Instead, use CAPICOM, which is a COM based wrapper around the CryptoApi.

    Hope this helps


    Chris Seary

Similar Threads

  1. Replies: 13
    Last Post: 05-23-2005, 05:22 PM
  2. Replies: 0
    Last Post: 02-18-2005, 07:40 AM
  3. Multiple-choice questions in Access
    By Paul Gardner in forum VB Classic
    Replies: 1
    Last Post: 06-15-2001, 09:10 AM
  4. Replies: 0
    Last Post: 08-25-2000, 07:54 PM
  5. Questions
    By Kevin Gray in forum authorevents.kurata
    Replies: 1
    Last Post: 04-17-2000, 01:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center