-# Queries a remote keyserver (using a proxy if requested) and returns
-# the keyservers anser. No module is used deliberatly to make this
-# script run on as many systems as possible.
-
-sub fetchIt($$$$) {
- my $server = shift;
- my $port = shift;
- my $requestURL = shift;
- my $honorproxy = shift;
-
- my $result;
- my $remote;
-
- if ($honorproxy && defined $ENV{'http_proxy'}) {
- my $proxyserver;
- my $proxyport;
-
- if ( $ENV{'http_proxy'} =~ m#^http://(\S+):(\d+)/?$# ) {
- $proxyserver = $1;
- $proxyport = $2;
- } elsif ( $ENV{'http_proxy'} =~ m#^http://(\S+)/?$# ) {
- $proxyserver = $1;
- $proxyport = $PROXY_PORT;
- } else {
- die ("Unkown http_proxy format");
- };
-
- $remote = IO::Socket::INET->new(
- Proto => 'tcp',
- PeerAddr => $proxyserver,
- PeerPort => $proxyport
- ) || die ("Cannot connect to prox: $!");
-
- my $URL=sprintf("http://%s:%s%s/", $server, $port, $requestURL);
- printf $remote "GET %s HTTP/1.1\n\n", $URL;
- } else {
- $remote = IO::Socket::INET->new(
- Proto => 'tcp',
- PeerAddr => $server,
- PeerPort => $port
- ) || die ("Cannot connect to keysever: $!");
-
- printf $remote "GET %s HTTP/1.1\nHost: %s\n\n\n", $requestURL, $server;
- };
-
-
- {
- local $/;
- $/=undef;
- $result = <$remote>;
- };
- return $result;
-};
+# Maps algorithm numbers to algorithm types as defined in RFC 2400.
+my %ALGOS = (
+ 1 => 'R', # RSA
+ 2 => 'r', # RSA encrypt only (deprecated)
+ 3 => 's', # RSA sign only (deprecated)
+ 16 => 'g', # ElGamal encrypt only
+ 20 => 'g', # ElGamal sign and encrypt (all OpenPGP implementations cryptographically broken, do not use. no longer part of OpenPGP)
+ 17 => 'D' # DSA
+ );