Index: Makefile.in =================================================================== --- Makefile.in (revision 2123) +++ Makefile.in (revision 2125) @@ -75,6 +75,9 @@ CC=@CC@ # set the C compiler to gcc for most platforms. This is # set to pgcc for Mandrake 6.1 due to irritating colorgcc. +GZIP=gzip -c -9 +RM=rm -f + LIBS= COMMON_OBJ=aescmdline.o bin2hex.o $(ALGORITHM).o dstring.o @@ -90,13 +93,13 @@ CRYPTOFLAGS=-Wall -W -O2 -DSTRICT_ALIGN=0 -all: aescrypt aesget tobin +all: aescrypt aesget tobin aescrypt.1.gz aesget.1.gz distclean: clean rm -f Makefile config.cache config.h config.log config.status clean: - rm -f *.o *~ aescrypt aesget tobin + rm -f *.o *~ aescrypt aesget tobin *.1.gz dist: distclean ./makedist $(VERSION) @@ -105,6 +108,8 @@ install: @cp aescrypt @prefix@/bin @cp aesget @prefix@/bin + @cp aescrypt.1.gz @prefix@/man/man1 + @cp aesget.1.gz @prefix@/man/man1 installbc: @cp aescrypt /bru/aserv/exec @@ -114,9 +119,15 @@ aescrypt: $(CRYPT_OBJ) $(CC) $(CFLAGS) -o aescrypt $(CRYPT_OBJ) $(LIBS) +aescrypt.1.gz: aescrypt.1 + $(GZIP) aescrypt.1 > aescrypt.1.gz || $(RM) aescrypt.1.gz + aesget: $(DECRYPT_OBJ) $(CC) $(CFLAGS) -o aesget $(DECRYPT_OBJ) $(LIBS) +aesget.1.gz: aesget.1 + $(GZIP) aesget.1 > aesget.1.gz || $(RM) aesget.1.gz + tobin: bin2hex.o dstring.o tobin.c $(CC) $(CFLAGS) -o tobin bin2hex.o dstring.o tobin.c $(LIBS) Index: aescrypt.1 =================================================================== --- aescrypt.1 (revision 0) +++ aescrypt.1 (revision 2125) @@ -0,0 +1,131 @@ +.\" Copyright (c) 2008 Peter Pentchev +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd June 8, 2008 +.Dt AESCRYPT 1 +.Os +.Sh NAME +.Nm aescrypt +.Nd encrypt data using Rijndael, the Advanced Encryption Standard winner +.Sh SYNOPSIS +.Nm +.Fl k +.Ar keyfile +.Op Fl s Ar keysize +.Sh DESCRIPTION +The +.Nm +utility encrypts data using the Rijndael algorithm, the winner of +the Advanced Encryption Standard (AES) competition. +The encryption is done in Cipher Block Feedback (CFB-128) mode, with +the salt randomly generated from data read from the +.Pa /dev/urandom +device. +The plaintext data is read from standard input and the encrypted data +is written to standard output. +.Pp +The encryption key may be read from standard input or from a file, +depending on the argument passed to the +.Fl k +command-line option. +If +.Dq - +is used as a filename, the +.Nm +utility reads as many hexadecimal digits as needed from standard input +and then one additional byte to allow for a newline separating the key +from the actual data to be encrypted. +If the filename is not +.Dq - , +the +.Nm +utility opens the specified file and reads text lines from it until +a line starting with the characters +.Li kk= +is reached. +Those characters should be immediately followed by as many hexadecimal +digits as needed; the rest of the line, as well as the rest of the file, +is ignored. +.Pp +The encryption key may be 128, 192, or 256 bits long. +By default, the +.Nm +utility uses (and expects to read) a 128-bit key, unless a different size +is supplied by the +.Fl s Ar keysize +command-line option. +.Pp +The +.Nm +utility reads 16 bytes (128 bits) from the +.Pa /dev/urandom +device to initialize the salt for the CFB-128 encryption. +The salt is prepended to the encrypted data in the output. +.Sh EXAMPLES +Generate a random 128-bit value and store it into a keyfile suitable for the +.Nm +utility: +.Pp +.Dl perl -e 'open(F, \&"<", \&"/dev/random") or die(\&"$!\en"); read(F, $s, 32); print \&"kk=".unpack("H*", $s).\&"\en"' +.Pp +Encrypt the contents of the +.Pa /etc/hosts +file with the generated (128-bit by default) key: +.Pp +.Dl aescrypt -k key.txt < /etc/hosts > hosts.aes +.Pp +Encrypt a string with a 192-bit key supplied directly: +.Pp +.Dl (echo '012345678901234567890123456789012345678901234567'; echo 'This is a test.') | ./aescrypt -s 192 -k - > test.aes +.Sh SEE ALSO +.Xr aesget 1 +.Pp +The SourceForge project page: http://sourceforge.net/projects/aescrypt/ +.Sh HISTORY +The +.Nm +utility was written by +.An Eric Lee Green , +and was modified to use Rijndael rather than Twofish by +.An Randy Kaelber . +It uses the freely available Rijndael implementation by +.An Antoon Bosselaers +and +.An Vincent Rijmen . +This manual page was written by +.An Peter Pentchev +in 2008. +.Sh AUTHORS +The +.Nm +utility - +.An -nosplit +.An Eric Lee Green +.Aq eric@badtux.org , +.An Randy Kaelber +.Aq randyk@sourceforge.net . +.Pp +The manual page - +.An Peter Pentchev +.Aq roam@ringlet.net . Index: aesget.1 =================================================================== --- aesget.1 (revision 0) +++ aesget.1 (revision 2125) @@ -0,0 +1,120 @@ +.\" Copyright (c) 2008 Peter Pentchev +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.Dd June 8, 2008 +.Dt AESGET 1 +.Os +.Sh NAME +.Nm aesget +.Nd decrypt data using Rijndael, the Advanced Encryption Standard winner +.Sh SYNOPSIS +.Nm +.Fl k +.Ar keyfile +.Op Fl s Ar keysize +.Sh DESCRIPTION +The +.Nm +utility decrypts data using the Rijndael algorithm, the winner of +the Advanced Encryption Standard (AES) competition. +The decryption is done in Cipher Block Feedback (CFB-128) mode, with +the salt read from the first 128 bits (16 bytes) of the encrypted data +as generated by the +.Xr aescrypt 1 +utility. +The encrypted data (including the salt) is read from standard input and +the decrypted plaintext is written to standard output. +.Pp +The decryption key may be read from standard input or from a file, +depending on the argument passed to the +.Fl k +command-line option. +If +.Dq - +is used as a filename, the +.Nm +utility reads as many hexadecimal digits as needed from standard input +and then one additional byte to allow for a newline separating the key +from the actual data to be decrypted. +If the filename is not +.Dq - , +the +.Nm +utility opens the specified file and reads text lines from it until +a line starting with the characters +.Li kk= +is reached. +Those characters should be immediately followed by as many hexadecimal +digits as needed; the rest of the line, as well as the rest of the file, +is ignored. +.Pp +The decryption key may be 128, 192, or 256 bits long. +By default, the +.Nm +utility uses (and expects to read) a 128-bit key, unless a different size +is supplied by the +.Fl s Ar keysize +command-line option. +.Pp +.Sh EXAMPLES +Decrypt the contents of the +.Pa /etc/hosts +file with a key (128-bit by default) read from a file: +.Pp +.Dl aesget -k key.txt < hosts.aes > hosts.txt +.Pp +Decrypt a file with a 192-bit key supplied directly: +.Pp +.Dl (echo '012345678901234567890123456789012345678901234567'; cat test.aes) | ./aesget -s 192 -k - +.Sh SEE ALSO +.Xr aescrypt 1 +.Pp +The SourceForge project page: http://sourceforge.net/projects/aescrypt/ +.Sh HISTORY +The +.Nm +utility was written by +.An Eric Lee Green , +and was modified to use Rijndael rather than Twofish by +.An Randy Kaelber . +It uses the freely available Rijndael implementation by +.An Antoon Bosselaers +and +.An Vincent Rijmen . +This manual page was written by +.An Peter Pentchev +in 2008. +.Sh AUTHORS +The +.Nm +utility - +.An -nosplit +.An Eric Lee Green +.Aq eric@badtux.org , +.An Randy Kaelber +.Aq randyk@sourceforge.net . +.Pp +The manual page - +.An Peter Pentchev +.Aq roam@ringlet.net .