Stripped unused netpgp files

master
Edouard Tisserant 7 years ago
parent a2d65b0deb
commit d8e88d6432

@ -3,18 +3,8 @@ syntax: glob
dist/Makefile
dist/Makefile.in
dist/aclocal.m4
dist/autom4te.cache/output.0
dist/autom4te.cache/output.1
dist/autom4te.cache/requests
dist/autom4te.cache/traces.0
dist/autom4te.cache/traces.1
dist/buildaux/compile
dist/buildaux/config.guess
dist/buildaux/config.sub
dist/buildaux/depcomp
dist/buildaux/install-sh
dist/buildaux/ltmain.sh
dist/buildaux/missing
dist/autom4te.cache
dist/buildaux
dist/config.log
dist/config.status
dist/configure
@ -23,120 +13,13 @@ dist/include/Makefile.in
dist/libtool
dist/src/Makefile
dist/src/Makefile.in
dist/src/hkpclient/.deps/hkpc-hkpc.Po
dist/src/hkpclient/.deps/hkpc-main.Po
dist/src/hkpclient/.libs/hkpc
dist/src/hkpclient/Makefile
dist/src/hkpclient/Makefile.in
dist/src/hkpclient/hkpc
dist/src/hkpclient/hkpc-hkpc.o
dist/src/hkpclient/hkpc-main.o
dist/src/lib/.deps/libnetpgp_la-bufgap.Plo
dist/src/lib/.deps/libnetpgp_la-compress.Plo
dist/src/lib/.deps/libnetpgp_la-create.Plo
dist/src/lib/.deps/libnetpgp_la-crypto.Plo
dist/src/lib/.deps/libnetpgp_la-keyring.Plo
dist/src/lib/.deps/libnetpgp_la-misc.Plo
dist/src/lib/.deps/libnetpgp_la-netpgp.Plo
dist/src/lib/.deps/libnetpgp_la-openssl_crypto.Plo
dist/src/lib/.deps/libnetpgp_la-packet-parse.Plo
dist/src/lib/.deps/libnetpgp_la-packet-print.Plo
dist/src/lib/.deps/libnetpgp_la-packet-show.Plo
dist/src/lib/.deps/libnetpgp_la-reader.Plo
dist/src/lib/.deps/libnetpgp_la-signature.Plo
dist/src/lib/.deps/libnetpgp_la-ssh2pgp.Plo
dist/src/lib/.deps/libnetpgp_la-symmetric.Plo
dist/src/lib/.deps/libnetpgp_la-validate.Plo
dist/src/lib/.deps/libnetpgp_la-writer.Plo
dist/src/lib/.libs/libnetpgp.a
dist/src/lib/.libs/libnetpgp.la
dist/src/lib/.libs/libnetpgp.lai
dist/src/lib/.libs/libnetpgp.so
dist/src/lib/.libs/libnetpgp.so.0
dist/src/lib/.libs/libnetpgp.so.0.0.0
dist/src/lib/.libs/libnetpgp_la-bufgap.o
dist/src/lib/.libs/libnetpgp_la-compress.o
dist/src/lib/.libs/libnetpgp_la-create.o
dist/src/lib/.libs/libnetpgp_la-crypto.o
dist/src/lib/.libs/libnetpgp_la-keyring.o
dist/src/lib/.libs/libnetpgp_la-misc.o
dist/src/lib/.libs/libnetpgp_la-netpgp.o
dist/src/lib/.libs/libnetpgp_la-openssl_crypto.o
dist/src/lib/.libs/libnetpgp_la-packet-parse.o
dist/src/lib/.libs/libnetpgp_la-packet-print.o
dist/src/lib/.libs/libnetpgp_la-packet-show.o
dist/src/lib/.libs/libnetpgp_la-reader.o
dist/src/lib/.libs/libnetpgp_la-signature.o
dist/src/lib/.libs/libnetpgp_la-ssh2pgp.o
dist/src/lib/.libs/libnetpgp_la-symmetric.o
dist/src/lib/.libs/libnetpgp_la-validate.o
dist/src/lib/.libs/libnetpgp_la-writer.o
dist/src/lib/.deps
dist/src/lib/.libs
dist/src/lib/Makefile
dist/src/lib/Makefile.in
dist/src/lib/config.h
dist/src/lib/config.h.in
dist/src/lib/libnetpgp.la
dist/src/lib/libnetpgp_la-bufgap.lo
dist/src/lib/libnetpgp_la-bufgap.o
dist/src/lib/libnetpgp_la-compress.lo
dist/src/lib/libnetpgp_la-compress.o
dist/src/lib/libnetpgp_la-create.lo
dist/src/lib/libnetpgp_la-create.o
dist/src/lib/libnetpgp_la-crypto.lo
dist/src/lib/libnetpgp_la-crypto.o
dist/src/lib/libnetpgp_la-keyring.lo
dist/src/lib/libnetpgp_la-keyring.o
dist/src/lib/libnetpgp_la-misc.lo
dist/src/lib/libnetpgp_la-misc.o
dist/src/lib/libnetpgp_la-netpgp.lo
dist/src/lib/libnetpgp_la-netpgp.o
dist/src/lib/libnetpgp_la-openssl_crypto.lo
dist/src/lib/libnetpgp_la-openssl_crypto.o
dist/src/lib/libnetpgp_la-packet-parse.lo
dist/src/lib/libnetpgp_la-packet-parse.o
dist/src/lib/libnetpgp_la-packet-print.lo
dist/src/lib/libnetpgp_la-packet-print.o
dist/src/lib/libnetpgp_la-packet-show.lo
dist/src/lib/libnetpgp_la-packet-show.o
dist/src/lib/libnetpgp_la-reader.lo
dist/src/lib/libnetpgp_la-reader.o
dist/src/lib/libnetpgp_la-signature.lo
dist/src/lib/libnetpgp_la-signature.o
dist/src/lib/libnetpgp_la-ssh2pgp.lo
dist/src/lib/libnetpgp_la-ssh2pgp.o
dist/src/lib/libnetpgp_la-symmetric.lo
dist/src/lib/libnetpgp_la-symmetric.o
dist/src/lib/libnetpgp_la-validate.lo
dist/src/lib/libnetpgp_la-validate.o
dist/src/lib/libnetpgp_la-writer.lo
dist/src/lib/libnetpgp_la-writer.o
dist/src/lib/libnetpgp*
dist/src/lib/stamp-h1
dist/src/libmj/.deps/libmj_la-mj.Plo
dist/src/libmj/.libs/libmj.a
dist/src/libmj/.libs/libmj.la
dist/src/libmj/.libs/libmj.lai
dist/src/libmj/.libs/libmj.so
dist/src/libmj/.libs/libmj.so.0
dist/src/libmj/.libs/libmj.so.0.0.0
dist/src/libmj/.libs/libmj_la-mj.o
dist/src/libmj/Makefile
dist/src/libmj/Makefile.in
dist/src/libmj/libmj.la
dist/src/libmj/libmj_la-mj.lo
dist/src/libmj/libmj_la-mj.o
dist/src/netpgp/.deps/netpgp-netpgp.Po
dist/src/netpgp/.libs/netpgp
dist/src/netpgp/Makefile
dist/src/netpgp/Makefile.in
dist/src/netpgp/netpgp
dist/src/netpgp/netpgp-netpgp.o
dist/src/netpgpkeys/.deps/netpgpkeys-netpgpkeys.Po
dist/src/netpgpkeys/.libs/netpgpkeys
dist/src/netpgpkeys/Makefile
dist/src/netpgpkeys/Makefile.in
dist/src/netpgpkeys/netpgpkeys
dist/src/netpgpkeys/netpgpkeys-netpgpkeys.o
dist/tests/Makefile
dist/tests/Makefile.in
dist/tests/atconfig
dist/tests/atlocal
dist/netpgp-xcode/netpgp.xcodeproj/xcuserdata
*.DS_Store

@ -1,7 +0,0 @@
# $NetBSD$
SUBDIR+= libmj .WAIT
SUBDIR+= lib .WAIT
SUBDIR+= bin
.include <bsd.subdir.mk>

@ -1,3 +0,0 @@
# $NetBSD$
WARNS?=4

@ -1,9 +0,0 @@
# $NetBSD$
SUBDIR+= netpgp
SUBDIR+= netpgpkeys
SUBDIR+= netpgpverify
#SUBDIR+= hkpc
#SUBDIR+= hkpd
.include <bsd.subdir.mk>

@ -1,25 +0,0 @@
# $NetBSD$
.include <bsd.own.mk>
PROG=hkpc
BINDIR=/usr/bin
SRCS=hkpc.c main.c
LIBNETPGPDIR!= cd ${.CURDIR}/../../lib/netpgp && ${PRINTOBJDIR}
LDADD+= -L${LIBNETPGPDIR} -lnetpgp
DPADD+= ${LIBNETPGPDIR}/libnetpgp.a
LIBMJDIR!= cd ${.CURDIR}/../../libmj && ${PRINTOBJDIR}
LDADD+= -L${LIBMJDIR} -lmj
DPADD+= ${LIBMJDIR}/libmj.a
LDADD+= -lcrypto -lz -lbz2
DPADD+= ${LIBCRYPTO} ${LIBZ} ${LIBBZ2}
WARNS=0
MAN=hkpc.1
.PATH: ${.CURDIR}/../../dist/src/hkpclient
.include <bsd.prog.mk>

@ -1,32 +0,0 @@
# $NetBSD$
.include <bsd.own.mk>
PROG=hkpd
BINDIR=/usr/sbin
SRCS=hkpd.c main.c
LIBNETPGPDIR!= cd ${.CURDIR}/../../lib/netpgp && ${PRINTOBJDIR}
LDADD+= -L${LIBNETPGPDIR} -lnetpgp
DPADD+= ${LIBNETPGPDIR}/libnetpgp.a
LIBMJDIR!= cd ${.CURDIR}/../../libmj && ${PRINTOBJDIR}
LDADD+= -L${LIBMJDIR} -lmj
DPADD+= ${LIBMJDIR}/libmj.a
LDADD+= -lcrypto -lz -lbz2
DPADD+= ${LIBCRYPTO} ${LIBZ} ${LIBBZ2}
MAN=hkpd.1
.PATH: ${.CURDIR}/../../dist/src/hkpd
.include <bsd.prog.mk>
t: ${PROG}
./${PROG} -D &
sleep 1
ftp -o- 'http://localhost:11371/pks/lookup?op=index&search=agc&options=json'
ftp -o- 'http://localhost:11371/pks/lookup?op=get&search=agc&options=json'
ftp -o- 'http://localhost:11371/pks/lookup?op=get&search=agc&options=mr'
pkill hkpd

@ -1,26 +0,0 @@
# $NetBSD$
.include <bsd.own.mk>
PROG= netpgp
BINDIR= /usr/bin
CPPFLAGS+= -I${EXTDIST}/include
LIBNETPGPDIR!= cd ${.CURDIR}/../../lib/netpgp && ${PRINTOBJDIR}
LDADD+= -L${LIBNETPGPDIR} -lnetpgp
DPADD+= ${LIBNETPGPDIR}/libnetpgp.a
LIBMJDIR!= cd ${.CURDIR}/../../libmj && ${PRINTOBJDIR}
LDADD+= -L${LIBMJDIR} -lmj
DPADD+= ${LIBMJDIR}/libmj.a
LDADD+= -lcrypto -lz -lbz2
DPADD+= ${LIBCRYPTO} ${LIBZ} ${LIBBZ2}
MAN= netpgp.1
EXTDIST= ${.CURDIR}/../../dist
.PATH: ${EXTDIST}/src/netpgp
.include <bsd.prog.mk>

@ -1,24 +0,0 @@
# $NetBSD$
.include <bsd.own.mk>
PROG= netpgpkeys
SRCS= netpgpkeys.c
BINDIR= /usr/bin
LIBNETPGPDIR!= cd ${.CURDIR}/../../lib/netpgp && ${PRINTOBJDIR}
LDADD+= -L${LIBNETPGPDIR} -lnetpgp
DPADD+= ${LIBNETPGPDIR}/libnetpgp.a
LIBMJDIR!= cd ${.CURDIR}/../../libmj && ${PRINTOBJDIR}
LDADD+= -L${LIBMJDIR} -lmj
DPADD+= ${LIBMJDIR}/libmj.a
LDADD+= -lcrypto -lz -lbz2
DPADD+= ${LIBCRYPTO} ${LIBZ} ${LIBBZ2}
MAN= netpgpkeys.1
.PATH: ${.CURDIR}/../../dist/src/netpgpkeys
.include <bsd.prog.mk>

@ -1,38 +0,0 @@
# $NetBSD$
PROG=netpgpverify
BINDIR= /usr/bin
SRCS= b64.c bignum.c bufgap.c digest.c
SRCS+= libverify.c main.c misc.c
SRCS+= pgpsum.c rsa.c
SRCS+= bzlib.c zlib.c
SRCS+= md5c.c rmd160.c sha1.c sha2.c tiger.c
CPPFLAGS+=-I${.CURDIR} -I${EXTDIST}/src/netpgpverify
COPTS.libverify.c+= -Wno-format-nonliteral
.ifndef PRODUCTION
CPPFLAGS+=-g -O0
LDFLAGS+=-g -O0
.endif
MAN= netpgpverify.1
WARNS= 5
EXTDIST=${.CURDIR}/../../dist
.PATH: ${EXTDIST}/src/netpgpverify
.include <bsd.prog.mk>
t tst: ${PROG}
./${PROG} -k ${EXTDIST}/src/netpgpverify/pubring.gpg ${EXTDIST}/src/netpgpverify/NetBSD-6.0_RC1_hashes.asc
./${PROG} -k ${EXTDIST}/src/netpgpverify/pubring.gpg ${EXTDIST}/src/netpgpverify/NetBSD-6.0_RC1_hashes.gpg
./${PROG} -v
./${PROG} -S ${EXTDIST}/src/netpgpverify/sshtest-20140202.pub ${EXTDIST}/src/netpgpverify/data.gpg
./${PROG} -S ${EXTDIST}/src/netpgpverify/sshtest-20140202.pub ${EXTDIST}/src/netpgpverify/data.sig
@echo "expected failure, to check bad signatures fail to verify"
-sed -e 's|A|B|' ${EXTDIST}/src/netpgpverify/data.gpg | ./${PROG} -S ${EXTDIST}/src/netpgpverify/sshtest-20140202.pub

@ -1,12 +0,0 @@
#ifndef CONFIG_H_
#define CONFIG_H_ 20140308
#ifndef __UNCONST
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
#endif /* __UNCONST */
#ifndef USE_ARG
#define USE_ARG(x) /*LINTED*/(void)&(x)
#endif /* USE_ARG */
#endif /* CONFIG_H_ */

109
dist/TODO vendored

@ -1,109 +0,0 @@
To Do
=====
check pkt size during read
list sigs on a per-user basis
2^n sized packets - regions?
json for verification in netpgp
show attributes on key listings
agent
agentctl
convert to and from ascii armored sigs
gpgme compat lib
get rid of public key free as part of seckey
is get_passphrase_cb needed?
error logging
separate from libcrypto?
default compression when signing?
Done
====
autoconf
libtool
name change
content_ naming scheme
Brief test script
get rid of C global
put all readers and writers together in one file
Add mmapped method
merge mmap'ed and fd reads - if mmap fails, fall back to read
Make sure all openpgpsdk changes are brought forward
look at header file fun
new version number in autoconf
Make decrypt work with files > 8192 bytes
dynamically size literal_data_body before decompressing?
restore ops_export_key functionality
match keyids using case insensitive matching - (c0596823 == C0596823)
use PRIsize appropriately
make a high-level interface
get rid of multiple local headers
get rid of long identifier names - all done internally now
Finish name change for everything
work out what's exported and what's not
finish off main header file
init(&netpgp, userid, pubring, secring)
__ops
real naming scheme
get rid of malloc() instances -> calloc()
change include directory
Install man pages
WARNS=4 (again)
detached sig
get rid of assert()s
disable core dumps
add a --help option
sha256 digests
print out size of key in --list-keys
decryption - print encrypted key info
get rid of local files
hash algorithm selection
detached verification
RCS Ids
Look at inefficiencies - read() etc
cat command to display a verified file without signature
get rid of ops_memory after used literal_data_body
new package for 1.99.4
separate verify program
Add --passwd-fd n argument
bring forward netpgpverify mods to netpgp
move directory locations in package and cvs repo
fix up tests for new directory locations
separate key management program
C++ guards in header file
modify sets lists for netpgpverify
don't require passphrase for keys without one
failure to run if no userid in gpg.conf (even if --userid specified)
don't complain if no .gnupg dir (even when using --homedir)
make it work with ssh host keys
regex matching for names and signatures
in memory encryption and decryption
ssss
make netpgp work from stdin/to stdout
signature duration and expiry
multisign
settable from time
unarmoured static in packet-print.c and skipping in crypto.c
display expiry properly
unarmoured static in packet-print.c and skipping in crypto.c
duration -> expiry
print signing key info properly when prompting for passphrase
print decryption key info properly when prompting for passphrase
hkpd
hkpclient
netbsd/pkgsrc pr 42922
add expiry information to public key display
trust subpackets
add revocation information to public key display
--list-sigs - these come out in __ops_check_subkey_sig()
hkp to include sigs too
make netpgpkeys work - add, import, commit, update, sign, passphrase
fix ssh fingerprints not matching netpgp
json/yaml output
return userids from successful verify, and then print id out if required
convert between pgp and ssh key formats
PEM ssh keys and passphrases
camellia addition
fix calloc return values in symmetric.c/ops_crypt_t
prog to convert from pgp sec to ssh sec
add user-specifiable ciphers for encryption
elgamal enc/decryption?
thresholds - see sharedkey, ssss, threshold etc

@ -1,39 +0,0 @@
#PREFIX=/Users/agcrooks
PREFIX=/usr
#LIBDIR=/usr/lib
LIB=luanetpgp
SRCS=glue.c
MKMAN=no
CPPFLAGS+=-g -I${PREFIX}/pkg/include
LDADD+= -lnetpgp
WARNS=4
CLEANFILES+= a a.sig
.include <bsd.lib.mk>
.include <bsd.own.mk>
LUANETPGPOBJDIR != cd ${.CURDIR} && ${PRINTOBJDIR}
OPSYS!= uname -s
.if ${OPSYS} == "Darwin"
.sinclude <bsd.warns.mk>
lib${LIB}.dylib:
libtool -dynamic -o ${.TARGET} ${OBJS} ${PREFIX}/pkg/lib/liblua.dylib /usr/lib/libc.dylib ${PREFIX}/pkg/lib/libnetpgp.dylib
t: lib${LIB}.dylib
cp Makefile a
./netpgp.lua --sign --detached a
./netpgp.lua --verify a.sig
.else
t:
cp Makefile a
env LD_LIBRARY_PATH=${LUANETPGPOBJDIR}:/lib:/usr/lib:${PREFIX}/lib \
./netpgp.lua --sign --detached a
env LD_LIBRARY_PATH=${LUANETPGPOBJDIR}:/lib:/usr/lib:${PREFIX}/lib \
./netpgp.lua --verify a.sig
.endif

@ -1,362 +0,0 @@
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Alistair Crooks (agc@netbsd.org)
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
#include <sys/types.h>
#include <sys/param.h>
#include <sys/stat.h>
#include <inttypes.h>
#include <netpgp.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define LUA_LIB
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
#ifndef __UNCONST
#define __UNCONST(a) ((void *)(unsigned long)(const void *)(a))
#endif /* !__UNCONST */
#define DEFAULT_HASH_ALG "SHA256"
int luaopen_netpgp(lua_State *);
typedef struct strarg_t {
const char *s; /* string */
const int n; /* corresponding int value */
} strarg_t;
/* map a string onto an int */
static int
findtype(strarg_t *strs, const char *s)
{
strarg_t *sp;
for (sp = strs ; sp->s && strcasecmp(sp->s, s) != 0 ; sp++) {
}
return sp->n;
}
/* set the home directory value to "home/subdir" */
static int
set_homedir(netpgp_t *netpgp, char *home, const char *subdir, const int quiet)
{
struct stat st;
char d[MAXPATHLEN];
if (home == NULL) {
if (!quiet) {
(void) fprintf(stderr, "NULL HOME directory\n");
}
return 0;
}
(void) snprintf(d, sizeof(d), "%s%s", home, (subdir) ? subdir : "");
if (stat(d, &st) == 0) {
if ((st.st_mode & S_IFMT) == S_IFDIR) {
netpgp_setvar(netpgp, "homedir", d);
return 1;
}
(void) fprintf(stderr, "netpgp: homedir \"%s\" is not a dir\n",
d);
return 0;
}
if (!quiet) {
(void) fprintf(stderr,
"netpgp: warning homedir \"%s\" not found\n", d);
}
return 1;
}
/* init() */
static int
l_new(lua_State *L)
{
netpgp_t *netpgp;
netpgp = lua_newuserdata(L, sizeof(*netpgp));
(void) memset(netpgp, 0x0, sizeof(*netpgp));
set_homedir(netpgp, getenv("HOME"), "/.gnupg", 1);
netpgp_setvar(netpgp, "hash", DEFAULT_HASH_ALG);
return 1;
}
/* initialise(netpgp) */
static int
l_init(lua_State *L)
{
netpgp_t *netpgp;
netpgp = lua_touserdata(L, 1);
lua_pushnumber(L, netpgp_init(netpgp));
return 1;
}
/* homedir(netpgp, homedir) */
static int
l_homedir(lua_State *L)
{
const char *home;
netpgp_t *netpgp;
netpgp = lua_touserdata(L, 1);
home = luaL_checkstring(L, 2);
lua_pushnumber(L, set_homedir(netpgp, __UNCONST(home), NULL, 0));
return 1;
}
static strarg_t armourtypes[] = {
{ "armoured", 1 },
{ "armored", 1 },
{ "armour", 1 },
{ "armor", 1 },
{ NULL, 0 }
};
/* encrypt_file(netpgp, f, output, armour) */
static int
l_encrypt_file(lua_State *L)
{
const char *output;
const char *f;
netpgp_t *netpgp;
int armour;
int ret;
netpgp = lua_touserdata(L, 1);
netpgp_setvar(netpgp, "need userid", "1");
f = luaL_checkstring(L, 2);
output = luaL_checkstring(L, 3);
if (*output == 0x0) {
output = NULL;
}
armour = findtype(armourtypes, luaL_checkstring(L, 4));
ret = netpgp_encrypt_file(netpgp, netpgp_getvar(netpgp, "userid"),
f, __UNCONST("a.gpg"), armour);
lua_pushnumber(L, ret);
return 1;
}
/* decrypt_file(netpgp, f, output, armour) */
static int
l_decrypt_file(lua_State *L)
{
const char *output;
const char *f;
netpgp_t *netpgp;
int armour;
int ret;
netpgp = lua_touserdata(L, 1);
f = luaL_checkstring(L, 2);
output = luaL_checkstring(L, 3);
if (*output == 0x0) {
output = NULL;
}
armour = findtype(armourtypes, luaL_checkstring(L, 4));
ret = netpgp_decrypt_file(netpgp, f, __UNCONST(output), armour);
lua_pushnumber(L, ret);
return 1;
}
static strarg_t detachtypes[] = {
{ "detached", 1 },
{ "separate", 1 },
{ "detach", 1 },
{ NULL, 0 }
};
/* sign_file(netpgp, f, output, armour, detached) */
static int
l_sign_file(lua_State *L)
{
const char *output;
const char *f;
const int binary = 0;
netpgp_t *netpgp;
int detached;
int armour;
int ret;
netpgp = lua_touserdata(L, 1);
netpgp_setvar(netpgp, "need userid", "1");
f = luaL_checkstring(L, 2);
output = luaL_checkstring(L, 3);
if (*output == 0x0) {
output = NULL;
}
armour = findtype(armourtypes, luaL_checkstring(L, 4));
detached = findtype(detachtypes, luaL_checkstring(L, 5));
ret = netpgp_sign_file(netpgp, netpgp_getvar(netpgp, "userid"),
f, __UNCONST(output), armour, binary,
detached);
lua_pushnumber(L, ret);
return 1;
}
/* clearsign_file(netpgp, f, output, armour, detached) */
static int
l_clearsign_file(lua_State *L)
{
const char *output;
const char *f;
const int cleartext = 1;
netpgp_t *netpgp;
int detached;
int armour;
int ret;
netpgp = lua_touserdata(L, 1);
netpgp_setvar(netpgp, "need userid", "1");
f = luaL_checkstring(L, 2);
output = luaL_checkstring(L, 3);
armour = findtype(armourtypes, luaL_checkstring(L, 4));
detached = findtype(detachtypes, luaL_checkstring(L, 5));
ret = netpgp_sign_file(netpgp, netpgp_getvar(netpgp, "userid"),
f, __UNCONST(output), armour, cleartext,
detached);
lua_pushnumber(L, ret);
return 1;
}
/* verify_file(netpgp, f, armour) */
static int
l_verify_file(lua_State *L)
{
const char *f;
netpgp_t *netpgp;
int armour;
int ret;
netpgp = lua_touserdata(L, 1);
f = luaL_checkstring(L, 2);
armour = findtype(armourtypes, luaL_checkstring(L, 3));
ret = netpgp_verify_file(netpgp, f, NULL, armour);
lua_pushnumber(L, ret);
return 1;
}
/* verify_cat_file(netpgp, f, output, armour) */
static int
l_verify_cat_file(lua_State *L)
{
const char *output;
const char *f;
netpgp_t *netpgp;
int armour;
int ret;
netpgp = lua_touserdata(L, 1);
f = luaL_checkstring(L, 2);
output = luaL_checkstring(L, 3);
armour = findtype(armourtypes, luaL_checkstring(L, 4));
ret = netpgp_verify_file(netpgp, f, output, armour);
lua_pushnumber(L, ret);
return 1;
}
/* list_packets(netpgp, f, armour) */
static int
l_list_packets(lua_State *L)
{
const char *f;
netpgp_t *netpgp;
int armour;
int ret;
netpgp = lua_touserdata(L, 1);
f = luaL_checkstring(L, 2);
armour = findtype(armourtypes, luaL_checkstring(L, 3));
ret = netpgp_list_packets(netpgp, __UNCONST(f), armour, NULL);
lua_pushnumber(L, ret);
return 1;
}
/* setvar(netpgp, name, value) */
static int
l_setvar(lua_State *L)
{
const char *name;
const char *value;
netpgp_t *netpgp;
int ret;
netpgp = lua_touserdata(L, 1);
name = luaL_checkstring(L, 2);
value = luaL_checkstring(L, 3);
ret = netpgp_setvar(netpgp, name, value);
lua_pushnumber(L, ret);
return 1;
}
/* getvar(netpgp, name, value) */
static int
l_getvar(lua_State *L)
{
const char *name;
const char *ret;
netpgp_t *netpgp;
netpgp = lua_touserdata(L, 1);
name = luaL_checkstring(L, 2);
ret = netpgp_getvar(netpgp, name);
lua_pushstring(L, ret);
return 1;
}
const struct luaL_reg libluanetpgp[] = {
{ "new", l_new },
{ "init", l_init },
{ "encrypt_file", l_encrypt_file },
{ "decrypt_file", l_decrypt_file },
{ "sign_file", l_sign_file },
{ "clearsign_file", l_clearsign_file },
{ "verify_file", l_verify_file },
{ "verify_cat_file", l_verify_cat_file },
{ "list_packets", l_list_packets },
{ "getvar", l_getvar },
{ "setvar", l_setvar },
{ "homedir", l_homedir },
{ NULL, NULL }
};
int
luaopen_netpgp(lua_State *L)
{
luaL_openlib(L, "netpgp", libluanetpgp, 0);
return 1;
}

@ -1,99 +0,0 @@
#! /usr/bin/env lua
--
-- Copyright (c) 2009 The NetBSD Foundation, Inc.
-- All rights reserved.
--
-- This code is derived from software contributed to The NetBSD Foundation
-- by Alistair Crooks (agc@netbsd.org)
--
-- 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
--
-- command line args
dofile "optparse.lua"
opt = OptionParser{usage="%prog [options] file", version="20090711"}
opt.add_option{"-s", "--sign", action="store_true", dest="sign", help="--sign [--detached] [--armour] file"}
opt.add_option{"-v", "--verify", action="store_true", dest="verify", help="--verify [--armour] file"}
opt.add_option{"-e", "--encrypt", action="store_true", dest="encrypt", help="--encrypt [--armour] file"}
opt.add_option{"-d", "--decrypt", action="store_true", dest="decrypt", help="--decrypt [--armour] file"}
opt.add_option{"-h", "--homedir", action="store", dest="homedir", help="--homedir directory"}
opt.add_option{"-o", "--output", action="store", dest="output", help="--output file"}
opt.add_option{"-a", "--armour", action="store_true", dest="armour", help="--armour"}
opt.add_option{"-D", "--detached", action="store_true", dest="detached", help="--detached"}
-- caller lua script
local extension = ".so"
f = io.open("libluanetpgp.dylib", "r")
if f then
extension = ".dylib"
io.close(f)
end
glupkg = package.loadlib("libluanetpgp" .. extension, "luaopen_netpgp")
netpgp = glupkg()
-- initialise
pgp = netpgp.new()
-- parse command line args
options,args = opt.parse_args()
-- set defaults
local output = options.output or ""
local armour = "binary"
if options.armour then
armour = "armour"
end
local detached = "attached"
if options.detached then
detached = "detached"
end
if options.homedir then
netpgp.homedir(pgp, options.homedir)
end
-- initialise everything
netpgp.init(pgp)
local i
for i = 1, #args do
if options.encrypt then
-- encrypt a file
netpgp.encrypt_file(pgp, args[1], output, armour)
os.execute("ls -l " .. args[1] .. ".gpg")
end
if options.decrypt then
-- decrypt file
netpgp.decrypt_file(pgp, args[1], output, armour)
end
if options.sign then
-- detached signature
netpgp.sign_file(pgp, args[1], output, armour, detached)
os.execute("ls -l " .. args[1] .. ".sig")
end
if options.verify then
-- verification of detached signature
netpgp.verify_file(pgp, args[1], armour)
end
end

@ -1,123 +0,0 @@
-- Lua command line option parser.
-- Interface based on Pythons optparse.
-- http://docs.python.org/lib/module-optparse.html
-- (c) 2008 David Manura, Licensed under the same terms as Lua (MIT license)
--
-- To be used like this:
-- t={usage="<some usage message>", version="<version string>"}
-- op=OptionParser(t)
-- op=add_option{"<opt>", action=<action>, dest=<dest>, help="<help message for this option>"}
--
-- with :
-- <opt> the option string to be used (can be anything, if one letter opt, then should be -x val, more letters: -xy=val )
-- <action> one of
-- - store: store in options as key, val
-- - store_true: stores key, true
-- - store_false: stores key, false
-- <dest> is the key under which the option is saved
--
-- options,args = op.parse_args()
--
-- now options is the table of options (key, val) and args is the table with non-option arguments.
-- You can use op.fail(message) for failing and op.print_help() for printing the usage as you like.
function OptionParser(t)
local usage = t.usage
local version = t.version
local o = {}
local option_descriptions = {}
local option_of = {}
function o.fail(s) -- extension
io.stderr:write(s .. '\n')
os.exit(1)
end
function o.add_option(optdesc)
option_descriptions[#option_descriptions+1] = optdesc
for _,v in ipairs(optdesc) do
option_of[v] = optdesc
end
end
function o.parse_args()
-- expand options (e.g. "--input=file" -> "--input", "file")
local arg = {unpack(arg)}
for i=#arg,1,-1 do local v = arg[i]
local flag, val = v:match('^(%-%-%w+)=(.*)')
if flag then
arg[i] = flag
table.insert(arg, i+1, val)
end
end
local options = {}
local args = {}
local i = 1
while i <= #arg do local v = arg[i]
local optdesc = option_of[v]
if optdesc then
local action = optdesc.action
local val
if action == 'store' or action == nil then
i = i + 1
val = arg[i]
if not val then o.fail('option requires an argument ' .. v) end
elseif action == 'store_true' then
val = true
elseif action == 'store_false' then
val = false
end
options[optdesc.dest] = val
else
if v:match('^%-') then o.fail('invalid option ' .. v) end
args[#args+1] = v
end
i = i + 1
end
if options.help then
o.print_help()
os.exit()
end
if options.version then
io.stdout:write(t.version .. "\n")
os.exit()
end
return options, args
end
local function flags_str(optdesc)
local sflags = {}
local action = optdesc.action
for _,flag in ipairs(optdesc) do
local sflagend
if action == nil or action == 'store' then
local metavar = optdesc.metavar or optdesc.dest:upper()
sflagend = #flag == 2 and ' ' .. metavar
or '=' .. metavar
else
sflagend = ''
end
sflags[#sflags+1] = flag .. sflagend
end
return table.concat(sflags, ', ')
end
function o.print_help()
io.stdout:write("Usage: " .. usage:gsub('%%prog', arg[0]) .. "\n")
io.stdout:write("\n")
io.stdout:write("Options:\n")
for _,optdesc in ipairs(option_descriptions) do
io.stdout:write(" " .. flags_str(optdesc) ..
" " .. optdesc.help .. "\n")
end
end
o.add_option{"--help", action="store_true", dest="help",
help="show this help message and exit"}
if t.version then
o.add_option{"--version", action="store_true", dest="version",
help="output version info."}
end
return o
end

@ -1,2 +0,0 @@
major=0
minor=0

@ -1,16 +0,0 @@
# $NetBSD$
# Automatically generated by swigit wrapper script
PREFIX=/usr/pkg
LIB=netpgpperl
SRCS=netpgpperl_wrap.c
WARNS=0
MKMAN=no
MKLINT=no
CPPFLAGS+=-I${PREFIX}/include
CPPFLAGS+=-I/usr/pkg/lib/perl5/5.10.0/i386-netbsd-thread-multi/CORE
LDFLAGS+=-L${PREFIX}/lib
LDADD+=-lnetpgp
.include <bsd.lib.mk>

@ -1,103 +0,0 @@
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Alistair Crooks (agc@netbsd.org)
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
#ifndef NETPGP_H_
#define NETPGP_H_
#ifndef __BEGIN_DECLS
# if defined(__cplusplus)
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
# else
# define __BEGIN_DECLS
# define __END_DECLS
# endif
#endif
__BEGIN_DECLS
/* structure used to hold (key,value) pair information */
typedef struct netpgp_t {
unsigned c; /* # of elements used */
unsigned size; /* size of array */
char **name; /* key names */
char **value; /* value information */
void *pubring; /* public key ring */
void *secring; /* s3kr1t key ring */
void *io; /* the io struct for results/errs */
void *passfp; /* file pointer for password input */
} netpgp_t;
/* begin and end */
int netpgp_init(netpgp_t *);
int netpgp_end(netpgp_t *);
/* debugging, reflection and information */
int netpgp_set_debug(const char *);
int netpgp_get_debug(const char *);
const char *netpgp_get_info(const char *);
int netpgp_list_packets(netpgp_t *, char *, int, char *);
/* variables */
int netpgp_setvar(netpgp_t *, const char *, const char *);
char *netpgp_getvar(netpgp_t *, const char *);
int netpgp_incvar(netpgp_t *, const char *, const int);
int netpgp_unsetvar(netpgp_t *, const char *);
/* set home directory information */
int netpgp_set_homedir(netpgp_t *, char *, const char *, const int);
/* key management */
int netpgp_list_keys(netpgp_t *, const int);
int netpgp_find_key(netpgp_t *, char *);
char *netpgp_get_key(netpgp_t *, const char *, const char *);
char *netpgp_export_key(netpgp_t *, char *);
int netpgp_import_key(netpgp_t *, char *);
int netpgp_generate_key(netpgp_t *, char *, int);
/* file management */
int netpgp_encrypt_file(netpgp_t *, const char *, const char *, char *, int);
int netpgp_decrypt_file(netpgp_t *, const char *, char *, int);
int netpgp_sign_file(netpgp_t *, const char *, const char *, char *, int, int, int);
int netpgp_verify_file(netpgp_t *, const char *, const char *, int);
/* memory signing and encryption */
int netpgp_sign_memory(netpgp_t *, const char *, char *, size_t, char *, size_t, const unsigned, const unsigned);
int netpgp_verify_memory(netpgp_t *, const void *, const size_t, void *, size_t, const int);
int netpgp_encrypt_memory(netpgp_t *, const char *, void *, const size_t, char *, size_t, int);
int netpgp_decrypt_memory(netpgp_t *, const void *, const size_t, char *, size_t, const int);
/* match and hkp-related functions */
int netpgp_match_keys(netpgp_t *, char *, const char *, void *, const int);
int netpgp_match_pubkeys(netpgp_t *, char *, void *);
int netpgp_validate_sigs(netpgp_t *);
__END_DECLS
#endif /* !NETPGP_H_ */

@ -1,28 +0,0 @@
#! /usr/pkg/bin/perl -w
# netpgp bindings for perl
use lib "/usr/src/crypto/external/bsd/netpgp/dist/bindings/perl";
use netpgpperl;
# initializations
$n = netpgpperlc::new_netpgp_t();
netpgpperlc::netpgp_setvar($n, "homedir", $ENV{'HOME'}."/.gnupg");
netpgpperlc::netpgp_setvar($n, "hash", "SHA256");
netpgpperlc::netpgp_init($n);
# get the default userid
$userid = netpgpperlc::netpgp_getvar($n, "userid");
foreach $i (0 .. $#ARGV) {
# set up file names
my $in = $ARGV[$i];
my $out = $in . ".gpg";
# sign the file, output is in $out
netpgpperlc::netpgp_sign_file($n, $userid, $in, $out, 0, 0, 0);
# verify the signed file $out
netpgpperlc::netpgp_verify_file($n, $out, "/dev/null", 0);
}

@ -1,7 +0,0 @@
%module netpgpperl
%{
#include <netpgp.h>
#undef SvPOK
#define SvPOK(x) 1
%}
%include netpgp.h

@ -1,138 +0,0 @@
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 1.3.31
#
# Don't modify this file, modify the SWIG interface instead.
package netpgpperl;
require Exporter;
require DynaLoader;
@ISA = qw(Exporter DynaLoader);
package netpgpperlc;
bootstrap netpgpperl;
package netpgpperl;
@EXPORT = qw( );
# ---------- BASE METHODS -------------
package netpgpperl;
sub TIEHASH {
my ($classname,$obj) = @_;
return bless $obj, $classname;
}
sub CLEAR { }
sub FIRSTKEY { }
sub NEXTKEY { }
sub FETCH {
my ($self,$field) = @_;
my $member_func = "swig_${field}_get";
$self->$member_func();
}
sub STORE {
my ($self,$field,$newval) = @_;
my $member_func = "swig_${field}_set";
$self->$member_func($newval);
}
sub this {
my $ptr = shift;
return tied(%$ptr);
}
# ------- FUNCTION WRAPPERS --------
package netpgpperl;
*netpgp_init = *netpgpperlc::netpgp_init;
*netpgp_end = *netpgpperlc::netpgp_end;
*netpgp_set_debug = *netpgpperlc::netpgp_set_debug;
*netpgp_get_debug = *netpgpperlc::netpgp_get_debug;
*netpgp_get_info = *netpgpperlc::netpgp_get_info;
*netpgp_list_packets = *netpgpperlc::netpgp_list_packets;
*netpgp_setvar = *netpgpperlc::netpgp_setvar;
*netpgp_getvar = *netpgpperlc::netpgp_getvar;
*netpgp_incvar = *netpgpperlc::netpgp_incvar;
*netpgp_unsetvar = *netpgpperlc::netpgp_unsetvar;
*netpgp_set_homedir = *netpgpperlc::netpgp_set_homedir;
*netpgp_list_keys = *netpgpperlc::netpgp_list_keys;
*netpgp_find_key = *netpgpperlc::netpgp_find_key;
*netpgp_get_key = *netpgpperlc::netpgp_get_key;
*netpgp_export_key = *netpgpperlc::netpgp_export_key;
*netpgp_import_key = *netpgpperlc::netpgp_import_key;
*netpgp_generate_key = *netpgpperlc::netpgp_generate_key;
*netpgp_encrypt_file = *netpgpperlc::netpgp_encrypt_file;
*netpgp_decrypt_file = *netpgpperlc::netpgp_decrypt_file;
*netpgp_sign_file = *netpgpperlc::netpgp_sign_file;
*netpgp_verify_file = *netpgpperlc::netpgp_verify_file;
*netpgp_sign_memory = *netpgpperlc::netpgp_sign_memory;
*netpgp_verify_memory = *netpgpperlc::netpgp_verify_memory;
*netpgp_encrypt_memory = *netpgpperlc::netpgp_encrypt_memory;
*netpgp_decrypt_memory = *netpgpperlc::netpgp_decrypt_memory;
*netpgp_match_keys = *netpgpperlc::netpgp_match_keys;
*netpgp_match_pubkeys = *netpgpperlc::netpgp_match_pubkeys;
*netpgp_validate_sigs = *netpgpperlc::netpgp_validate_sigs;
############# Class : netpgpperl::netpgp_t ##############
package netpgpperl::netpgp_t;
use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS);
@ISA = qw( netpgpperl );
%OWNER = ();
%ITERATORS = ();
*swig_c_get = *netpgpperlc::netpgp_t_c_get;
*swig_c_set = *netpgpperlc::netpgp_t_c_set;
*swig_size_get = *netpgpperlc::netpgp_t_size_get;
*swig_size_set = *netpgpperlc::netpgp_t_size_set;
*swig_name_get = *netpgpperlc::netpgp_t_name_get;
*swig_name_set = *netpgpperlc::netpgp_t_name_set;
*swig_value_get = *netpgpperlc::netpgp_t_value_get;
*swig_value_set = *netpgpperlc::netpgp_t_value_set;
*swig_pubring_get = *netpgpperlc::netpgp_t_pubring_get;
*swig_pubring_set = *netpgpperlc::netpgp_t_pubring_set;
*swig_secring_get = *netpgpperlc::netpgp_t_secring_get;
*swig_secring_set = *netpgpperlc::netpgp_t_secring_set;
*swig_io_get = *netpgpperlc::netpgp_t_io_get;
*swig_io_set = *netpgpperlc::netpgp_t_io_set;
*swig_passfp_get = *netpgpperlc::netpgp_t_passfp_get;
*swig_passfp_set = *netpgpperlc::netpgp_t_passfp_set;
sub new {
my $pkg = shift;
my $self = netpgpperlc::new_netpgp_t(@_);
bless $self, $pkg if defined($self);
}
sub DESTROY {
return unless $_[0]->isa('HASH');
my $self = tied(%{$_[0]});
return unless defined $self;
delete $ITERATORS{$self};
if (exists $OWNER{$self}) {
netpgpperlc::delete_netpgp_t($self);
delete $OWNER{$self};
}
}
sub DISOWN {
my $self = shift;
my $ptr = tied(%$self);
delete $OWNER{$ptr};
}
sub ACQUIRE {
my $self = shift;
my $ptr = tied(%$self);
$OWNER{$ptr} = 1;
}
# ------- VARIABLE STUBS --------
package netpgpperl;
1;

File diff suppressed because it is too large Load Diff

@ -1,2 +0,0 @@
major=0
minor=0

@ -1,18 +0,0 @@
# $NetBSD$
# Automatically generated by swigit wrapper script
PREFIX=/usr/pkg
LIB=netpgppython
SRCS=netpgppython_wrap.c
WARNS=0
MKMAN=no
CPPFLAGS+=-I${PREFIX}/include
CPPFLAGS+=-I/usr/pkg/include/python2.5
LDFLAGS+=-L${PREFIX}/lib
LDADD+=-lnetpgp
.include <bsd.lib.mk>
full:
ln libnetpgppython.so _netpgppython.so

@ -1,103 +0,0 @@
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Alistair Crooks (agc@netbsd.org)
*
* 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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.
*/
#ifndef NETPGP_H_
#define NETPGP_H_
#ifndef __BEGIN_DECLS
# if defined(__cplusplus)
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
# else
# define __BEGIN_DECLS
# define __END_DECLS
# endif
#endif
__BEGIN_DECLS
/* structure used to hold (key,value) pair information */
typedef struct netpgp_t {
unsigned c; /* # of elements used */
unsigned size; /* size of array */
char **name; /* key names */
char **value; /* value information */
void *pubring; /* public key ring */
void *secring; /* s3kr1t key ring */
void *io; /* the io struct for results/errs */
void *passfp; /* file pointer for password input */
} netpgp_t;
/* begin and end */
int netpgp_init(netpgp_t *);
int netpgp_end(netpgp_t *);
/* debugging, reflection and information */
int netpgp_set_debug(const char *);
int netpgp_get_debug(const char *);
const char *netpgp_get_info(const char *);