# Get a new file argument
function keyringer_get_new_file {
- FILE="$(keyringer_filename "$1")"
+ # File must not contain spaces
+ if [ ! -z "$2" ] ; then
+ FILE="`echo "$*" | sed -e 's/ /_/g'`"
+ echo "File $* has spaces, secret will be named as $FILE..."
+ else
+ FILE="$1"
+ fi
+
+ # Sanitize and complete file name
+ FILE="`echo $FILE | sed -e s/[^A-Za-z0-9.]/_/g`"
+ FILE="$(keyringer_filename "$FILE")"
if [ -z "$FILE" ]; then
keyringer_action_usage
# Aditional parameters
if [ ! -z "$3" ]; then
UNENCRYPTED_FILE="$2"
- keyringer_get_new_file "$3"
+ shift 2
+ keyringer_get_new_file "$*"
if [ ! -f "$UNENCRYPTED_FILE" ]; then
echo "Error: cannot encrypted $UNENCRYPTED_FILE: file not found."
fi
else
UNENCRYPTED_FILE="-"
- keyringer_get_new_file "$2"
+ shift
+ keyringer_get_new_file $*
fi
# Set recipients file
echo -e "Usage: keyringer <keyring> $BASENAME <gpg|ssh|ssl|ssl-self> <file> <hostname> [outfile]"
echo -e "Options:"
echo -e "\t gpg|ssh|ssl[-self]: key type."
- echo -e "\t file : base file name for encrypted output (relative to keys folder)"
+ echo -e "\t file : base file name for encrypted output (relative to keys folder),"
+ echo -e "\t without spaces"
echo -e "\t hostname : host for the key pair"
- echo -e "\t outfile : optional unencrypted output file, useful for deployment"
+ echo -e "\t outfile : optional unencrypted output file, useful for deployment,"
+ echo -e "\t without spaces"
exit 1
elif [ ! -e "$KEYDIR" ]; then
echo "Folder not found: $KEYDIR, leaving"
If the `.asc` extension is ommited, keyringer will add it in the end of the
pathname.
+No spaces are allowed in the secret name.
+
Secret manipulation actions do not commit changes into the secret repository.
After any manipulation, the user has to manually commit the changes using the
git wrapper action.
again.
encrypt [*file*] <*secret*>
-: Encrypts content from standard input or *file* into *secret* pathname.
+: Encrypts content from standard input or *file* into *secret* pathname. No spaces
+ are supported in the *file* name.
encrypt-batch <*secret*>
: Encrypt content, batch mode.