lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello,
i'm using the Lua bindings for the xyssl (polarssl) for aes and rsa. 
An example of code is at http://code.google.com/p/luaxyssl/source/browse/trunk/test/test.lua?spec=svn66&r=66

AES-question)
i'm getting this error:

xyssl.aes: data must be in 16 byte multiple

local vote    = "www.timesnewyork.com"
local aes_key = 'abcdabcdabcdabcd"
local aes_crypted_vote = lxyssl.aes(aes_key):encrypt(vote)

i don't understand why. Ideas? Is the library supposed to work for any input data? Should I handle padding myself?

RSA-question)
the code snippet shows some RSA related code:
a=lxyssl.rsasign('abc')
assert(lxyssl.rsaverify('abc', a))
a=lxyssl.rsaencrypt('abc')
assert(lxyssl.rsadecrypt(a)=='abc')

I don't get how this is meant to be used with private/public key pairs generated locally, by openssl.
Currently I've implemented by own RSA code, handling the parsing of keys, exponents, padding and etc. But, I'd more than happy to re-use something that is probably less error-prone.

Thanks for any suggestion.
Valerio