[mapserver-users] msencrypt - tea algorithmos
Daniel Morissette
dmorissette at mapgears.com
Tue Jan 3 10:47:31 PST 2012
On 12-01-03 1:07 PM, Andreas Douvalis wrote:
> In my MS_ENCRYPTION_KEY I have the 32 chars key created by msencrypt.exe
> (ms4w-mapserver 6).
> TEA algorithm needs one 16-chars password to encrypt the string. How
> msencrypt works? How produce the 16-chars password from 32-chars key?
As Jeff already wrote, you will find some information in RFC-18 and in
ticket #1792. You could also look at the source file mapcrypto.c for the
implementation details of each function.
With respect to the encryption key, MapServer also uses a 16 bytes (128
bit) key, but since the key is not limited to ASCII chars, we hex-encode
the 16 bytes, and this results in a 32 chars value. i.e. each pair of
two chars in MS_ENCRYPTION_KEY represent the hexadecimal value of the
corresponding byte of the 16 bytes key. Makes sense?
> Has anybody implemented successfully php code (or other language) for
> the production of the encoded string that msencrypt tool creates?
> I found in this page (http://www.movable-type.co.uk/scripts/tea.html)
> one javascript implementation of xtea encryption but firstly it takes
> 16-chars password and secondly is xtea.
> Can I use MCRYPT_XTEA module of php to produce the encoded string that
> msencrypt tool creates?
That would be worth a try. If it's the same algorithm then it should
produce the same result.
Note that the original (source) strings are padded with 0-bytes before
being encrypted to align with the 8 byte encryption chunks used by the
algorithm.
Also note that the encrypted strings that we place in the mapfile inside
{...} are the hex-encoded result of the encryption to prevent problems
with non-printable bytes/chars.
--
Daniel Morissette
http://www.mapgears.com/
Provider of Professional MapServer Support since 2000
More information about the MapServer-users
mailing list