3 # simple "sign" replacement that does nothing but
4 # write a 2048 byte file with a fixed signature.
5 # sign is used in kiwi builds to sign repositories
10 if ($ARGV[0] =~ /^-([cdrp])$/) {
15 if ($ARGV[0] eq '--') {
19 if ($ARGV[0] =~ /^-/) {
20 die("unsupported option $ARGV[0]\n");
25 my $block = "sIGnMeP\n";
26 $block .= "\0" x (8192 - length($block));
27 (syswrite(STDOUT, $block) || 0) == 8192 || die("pubkey write: $!\n");
30 die("only detached mode possible\n") if !$mode || $mode ne 'd';
31 die("filter mode not supported\n") unless @ARGV;
33 for my $file (@ARGV) {
35 open(F, '<', $file) || die("$file: $!\n");
37 1 while sysread(F, $buf, 16384, length($buf));
38 close(F) || die("$file: $!\n");
39 my $block = "sIGnMe!\n";
40 $block .= sprintf("%08x%08x\n", length($buf), unpack("%32C*", $buf));
41 $block .= "\0" x (2048 - length($block));
42 open(F, '>', "$file.asc") || die("$file.asc: $!\n");
43 (syswrite(F, $block) || 0) == 2048 || die("$file.asc: $!\n");
44 close(F) || die("$file.asc: $!\n");