~ubuntu-branches/ubuntu/wily/afnix/wily

« back to all changes in this revision

Viewing changes to tst/mod/SEC1000.als

  • Committer: Bazaar Package Importer
  • Author(s): Anibal Monsalve Salazar
  • Date: 2011-03-16 21:31:18 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110316213118-gk4k3ez3e5d2huna
Tags: 2.0.0-1
* QA upload.
* New upstream release
* Debian source format is 3.0 (quilt)
* Fix debhelper-but-no-misc-depends
* Fix ancient-standards-version
* Fix package-contains-linda-override
* debhelper compatibility is 7
* Fix dh-clean-k-is-deprecated

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# ---------------------------------------------------------------------------
 
2
# - SEC1000.als                                                             -
 
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.                  -
 
7
# -                                                                         -
 
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
# ---------------------------------------------------------------------------
 
16
 
 
17
# @info   aes global test unit
 
18
# @author amaury darsch
 
19
 
 
20
# get the module
 
21
interp:library "afnix-sec"
 
22
interp:library "afnix-sio"
 
23
 
 
24
# create a symmetric key
 
25
const key (afnix:sec:Key)
 
26
 
 
27
# create an aes cipher
 
28
const aes    (afnix:sec:Aes key)
 
29
assert "AES" (aes:get-name)
 
30
 
 
31
# create an input string buffer
 
32
trans ts "afnix security engine"
 
33
trans is (afnix:sio:InputString ts)
 
34
 
 
35
# create an input/output stream
 
36
trans io (afnix:sio:InputOutput)
 
37
 
 
38
# stream the buffer
 
39
while (is:valid-p) (aes:stream io is)
 
40
 
 
41
# reverse the cipher
 
42
aes:set-reverse true
 
43
 
 
44
# create an output string
 
45
trans os (afnix:sio:OutputString)
 
46
 
 
47
# stream the buffer
 
48
while (io:valid-p) (aes:stream os io)
 
49
assert ts (os:to-string)