\"     $NetBSD: netpgp.3lua,v 1.4 2023/03/01 21:07:21 nia Exp $
\"
\" Copyright (c) 2018 The NetBSD Foundation, Inc.
\" 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 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.
\"
Dd April 30, 2018
Dt NETPGP 3lua
Os
Sh NAME
Nm netpgp
Nd provides access to
Xr libnetpgp 3
functionality from Lua
Sh SYNOPSIS
Cd "local netpgp = require 'netpgp'"
Pp
Bl -tag -width XXXX -compact
It Dv instance = netpgp.new()
It Dv netpgp.homedir(instance, homedir)
It Dv netpgp.init(instance)
It Dv netpgp.encrypt_file(instance, file, output, armour)
It Dv netpgp.decrypt_file(instance, file, output, armour)
It Dv netpgp.sign_file(instance, file, output, armour, detached)
It Dv netpgp.clearsign_file(instance, file, output, armour, detached)
It Dv netpgp.verify_file(instance, file, armour)
It Dv netpgp.verify_cat_file(instance, file, output, armour)
It Dv netpgp.list_packets(instance, file, armour)
It Dv netpgp.setvar(instance, name, value)
It Dv netpgp.getvar(instance, name, value)
El
Sh DESCRIPTION
The
Nm
Lua binding provides access to functionality available in
Xr libnetpgp 3 .
Sh EXAMPLES
The following example code demonstrates the process of encrypting, decrypting,
signing, and verifying a file, in a single script.
Bd -literal
local netpgp = require 'netpgp'
btc = netpgp.new()
netpgp.setvar(btc, "need seckey", 1)
netpgp.init(btc)

netpgp.encrypt_file(btc, "scratch", "scratch.gpg", "armoured")
netpgp.decrypt_file(btc, "scratch.gpg", "itch", "armoured")
netpgp.sign_file(btc, "scratch", "scratch.asc", "armoured", "detached")
netpgp.verify_file(btc, "scratch.asc", "armoured")
Ed
Sh SEE ALSO
Xr lua 1 ,
Xr luac 1 ,
Xr libnetpgp 3 ,
Xr intro 3lua
Sh HISTORY
Nm
Lua binding first appeared in
Nx 9.0 .
Sh AUTHORS
An -nosplit
The
Nm
Lua binding was written by
An Alistair Crooks .
Sh BUGS
This binding currently only provides a subset of the functionality available in
Xr libnetpgp 3 .
This manual needs more description of the available functionality.