Last active
May 24, 2018 22:18
-
-
Save Crowles/873c0d63e02c8450400da529eaeb6a77 to your computer and use it in GitHub Desktop.
dbkeygen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
keyGen() { | |
echo "Generating keys..." | |
i=1 | |
for ro in {1..15} | |
do | |
openssl rand -hex 16 | while read line; | |
do | |
echo "$i;$line" >> keys | |
done | |
(( i++ )) | |
done | |
if [[ -s keys ]] | |
then | |
echo "Keys successfullly generated!" | |
echo "Encrypting key file..." | |
openssl enc -aes-256-cbc -k -in keys -out keys.enc | |
if [[ -s keys.enc ]] | |
then | |
echo "Key file successfully encrypted!" | |
else | |
echo "Error. Could not encrypt key file." | |
fi | |
else | |
echo "Error. Could not generate keyfile, please check your syntax." | |
fi | |
} | |
keyGen |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment