1
# ---------------------------------------------------------------------------
3
# - afnix:sec module global test unit -
4
# ---------------------------------------------------------------------------
5
# - This program is free software; you can redistribute it and/or modify -
6
# - it provided that this copyright notice is kept intact. -
8
# - This program is distributed in the hope that it will be useful, but -
9
# - without any warranty; without even the implied warranty of -
10
# - merchantability or fitness for a particular purpose. In no event shall -
11
# - the copyright holder be liable for any direct, indirect, incidental or -
12
# - special damages arising in any way out of the use of this software. -
13
# ---------------------------------------------------------------------------
14
# - copyright (c) 1999-2011 amaury darsch -
15
# ---------------------------------------------------------------------------
17
# @info aes global test unit
18
# @author amaury darsch
21
interp:library "afnix-sec"
22
interp:library "afnix-sio"
24
# create a symmetric key
25
const key (afnix:sec:Key)
27
# create an aes cipher
28
const aes (afnix:sec:Aes key)
29
assert "AES" (aes:get-name)
31
# create an input string buffer
32
trans ts "afnix security engine"
33
trans is (afnix:sio:InputString ts)
35
# create an input/output stream
36
trans io (afnix:sio:InputOutput)
39
while (is:valid-p) (aes:stream io is)
44
# create an output string
45
trans os (afnix:sio:OutputString)
48
while (io:valid-p) (aes:stream os io)
49
assert ts (os:to-string)