# HG changeset patch # User Guido Berhoerster # Date 1391036413 -3600 # Node ID f0ceb0ad20e7fd27845833cd16aba23ce74d34e4 # Parent 73af139d1a94b197a6a24bd2bb7f6eeadc268bd5 Add manpage diff -r 73af139d1a94 -r f0ceb0ad20e7 Makefile --- a/Makefile Tue Jan 28 19:23:16 2014 +0100 +++ b/Makefile Thu Jan 30 00:00:13 2014 +0100 @@ -41,15 +41,36 @@ PAX := pax GZIP := gzip SED := sed +XSLTPROC := xsltproc +DOCBOOK5_MANPAGES_STYLESHEET = http://docbook.sourceforge.net/release/xsl-ns/current/manpages/docbook.xsl + +define generate-manpage-rule = +%.$(1): %.$(1).xml + $$(XSLTPROC) \ + --xinclude \ + --stringparam package $$(PACKAGE) \ + --stringparam version $$(VERSION)\ + docbook-update-source-data.xsl $$< | \ + $$(XSLTPROC) \ + --xinclude \ + $$(DOCBOOK5_MANPAGES_FLAGS) \ + --output $$@ \ + $$(DOCBOOK5_MANPAGES_STYLESHEET) \ + - +endef DESTDIR ?= prefix ?= /usr/local bindir ?= $(prefix)/bin datadir ?= $(prefix)/share +mandir ?= $(datadir)/man HAVE_ERR_H ?= 1 OBJS = sencrypt.o +MANPAGES = $(PACKAGE).1 $(DECRYPT_ALIAS).1 +DOCBOOK5_MANPAGES_FLAGS = --stringparam man.authors.section.enabled 0 \ + --stringparam man.copyright.section.enabled 0 ifeq ($(HAVE_ERR_H),0) OBJS += err.o @@ -59,7 +80,7 @@ .PHONY: all clean clobber dist install -all: $(PACKAGE) +all: $(PACKAGE) $(MANPAGES) $(PACKAGE): XCPPFLAGS := -DOPENSSL_LOAD_CONF ifeq ($(HAVE_ERR_H),1) @@ -71,6 +92,8 @@ $(PACKAGE): $(OBJS) $(LINK.o) $^ $(LDLIBS) -o $@ +$(foreach section,1 2 3 4 5 6 7 8 9,$(eval $(call generate-manpage-rule,$(section)))) + %.o: %.c $(MAKEDEPEND.c) $< | $(SED) -f deps.sed >$*.d $(COMPILE.c) -o $@ $< @@ -78,9 +101,13 @@ install: $(INSTALL.exec) $(PACKAGE) "$(DESTDIR)$(bindir)/$(PACKAGE)" ln -f $(PACKAGE) "$(DESTDIR)$(bindir)/$(DECRYPT_ALIAS)" + for manpage in $(MANPAGES); do \ + $(INSTALL.data) $${manpage} \ + "$(DESTDIR)$(mandir)/man$${manpage##*.}/$${manpage##*/}"; \ + done clean: - rm -f $(PACKAGE) $(OBJS) + rm -f $(PACKAGE) $(OBJS) $(MANPAGES) clobber: clean rm -f $(patsubst %.o,%.d,$(OBJS)) diff -r 73af139d1a94 -r f0ceb0ad20e7 README --- a/README Tue Jan 28 19:23:16 2014 +0100 +++ b/README Thu Jan 30 00:00:13 2014 +0100 @@ -16,9 +16,9 @@ ------------------ sencrypt requires a POSIX:2004 compatible operating system, and needs GNU make, -GNU or BSD install, and the OpenSSL library to be installed. It has been tested -on Linux distributions, FreeBSD, Solaris and Illumos-derived distributions, -UnixWare, and OpenServer. +GNU or BSD install, the xsltproc tool from libxml2 and the OpenSSL library to +be installed. It has been tested on Linux distributions, FreeBSD, Solaris and +Illumos-derived distributions, UnixWare, and OpenServer. License ------- diff -r 73af139d1a94 -r f0ceb0ad20e7 docbook-update-source-data.xsl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docbook-update-source-data.xsl Thu Jan 30 00:00:13 2014 +0100 @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + diff -r 73af139d1a94 -r f0ceb0ad20e7 sencrypt.1.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sencrypt.1.xml Thu Jan 30 00:00:13 2014 +0100 @@ -0,0 +1,244 @@ + + + + + + + Guido + Berhoerster + + guido+sencrypt@berhoerster.name + + + 21 January, 2014 + + + sencrypt + 1 + + + User Commands + + + sencrypt + sdecrypt + encrypt and decrypt data + + + + sencrypt + + + + + + sencrypt + + + + + + algorithm + + + + key_file + + + + input_file + + + + output_file + + + + sdecrypt + + + + + + sdecrypt + + + + + + algorithm + + + + key_file + + + + input_file + + + + output_file + + + + + Description + The sencrypt utility encrypts data and the + sdecrypt utility decrypts data using the specified + algorithm. A key file must be a regular file and have the exact size of the + desired key length, its content will be used verbatim as the key. If no key + file is specified sencrypt or + sdecrypt will ask for a passphrase and use that together + with a salt to derive a key using the PBKDF2 key derivation function. If no + input file is specfified, the input will be read from stdin. If no output + file is specfied, the output will be written to stdout. The input and + output file may be identical, in which case the content of the input file + is replaced with the output after successful encryption or decryption. The + algorithm used for encrypting data is not saved and needs to be explicitly + specified when decrypting data. + sencrypt and sdecrypt are + portable and compatible reimplementations of the encrypt + and decrypt utilities in Solaris/Illumos-based operating + systems. + + + Options + The following options are supported: + + + + + + + List the available algorithms and supported key lengths and + exit. + + + + + + algorithm + + + Use the specified algorithm. + + + + + + key_file + + + Read key data from specified key file. Key size requirements + depend on the selected algorithm. + + + + + + input_file + + + Read the input from the specified file. + + + + + + output_file + + + Write the output to the specified file. + + + + + + + + Ignored for compatibility with encrypt and + decrypt. + + + + + + Examples + + Encrypt a file with the AES algorithm + The following example encrypts a file with the AES algorithm: + +$ sencrypt -a aes -i secret.txt -o secret.aes + + + + Decrypt a file in-place + The following example decrypts a file in-place: + +$ sdecrypt -a 3des -i data.bin -o data.bin + + + + Encrypt a file using a key file + The following example generates a key file with 512 bits of random + data and uses it to encrypt a file: + +$ dd if=/dev/urandom of=key.bin bs=64 count=1 +$ sencrypt -a arcfour -k key.bin -i secret.txt -o secret.rc4 + + + + Pipe data trough encrypt in order to make a remote encrypted + backup + The following example creates an archive in the tar format, + encrypts it and sends it to a remote location via + SSH: + +$ pax -w -x ustar /home | sencrypt -a aes -k backup-key.bin |\ + ssh backuphost 'cat > home.tar' + + + + + Exit Status + The following exit values are returned: + + + 0 + + Command successfully executed. + + + + > 0 + + An error has occured. + + + + +