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