3 ################################################################
5 # Copyright (c) 1995-2014 SUSE Linux Products GmbH
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License version 2 or 3 as
9 # published by the Free Software Foundation.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program (see the file COPYING); if not, write to the
18 # Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
21 ################################################################
23 # simple "sign" replacement that does nothing but
24 # write a 2048 byte file with a fixed signature.
25 # sign is used in kiwi builds to sign repositories
30 if ($ARGV[0] =~ /^-([cdrp])$/) {
35 if ($ARGV[0] eq '--') {
39 if ($ARGV[0] =~ /^-/) {
40 die("unsupported option $ARGV[0]\n");
45 my $block = "sIGnMeP\n";
46 $block .= "\0" x (8192 - length($block));
47 (syswrite(STDOUT, $block) || 0) == 8192 || die("pubkey write: $!\n");
50 die("only detached mode possible\n") if !$mode || $mode ne 'd';
51 die("filter mode not supported\n") unless @ARGV;
53 for my $file (@ARGV) {
55 open(F, '<', $file) || die("$file: $!\n");
57 1 while sysread(F, $buf, 16384, length($buf));
58 close(F) || die("$file: $!\n");
59 my $block = "sIGnMe!\n";
60 $block .= sprintf("%08x%08x\n", length($buf), unpack("%32C*", $buf));
61 $block .= "\0" x (2048 - length($block));
62 open(F, '>', "$file.asc") || die("$file.asc: $!\n");
63 (syswrite(F, $block) || 0) == 2048 || die("$file.asc: $!\n");
64 close(F) || die("$file.asc: $!\n");