| 1 |
#%# Of course you should provide some test |
| 2 |
#%# |
| 3 |
#!/bin/sh |
| 4 |
|
| 5 |
#%# Maximum verbosity is desired |
| 6 |
set -ex |
| 7 |
|
| 8 |
# Copyright (c) @year@ @name@ |
| 9 |
# Author: @name@ <@email@> |
| 10 |
# |
| 11 |
# This program is free software: you can redistribute it and/or modify |
| 12 |
# it under the terms of the GNU General Public License as published by |
| 13 |
# the Free Software Foundation, either version 3 of the License, or |
| 14 |
# (at your option) any later version. |
| 15 |
# |
| 16 |
# This program is distributed in the hope that it will be useful, |
| 17 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 |
# GNU General Public License for more details. |
| 20 |
# |
| 21 |
# You should have received a copy of the GNU General Public License |
| 22 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 23 |
# |
| 24 |
|
| 25 |
#%# A simple test will encrypt a text, decrypt, and compare. |
| 26 |
#%# Some work might be necessary to set up a test bed. |
| 27 |
#%# |
| 28 |
#%# Feel free to peek into other tests to get an idea what can be done. |
| 29 |
#%# |
| 30 |
#!# Your test might require root privileges but your script might |
| 31 |
#!# not have them. So probe, and exit mit the magical code 77 to skip |
| 32 |
#!# that test instead of failing. |
| 33 |
|
| 34 |
#%# Create your configuration |
| 35 |
cfg="$(printf '{"@mand1@":"%s","@mand2@":"%s"}' "@@" "@@")" |
| 36 |
#%# The input |
| 37 |
inp='hi' |
| 38 |
enc="$(printf '%s' "$inp" | clevis encrypt @pin@ "$cfg")" |
| 39 |
dec="$(printf '%s' "$enc" | clevis decrypt)" |
| 40 |
test "$dec" = "$inp" |