From owner-man-jp-reviewer@jp.freebsd.org  Fri Mar  9 19:27:46 2001
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id TAA20916;
	Fri, 9 Mar 2001 19:27:46 +0900 (JST)
	(envelope-from owner-man-jp-reviewer@jp.FreeBSD.org)
Received: from surf.ap.seikei.ac.jp (root@surf.ap.seikei.ac.jp [133.220.91.111])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id TAA20911
	for <man-jp-reviewer@jp.freebsd.org>; Fri, 9 Mar 2001 19:27:46 +0900 (JST)
	(envelope-from nakano@surf.ap.seikei.ac.jp)
Received: from babarelay.ap.seikei.ac.jp (root@babarelay.ap.seikei.ac.jp [133.220.91.113])
	by surf.ap.seikei.ac.jp (8.9.3/3.7W-99/03/03) with ESMTP id TAA09932
	for <man-jp-reviewer@jp.freebsd.org>; Fri, 9 Mar 2001 19:27:45 +0900
Received: (from nakano@localhost)
	by babarelay.ap.seikei.ac.jp (8.9.3/3.7W-99/04/13) id TAA16082;
	Fri, 9 Mar 2001 19:27:44 +0900
Date: Fri, 9 Mar 2001 19:27:44 +0900
Message-Id: <200103091027.TAA16082@babarelay.ap.seikei.ac.jp>
From: NAKANO Takeo <nakano@apm.seikei.ac.jp>
To: man-jp-reviewer@jp.freebsd.org
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-2022-JP
X-Mailer: mnews [version 1.22PL4] 2000-05/28(Sun)
Reply-To: man-jp-reviewer@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+000315
X-Sequence: man-jp-reviewer 3410
Subject: [man-jp-reviewer 3410] pkg_sign.1
Errors-To: owner-man-jp-reviewer@jp.freebsd.org
Sender: owner-man-jp-reviewer@jp.freebsd.org
X-Originator: nakano@apm.seikei.ac.jp

$BCfLn$G$9!#(B

pkg_sign.1 $B$NLu$G$9!#!!$o$+$i$J$+$C$?$H$3$m$K$O(B

.\"nakano:

$B$G%3%a%s%H$rF~$l$F$*$-$^$7$?$N$G!"$40U8+$r$$$?$@$1$^$9$H(B
$B9,$$$G$9!#(B

-- 
$BCfLn!w@.l~Bg(B

.\" $FreeBSD: src/usr.sbin/pkg_install/sign/pkg_sign.1,v 1.1.2.3 2001/03/08 02:27:42 jkh Exp $
.\" $OpenBSD: pkg_sign.1,v 1.6 2000/04/15 02:15:20 aaron Exp $
.\"
.\" Copyright (c) 1999 Marc Espie.
.\"
.\" 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.
.\" 3. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"    This product includes software developed by Marc Espie for the OpenBSD
.\"    Project.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE OPENBSD PROJECT 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 OPENBSD
.\" PROJECT 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.
.\"
.\" jpman %Id%
.\"
.\"WORD:	certificate	$B>ZL@=q(B
.\"WORD:	verification	$BG'>Z(B
.\"
.Dd September 24, 1999
.Dt PKG_SIGN 1
.Os
.\"O .Sh NAME
.Sh $BL>>N(B
.Nm pkg_sign ,
.Nm pkg_check
.\"O .Nd handle package signatures
.Nd package $B$N=pL>$r07$&(B
.\"O .Sh SYNOPSIS
.Sh $B=q<0(B
.Nm
.Op Fl sc
.Op Fl t Ar type
.Op Fl u Ar id
.Op Fl k Ar key
.Op Ar
.Nm pkg_check
.Op Fl sc
.Op Fl u Ar id
.Op Fl k Ar cert
.Op Ar
.\"O .Sh DESCRIPTION
.Sh $B2r@b(B
.\"O .Nm
.\"O embeds a cryptographic signature within a gzip file
.\"O .Ar file .
.\"O .Ar type
.\"O can be
.\"O .Cm pgp
.\"O (default), 
.\"O .Cm sha1 ,
.\"O or
.\"O .Cm x509 .
.Nm
$B$O0E9f2=$5$l$?=pL>$r(B gzip $B%U%!%$%k(B
.Ar file
$B$KKd$a$3$_$^$9!#(B
.Ar type
$B$K$O(B
.Cm pgp
($B%G%U%)%k%H(B),
.Cm sha1 ,
.Cm x509
$B$,;XDj$G$-$^$9!#(B
.\"O If
.\"O .Ar type
.\"O is
.\"O .Cm pgp ,
.\"O it will always prompt you for a passphrase to unlock your private
.\"O pgp key, even if you don't use a passphrase (which is a bad idea, anyway).
.Ar type
$B$r(B
.Cm pgp
$B$K$9$k$H!"(B
pgp $BHkL)80$NMxMQ$r2DG=$K$9$k$?$a$N(B
$B%Q%9%U%l!<%:F~NO$rB%$9%W%m%s%W%H$,I=<($5$l$^$9!#(B
$B%Q%9%U%l!<%:$r@_Dj$7$F$$$J$/$F$bI=<($5$l$^$9(B
($B$3$l$O$$$:$l$K$;$h$"$^$jNI$/$J$$$3$H$G$9$,(B)$B!#(B
.\"O If
.\"O .Ar type
.\"O is
.\"O .Cm sha1 ,
.\"O you must supply an
.\"O .Ar id ,
.\"O which will be recorded as the name of the package, and printed as the
.\"O SHA1 checksum.
.Ar type
$B$,(B
.Cm sha1
$B$N>l9g$O!"(B
.Ar id
$B$r;XDj$9$kI,MW$,$"$j$^$9!#$3$l$O(B package
($BLuCm(B: FreeBSD $B$N(B package system $B$K$*$1$k%Q%C%1!<%8$r;X$9>l9g$K$3$&I=5-$7$^$9(B)
$B$NL>A0$H$7$F5-O?$5$l!"(BSHA1 $B%A%'%C%/%5%`$H$7$FI=<($5$l$^$9!#(B
.Pp
.\"O .Nm pkg_check
.\"O checks that cryptographic signature.
.\"O It currently disregards
.\"O .Ar type
.\"O and checks only the topmost signature.
.\"O For
.\"O .Cm sha1 ,
.\"O it checksums the file
.\"O and verifies that the result matches the list of checksums recorded in
.\"O .Pa /var/db/pkg/SHA1 .
.Nm pkg_check
$B$O0E9f2=$5$l$?=pL>$r%A%'%C%/$7$^$9!#(B
$B8=:_$O(B
.Ar type
$B$rL5;k$7!"0lHV>e$N=pL>$@$1$r%A%'%C%/$7$^$9!#(B
.\"nakano: topmost $B$O$3$l$GNI$$(B?
.Cm sha1
$B$KBP$7$F$O!"(B
.Nm pkg_check
$B$O%U%!%$%k$N%A%'%C%/%5%`$r<h$j!"(B
$B7k2L$,(B
.Pa /var/db/pkg/SHA1
$B$K5-O?$5$l$F$$$k%A%'%C%/%5%`$N%j%9%H$K%^%C%A$9$k$+$I$&$+3NG'$7$^$9!#(B
.Pp
.\"O Options
$B%*%W%7%g%s(B
.Fl s
.\"O and
$B$*$h$S(B
.Fl c
.\"O can be used to force package signing or signature checking mode.
$B$O!V(Bpackage $B$X$N=pL>!W%b!<%I$*$h$S!V=pL>%A%'%C%/!W%b!<%I$r6/@)$7$^$9!#(B
.\"nakano: pkg_sign -c = pkg_check, pkg_check -s = pkg_sign, $B$H$$$&$3$H(B?
.Pp
.\"O For
.\"O .Cm pgp ,
.\"O the
.\"O .Ar id
.\"O to use to sign the package or verify the signature can be forced with
.\"O .Fl u .
.Cm pgp
$B$G$O!"(B
package $B$X$N=pL>$d=pL>%A%'%C%/$KMQ$$$k(B
.Ar id
$B$r!"(B
.Fl u
$B$G;XDj$G$-$^$9!#(B
.Pp
.\"O For
.\"O .Cm x509 ,
.\"O the signing key or verification certificate may be
.\"O specified with the
.\"O .Fl k
.\"O option.  If not specified, packages are signed or verified with the
.\"O default keys and certificates documented below.
.Cm x509
$B$G$O!"(B
$B=pL>%-!<$^$?$OG'>Z$9$k>ZL@=q(B (certificate) $B$r(B
.Fl k
$B%*%W%7%g%s$G;XDj$G$-$^$9!#(B
$B;XDj$7$J$$$H!"(Bpackage $B$O0J2<$G5-=R$7$F$$$k(B
$B%G%U%)%k%H$N%-!<(B/$B>ZL@=q$G=pL>(B/$BG'>Z$5$l$^$9!#(B
.Pp
.\"O If
.\"O .Ar file
.\"O is a single dash
.\"O .Pq Sq Fl
.\"O or absent,
.\"O .Nm
.\"O reads from the standard input.
.Ar file
$B$,%@%C%7%e$R$H$D(B
.Pq Sq Fl
$B$@$C$?$j;XDj$5$l$J$+$C$?>l9g$O!"(B
.Nm
$B$OI8=`F~NO$+$iFI$_9~$_$^$9!#(B
.Pp
.\"O Package signing uses a feature of the gzip format, namely that one can
.\"O set a flag
.\"O .Dv EXTRA_FIELD
.\"O in the gzip header and store extra data between the gzip header and the
.\"O compressed file proper.
.\"O The
.\"O .Ox
.\"O signing scheme uses eight bytes markers such
.\"O .Sq Li SIGPGP
.\"O + length or
.\"O .Sq CKSHA1
.\"O + length for its signatures (those markers are conveniently
.\"O eight bytes long).
package $B$X$N=pL>$G$O(B gzip $B7A<0$NFCD'$rMxMQ$7$F$$$^$9!#(B
$B$3$l$O!"(B gzip $B$N%X%C%@$K$O(B
.Dv EXTRA_FIELD
$B$H$$$&%U%i%0$r@_Dj$G$-!"M>J,$N%G!<%?$r(B
gzip $B%X%C%@$H05=L%U%!%$%k$N4V$KJ]B8$G$-$k!"$H$$$&$b$N$G$9!#(B
.Ox
$B$N=pL>5!9=$G$O!"(B
.Sq Li SIGPGP
+ length
$B$d(B
.Sq CKSHA1
+ length
$B$N$h$&$J(B 8 $B%P%$%H$N%^!<%+!<$r=pL>$KMQ$$$F$$$^$9(B
($B$3$l$i$N%^!<%+!<$OEAE}E*$K(B 8 $B%P%$%HD9$H$J$C$F$$$^$9(B)$B!#(B
.\"O .Sh DIAGNOSTICS
.Sh $B?GCG(B
.\"O .Nm
.\"O and
.\"O .Nm pkg_check
.\"O return with an exit code >0 if anything went wrong for any
.\"O .Ar file .
.Nm
$B$*$h$S(B
.Nm pkg_check
$B$O!"(B
.Ar file
$B$N$$$:$l$+$K$J$K$+LdBj$,$"$k$H!"(B 0 $B$h$jBg$-$$=*N;%3!<%I$rJV$7$^$9!#(B
.\"O For
.\"O .Nm pkg_check ,
.\"O this usually indicates that the package is not signed, or that the
.\"O signature is forged.
.Nm pkg_check
$B$N>l9g!"$3$l$ODL>o(B package $B$,=pL>$5$l$F$$$J$$!"(B
$B$"$k$$$O=pL>$,YTB$$5$l$F$$$k$3$H$r0UL#$7$^$9!#(B
.Bl -diag
.It "File %s is already signed"
.\"O There is a signature embedded within the gzip file already.
.\"O .Nm
.\"O currently does not handle multiple signatures.
$B$=$N(B gzip $B%U%!%$%k$K$O!"4{$K=pL>$,Kd$a$3$^$l$F$$$^$9!#(B
.Nm
$B$O:#$N$H$3$mJ#?t$N=pL>$r07$$$^$;$s!#(B
.It "File %s is not a signed gzip file"
.\"O This is an unsigned package.
$B$3$N(B package $B$K$O=pL>$,$"$j$^$;$s!#(B
.It "File %s is not a gzip file"
.\"O The program couldn't find a proper gzip header.
gzip $B%X%C%@$,8+$D$+$j$^$;$s$G$7$?!#(B
.It "File %s contains an unknown extension"
.\"O The extended area of the gzip file has been used for an unknown purpose.
gzip $B%U%!%$%k$N3HD%NN0h$,!"JL$N2?$i$+$NMQES$K4{$K;H$o$l$F$$$^$7$?!#(B
.It "File %s uses old signatures, no longer supported"
.\"O The gzip file uses a very early version of package signing that was
.\"O substantially slower.
$B$3$N(B gzip $B%U%!%$%k$O!"Hs>o$K8E$$HG$N(B
($B$+$J$jCY$/$J$k(B) package $B=pL>$rMQ$$$F$$$^$9!#(B
.El
.\"O .Sh BUGS
.Sh $B%P%0(B
.\"O .Xr pgp 1
.\"O is an ill-designed program, which is hard to interface with.
.\"O For instance, the `separate signing scheme' it pretends to offer is
.\"O useless, as it can't be used with pipes, so that
.\"O .Nm pgp_sign
.\"O needs to kludge it by knowing the length of a pgp signature, and invoking
.\"O pgp in `seamless' signature mode, without compression of the main file,
.\"O and just retrieving the signature.
.Xr pgp 1
$B$O$"$^$j@_7W$NNI$/$J$$%W%m%0%i%`$G!"(B
$B%$%s%?!<%U%'!<%9$r<h$k$N$,Fq$7$$$G$9!#(B
$BNc$($P(B pgp $B$,Ds6!$7$F$$$k$H$$$C$F$$$k(B
$B!VJ,N%=pL>5!G=(B (separate signing scheme)$B!W(B
$B$OITJX6K$^$j$J$$$b$N$G!"%Q%$%W$rDL$7$F$NMxMQ$,$G$-$^$;$s!#(B
$B$7$?$,$C$F(B
.Nm pgp_sign
$B$G$O$3$l$r$J$s$H$+$9$k$?$a$K!"(B
pgp $B=pL>$ND9$5$rCN$C$F$$$k$3$H$K$7$F!"(B
pgp $B$r!V%7!<%`%l%9!W=pL>%b!<%I$G5/F0$7!"(B
$B%U%!%$%kK\BN$O05=L$7$J$$$G=pL>$N$_$r<h=P$7$F$$$^$9!#(B
.\"nakano: kludge it $B$NE,@Z$JLu$,$A$g$C$H$o$+$j$^$;$s$G$7$?!#(B
.Pp
.\"O The checking scheme is little less convoluted, namely we rebuild the file
.\"O that pgp expects on the fly.
$B%A%'%C%/F0:n$G$O$"$^$jJ#;($J$3$H$O$7$F$$$^$;$s!#(B
pgp $B$KF~NO$9$k%U%!%$%k$r$=$N>l$G:F%S%k%I$7$F$$$^$9!#(B
.\"nakano: $B5U$+(B? -> little less convoluted
.Pp
.\"O Paths to
.\"O .Nm pgp
.\"O and
.\"O the checksum file are hard-coded to avoid tampering and hinder flexibility.
.Nm pgp
$B$*$h$S%A%'%C%/%5%`%U%!%$%k$X$N%Q%9$OIT@5MxMQ$rK8$2$k$?$a$K(B
$B%O!<%I%3!<%I$5$l$F$$$^$9!#$=$N$?$a=@Fp@-$OB;$J$o$l$F$$$^$9!#(B
.\"O .Sh FILES
.Sh $B%U%!%$%k(B
.Bl -tag -width "/usr/local/bin/pgp" -compact
.It Pa file.sign
.\"O Temporary file built by
.\"O .Nm
.\"O from
.\"O .Ar file .
.Nm
$B$,(B
.Ar file
$B$+$i%S%k%I$9$k0l;~%U%!%$%k(B
.It Pa /usr/local/bin/pgp
.\"O Default path to
.\"O .Xr pgp 1 .
.Xr pgp 1
$B$N%G%U%)%k%H$N%Q%9(B
.It Pa /var/db/pkgs/SHA1
.\"O Recorded checksums.
$B5-O?:Q$_$N%A%'%C%/%5%`(B
.It Pa /etc/ssl/pkg.key
.\"O Default package signing key.
$B%G%U%)%k%H$N(B package $B$X$N=pL>%-!<(B
.It Pa /etc/ssl/pkg.crt
.\"O Default package verification certificate(s).
$B%G%U%)%k%H$N(B package $BG'>ZMQ>ZL@=q(B
.El
.\"O .Sh SEE ALSO
.Sh $B4XO"9`L\(B
.Xr gzip 1 ,
.Xr pgp 1 ,
.Xr pkg_add 1 ,
.Xr sha1 1
.\"O .Sh AUTHORS
.Sh $B:n<T(B
.\"O .An -nosplit
.\"O .Nm
.\"O was created by
.\"O .An Marc Espie
.\"O for the
.\"O .Ox
.\"O Project.
.An -nosplit
.Nm
$B$O(B
.An Marc Espie
$B$,(B
.Ox
$B%W%m%8%'%/%H$N$?$a$K:n@.$7$^$7$?!#(B
.\"O X.509 signatures and
.\"O .Fx
.\"O support added by
.\"O .An Wes Peters Aq wes@softweyr.com .
X.509 $B=pL>$H(B
.Fx
$B%5%]!<%H$O(B
.An Wes Peters Aq wes@softweyr.com
$B$,DI2C$7$^$7$?!#(B

