Tiny asymmetric cipher implementation to validate download

To allow a small C++ application to update itself at clients connected over the internet, I am in need of a mechanism that validates the download based on a public key. Algorithms such as DSA or RSA seem to be able to do this nicely.

However, looking at well-known available libraries for this (Crypto++, LibTomCrypt) they all end up making my binary > 500k larger, while it seems to me such logic can be implemented in a couple of k. Are there any libraries that implement RSA/DSA hash verification in a, say, <20k footprint?


Since I found no libraries that fitted my specific need, I whipped up my own library for this: http://github.com/paiq/dsa_verify. The current implementation has a ~50k footprint of program memory, mainly due to the included bignum math lib, but future versions may be stripped even more.


Do you really need ciphers ? Generally, to validate a download, you can use a hash function like MD5 or SHA. Maybe you can find a small library using these.

Either way, you can try the openssl library. However the .a on my machine is about 400K and 250K stripped.


If you are windows only you may be able to link against the windows Crypto API as long as your apps are deployed on win2k or greater. Windows Crypto MSDN article.

EDIT: Another possible solution, if you just need to verify the the download did not get corrupted a quick bit of googleing found the source to this small implementation of MD5. according to the read-me at the top 3k of object code compiled.

链接地址: http://www.djcxy.com/p/47074.html

上一篇: 从C#做我自己的安装程序?

下一篇: 微小的非对称密码实现来验证下载