BASH   186
if ne 1 a ne 2 then echo usage 0 path to ssl dhparams pem 1024
Guest on 28th November 2024 07:11:11 AM


  1. #!/bin/bash
  2.  
  3. if [ $# -ne 1 -a $# -ne 2 ]; then echo "Usage: $0 </path/to/ssl-dhparams.pem> [1024, 2048 or 4096]"; exit 1; fi
  4. if [ "x$2" == "x" ]; then
  5.    BITS=4096;
  6. else
  7.    if [ $2 -ne 1024 -a $2 -ne 2048 -a $2 -ne 4096 ]; then echo "Bits should be 1024, 2048 or 4096"; exit 1; fi
  8.    BITS=$2;
  9. fi
  10.  
  11. openssl dhparam -out $1 $BITS

Raw Paste

Login or Register to edit or fork this paste. It's free.