#!/bin/sh
/usr/sbin/sgl_check_expiry_date
out=$?
if [ $out -ne 0 ];
then
	exit $out
fi
tempfile=`mktemp --tmpdir=/tmp`
printf "%s" $2 | ecryptfs-unwrap-passphrase /var/www/keys/$1

if [ $? -eq 0 ] ;
then
	printf "%s" $2 | ecryptfs-unwrap-passphrase /var/www/keys/$1 | tail -n 1 > $tempfile
	cat $tempfile
	rm $tempfile
	exit 0
else
	exit 1
fi

