- Subject: [slang-users] crypto module
- From: Arik Mitschang <arik.mitschang@xxxxxxxxx>
- Date: Tue, 20 Mar 2012 12:46:02 +1100
Hi John,
I needed and HMAC routine a bit ago and after searching around I
noticed there was no module for cryptographic functions so I made one
myself which wraps some of the OpenSSL EVP library functions. It
provides the following:
digest
hmac
_encrypt & encrypt
_decrypt & decrypt
_genkeyiv
base64_encode
base64_decode
And the included help file has info on all but the base64 functions
(yet). I thought this might be of interest to others out there. One
thing I ran across that I wasn't sure about was leaving items on the
stack in the event of an error. For instance, the _encrypt function
first pulls a single value off the stack corresponding to the
symmetric cipher algorithm, if that doesn't exist it errors there
leaving the rest on the stack. I did this so wouldn't have to load and
free the other variables if they are certainly not going to be used.
Anyway, if you're interested the source is at:
http://web.science.mq.edu.au/~arikm/code/slcrypto/slcrypto.tar.gz
It needs the openssl library to build against, and I didn't make a
config file but something like
gcc -shared -fPIC -lslang -lcrypto crypto-module.c -o crypto-module.so
should work on a linux. The crypto.sl provides higher level encrypt
and decrypt functions with sensible defaults (and compatible with
OpenSSL command line "enc").
Thanks,
-Arik
[2012 date index]
[2012 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]