#!/usr/local/bin/perl
$h1="+++++++++++++++++++++++BEGIN L3 ENCRYPTED MESSAGE+++++++++++++++++++++++";
$h2="++++++++++++++++++++++++END L3 ENCRYPTED MESSAGE++++++++++++++++++++++++";
print STDERR "$ARGV[0]", "\n";
$state = 0;
$bindir="/usr/local/bin/";
die "usage: tencrypt pubfile\n" if (!$ARGV[0]);
open(SPIPE, "| ".$bindir."encrypt $ARGV[0] | ${bindir}prencode -e >/tmp/.$$.enc") || die "cannot open pipe\n";
while(<STDIN>) {
	print SPIPE $_;
}
close(SPIPE);
open(ENCF,"/tmp/.$$.enc") || die "cannot open /tmp/.$$.enc";
print $h1, "\n";
print $ARGV[0], "\n";
while(<ENCF>) {
	print " ", $_;
}
print $h2, "\n";
close ENCF;
unlink("/tmp/.$$.enc");
