Skip to content

Instantly share code, notes, and snippets.

@talwrii
Created January 7, 2017 21:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save talwrii/962be7de9424ec3dfcbd0ba2bcd42760 to your computer and use it in GitHub Desktop.
Save talwrii/962be7de9424ec3dfcbd0ba2bcd42760 to your computer and use it in GitHub Desktop.
#!/bin/bash
# A stupid encrypted calculator
echo 'Creating private key'
openssl genrsa 1025 > /tmp/key.pem
echo 'Creating a request that a CA may sign'
openssl req -new -key /tmp/key.pem -config config > /tmp/cert-request
echo 'Acting as a CA and self-signing certifate'
openssl x509 -req -signkey /tmp/key.pem -in /tmp/cert-request > /tmp/cert
# You can write this in another way using <DES> <>
# The descriptor can then be read to and written to
coproc BACKEND { tee /tmp/input | bc | tee /tmp/output; }
echo 'Starting server using certificate'
openssl s_server -quiet -key /tmp/key.pem -cert /tmp/cert -port 1025 <&${BACKEND[0]} >&${BACKEND[1]} 2>/tmp/error.log
echo "LISTENING ON 1025"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment