Implement FindPersonalDataBox service as isds_FindPersonalDataBox()
[libisds.git] / server / tls / peer
blobcb490b8064c9fd9aa110329882ca7189eacd4479
1 #!/bin/sh
2 PORT=1443
4 function usage() {
5 echo "Bad invocation"
6 cat <<EOM
7 Usage: peer {gnutls|openssl} {server|client}
8 EOM
9 exit 1
12 function gnutls_impl() {
13 CA_ARGS="--x509cafile ca.cert"
14 case "$1" in
15 server)
16 gnutls-serv --http $CA_ARGS --x509keyfile server.key \
17 --x509certfile server.cert -p "$PORT" -r
19 client)
20 gnutls-cli $CA_ARGS --x509keyfile client.key \
21 --x509certfile client.cert -p "$PORT" localhost
24 usage
25 esac
28 function openssl_impl() {
29 CA_ARGS="-CAfile ca.cert"
30 case "$1" in
32 server)
33 openssl s_server -www $CA_ARGS -key server.key \
34 -cert server.cert -accept "$PORT" -Verify client.cert
36 client)
37 openssl s_client $CA_ARGS -key client.key \
38 -cert client.cert -connect "localhost:${PORT}"
41 usage
42 esac
45 case "$1" in
46 gnutls)
47 gnutls_impl "$2"
49 openssl)
50 openssl_impl "$2"
53 usage
54 esac