forked from pool/suse-build-key
Marcus Meissner
be84b3b4d8
- extend the build@suse.de product key. (bsc#1014151) pub 2048R/39DB7C82 2013-01-31 [expires: 2020-12-06] uid SuSE Package Signing Key <build@suse.de> - use dumpsigs script from openSUSE to merge code - renamed security_at_suse_de.asc to security_at_suse_de_old.asc - security_at_suse_de.asc: new 4096 bit RSA key. pub 4096R/317CD502 2014-10-02 SUSE Security Team <security@suse.de> bnc#899509 - create suse-build-key.gpg during build. - Remove old keys from keyring. (fate#314767) Keys currently inside the RPM trusted keyring: - pub 2048R/39DB7C82 SuSE Package Signing Key <build@suse.de> - pub 2048R/50A3DD1C SuSE Package Signing Key (reserve key) <build@suse.de> - Various keys are moved to the documentation area (/usr/share/doc/packages/suse-build-key) - build-at-suse-sle11.asc: the old SUSE Linux Enterprise 11 key. if SUSE Linux Enterprise 11 packages need to be verified on a SUSE Linux Enterprise 12 system. - suse_ptf_key.asc: The suse ptf key. For verification of provided PTFs. - security_at_suse_de.asc: Use only for email encryption and verification purposes when contacting our security contact address security@suse.de OBS-URL: https://build.opensuse.org/request/show/518537 OBS-URL: https://build.opensuse.org/package/show/Base:System/suse-build-key?expand=0&rev=26
93 lines
1.9 KiB
Perl
93 lines
1.9 KiB
Perl
#!/usr/bin/perl -w
|
|
# dump all keys contained in the keyring specified as argument
|
|
|
|
use strict;
|
|
|
|
my @keyring;
|
|
|
|
die "must specify keyring\n" unless @ARGV;
|
|
|
|
my $file = shift @ARGV;
|
|
unless ($file =~ /^\//) {
|
|
use Cwd qw/abs_path/;
|
|
$file = abs_path($file);
|
|
}
|
|
|
|
# XXX: workaround for colons in obs project names o_O
|
|
if ($file =~ /:/) {
|
|
use File::Temp qw/tempdir/;
|
|
my $tmpdir = tempdir( CLEANUP => 1);
|
|
my $nn = $file;
|
|
$nn =~ s/.*\///;
|
|
$nn = $tmpdir.'/'.$nn;
|
|
symlink($file, $nn) or die "failed to symlink: $!\n";
|
|
$file = $nn;
|
|
}
|
|
|
|
@keyring = ('--no-default-keyring', '--keyring='.$file);
|
|
|
|
my @line;
|
|
my $ver;
|
|
my $rel;
|
|
my $name;
|
|
my %names;
|
|
|
|
my @cmd = qw/--no-secmem-warning --no-options --list-sigs --list-options show-keyring --fixed-list-mode --with-colons/;
|
|
unshift @cmd, @keyring;
|
|
unshift @cmd, 'gpg';
|
|
#print join(' ', @cmd), "\n";
|
|
|
|
open(GPG, '-|', @cmd);
|
|
while (<GPG>) {
|
|
chomp;
|
|
next unless /^pub:/;
|
|
@line = split(':', $_);
|
|
my $id = $line[4];
|
|
$_ = <GPG>;
|
|
$_ = <GPG> if /^fpr:/;
|
|
chomp;
|
|
next unless /^uid:/;
|
|
@line = split(':', $_);
|
|
$name = $line[9];
|
|
while (1) {
|
|
$_ = <GPG>;
|
|
chomp;
|
|
next unless /^sig:/;
|
|
@line = split(':', $_);
|
|
next if $line[4] ne $id;
|
|
$ver = lc($id);
|
|
$ver =~ s/.*(........)$/$1/;
|
|
$rel = sprintf("%08x", $line[5]);
|
|
last;
|
|
}
|
|
$names{"gpg-pubkey-$ver-$rel"} = [ $id, $name ];
|
|
}
|
|
close GPG;
|
|
my $n;
|
|
|
|
for $n (sort keys %names) {
|
|
@cmd = qw/--no-options --no-secmem-warning --export-options export-minimal --export -a/;
|
|
push @cmd, $names{$n}[0];
|
|
unshift @cmd, @keyring;
|
|
unshift @cmd, 'gpg';
|
|
my $fn = $n.".asc";
|
|
unless (open(O, '>', $fn)) {
|
|
warn "failed to open $fn: $!";
|
|
next;
|
|
}
|
|
printf O "%s %s\n\n", $names{$n}[0], $names{$n}[1];
|
|
print "writing $fn\n";
|
|
#print join(' ', @cmd), "\n";
|
|
unless (open(GPG, '-|', @cmd)) {
|
|
warn "failed to exec gpg: $!";
|
|
close O;
|
|
unlink $fn;
|
|
next;
|
|
}
|
|
while(<GPG>) {
|
|
print O;
|
|
}
|
|
close GPG;
|
|
close O;
|
|
}
|