#! /bin/bash
cyflexlogevent -t generic -m 1 -m "script" -m "$0" 

#
# Script name: generate_password_file
#
# Purpose: Generate a file containing a password on an encrypted,
# binary format.  Programs may then use this file to check user
# entered passwords.
#
# Invoking argument:
#   1 - Password to be encrypted and stored in the file.
#
# Output: 
#    A file, password.bin, containing the encrypted, binary password.
#
# History:
#    01/10/11 - Rob Janes - Initial release
#

# Validate that there's a comment line argument.
if (( $# != 1)) ; then
   echo Usage: generate_password_file  PASSWORD
   exit 1
fi

. find_protobuf.sh

export CLASSPATH=/cyflex/specfilegui/specfilegui.jar:$PROTO

PROPS=-DPropertiesFile=/cell/cui_properties.txt
export JAVA_HOME=/cyflex/java_jdk
PATH=$JAVA_HOME/bin:$PATH
java $PROPS com.cybermetrix.cyflex.utilities.PasswordFileCheck $1
