#! /bin/bash

# Generate two files holding 1000 host rsa keys: one for the private
# keys, the other for the public ones.
#
SSH_KEYS_DIR="./templates/sshkeys"
# Remove all the keys.
rm -f $SSH_KEYS_DIR/ssh_host_rsa_key
rm -f $SSH_KEYS_DIR/ssh_host_rsa_key.pub
rm -f $SSH_KEYS_DIR/rsa_key
rm -f $SSH_KEYS_DIR/rsa_key.pub
# Create the empty key list files
touch $SSH_KEYS_DIR/ssh_host_rsa_key
touch $SSH_KEYS_DIR/ssh_host_rsa_key.pub
# Create the keys
for i in `seq 1000`
  do
    echo "\n\n" | ssh-keygen -q -t rsa -f $SSH_KEYS_DIR/rsa_key
    mv $SSH_KEYS_DIR/ssh_host_rsa_key $SSH_KEYS_DIR/prov
    mv $SSH_KEYS_DIR/ssh_host_rsa_key.pub $SSH_KEYS_DIR/prov.pub
    cat $SSH_KEYS_DIR/prov $SSH_KEYS_DIR/rsa_key >  $SSH_KEYS_DIR/ssh_host_rsa_key
    rm $SSH_KEYS_DIR/prov
    rm $SSH_KEYS_DIR/rsa_key
    cat $SSH_KEYS_DIR/prov.pub $SSH_KEYS_DIR/rsa_key.pub >  $SSH_KEYS_DIR/ssh_host_rsa_key.pub
    rm $SSH_KEYS_DIR/prov.pub
    rm $SSH_KEYS_DIR/rsa_key.pub
done

