Cryptography and Compression

T

Tom

Hi,

I have a project involves in file compression and
encryption (generate asymmetric key for file transfer).

Which API should I use in C++?

Which good book or online material for this topic?

If there are C, C++, VC++ and C# for selection, which
programming language is the best in this topic?

Thanks for any advice.
 
C

Carl Daniel [VC++ MVP]

Tom said:
Hi,

I have a project involves in file compression and
encryption (generate asymmetric key for file transfer).

Which API should I use in C++?

Which good book or online material for this topic?

If there are C, C++, VC++ and C# for selection, which
programming language is the best in this topic?

Thanks for any advice.

A couple pieces of advice:

1. Get "Applied Cryptography" by Bruce Schneier and read at least the
introductory chapters.

2. Get Crypto++ (http://www.eskimo.com/~weidai/cryptlib.html) if you'd like
a more nuts-n-bolts solution (pick & choose your algorithms & techniques)
than what the Windows Cryoto API provides.

3. You don't want to use an asymmetric cipher for bulk file encryption:
they're much too slow. Instead, what's normally done is the bulk data is
compressed, then encrypted using a symmetric cipher and a random "session
key". The session key is then encrypted with an asymmetric cipher and
appended to the compressed/encrypted file.

-cd
 
W

William DePalo [MVP VC++]

Tom said:
I have a project involves in file compression and
encryption (generate asymmetric key for file transfer).

Which API should I use in C++?

About a dozen of them. :)

Seriously, cryptography is a huge, complex topic. Windows has a cryptograpgy
API which allows applications to make use of the features supplied by
cryptographic service providers. There is a base level
provider available in most versions of Windows. Check the docs for
CryptAcquireContext() and follow the links back to the overview. Also check
the Platform SDK and VC++ installations which have some samples.

Regards,
Will
 
L

Leon Finker

For compression you can use something like zlib:
http://www.gzip.org/zlib

Like Carl noted you will need Symmetric algorithm for the whole file
encryption. Asymmetric is usually limited to small sized blocks anyway and
is suited well for encrypting the symmetric key.

For encryption you can use .NET provided classes, MS CryptoAPI, OpenSSL, or
Crypto++

..NET based solution is very easy and straight forward to use:
http://msdn.microsoft.com/library/en-us/cpguide/html/cpconcryptographyoverview.asp

Another plus for .NET is that it supports AES/Rijndael on all relevant
windows platforms.

With MS CryptoAPI AES comes only with WindowsXP and Windows 2003.
http://msdn.microsoft.com/library/en-us/security/security/cryptography_portal.asp

There is also a COM based interface over CryptoAPI called CAPICOM:
http://msdn.microsoft.com/library/en-us/security/security/capicom_reference.asp
http://www.microsoft.com/downloads/details.aspx?FamilyID=860ee43a-a843-462f-abb5-ff88ea5896f6
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top