xref: /netbsd-src/share/man/man3lua/netpgp.3lua (revision 181254a7b1bdde6873432bffef2d2decc4b5c22f)
1.\"     $NetBSD: netpgp.3lua,v 1.2 2018/04/30 07:10:04 wiz Exp $
2.\"
3.\" Copyright (c) 2018 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" This code is derived from software contributed to The NetBSD Foundation
7.\" by Sevan Janiyan <sevan@NetBSD.org>.
8.\"
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\"    notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\"    notice, this list of conditions and the following disclaimer in the
16.\"    documentation and/or other materials provided with the distribution.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28.\" POSSIBILITY OF SUCH DAMAGE.
29.\"
30.Dd April 30, 2018
31.Dt NETPGP 3lua
32.Os
33.Sh NAME
34.Nm netpgp
35.Nd provides access to
36.Xr libnetpgp 3
37functionality from Lua
38.Sh SYNOPSIS
39.Cd "local netpgp = require 'netpgp'"
40.Pp
41.Bl -tag -width XXXX -compact
42.It Dv instance = netpgp.new()
43.It Dv netpgp.homedir(instance, homedir)
44.It Dv netpgp.init(instance)
45.It Dv netpgp.encrypt_file(instance, file, output, armour)
46.It Dv netpgp.decrypt_file(instance, file, output, armour)
47.It Dv netpgp.sign_file(instance, file, output, armour, detached)
48.It Dv netpgp.clearsign_file(instance, file, output, armour, detached)
49.It Dv netpgp.verify_file(instance, file, armour)
50.It Dv netpgp.verify_cat_file(instance, file, output, armour)
51.It Dv netpgp.list_packets(instance, file, armour)
52.It Dv netpgp.setvar(instance, name, value)
53.It Dv netpgp.getvar(instance, name, value)
54.El
55.Sh DESCRIPTION
56The
57.Nm
58Lua binding provides access to functionality availabile in
59.Xr libnetpgp 3 .
60.Sh EXAMPLES
61The following example code demonstrates the process of encrypting, decrypting,
62signing, and verifying a file, in a single script.
63.Bd -literal
64local netpgp = require 'netpgp'
65btc = netpgp.new()
66netpgp.setvar(btc, "need seckey", 1)
67netpgp.init(btc)
68
69netpgp.encrypt_file(btc, "scratch", "scratch.gpg", "armoured")
70netpgp.decrypt_file(btc, "scratch.gpg", "itch", "armoured")
71netpgp.sign_file(btc, "scratch", "scratch.asc", "armoured", "detached")
72netpgp.verify_file(btc, "scratch.asc", "armoured")
73.Ed
74.Sh SEE ALSO
75.Xr lua 1 ,
76.Xr luac 1 ,
77.Xr libnetpgp 3 ,
78.Xr intro 3lua
79.Sh HISTORY
80.Nm
81Lua binding first appeared in
82.Nx 9.0 .
83.Sh AUTHORS
84.An -nosplit
85The
86.Nm
87Lua binding was written by
88.An Alistair Crooks .
89This manual was written by
90.An Sevan Janiyan Aq Mt sevan@NetBSD.org .
91.Sh BUGS
92This binding currently only provides a subset of the functionality available in
93.Xr libnetpgp 3 .
94This manual needs more description of the available functionality.
95