]> Dogcows Code - chaz/groupsecret/blobdiff - lib/App/GroupSecret/File.pm
allow finding symlink pubkeys
[chaz/groupsecret] / lib / App / GroupSecret / File.pm
index 956b6f9cc9d8d7b23d72cea79c22f1169df5c443..4be3e5cb8ba04085fb56da420603a3e77d79c53e 100644 (file)
@@ -290,6 +290,8 @@ sub decrypt_secret_passphrase {
     my $self        = shift;
     my $private_key = shift or _usage(q{$file->decrypt_secret_passphrase($private_key)});
 
+    die "Private key '$private_key' not found.\n" unless -e $private_key && !-d $private_key;
+
     my $info = read_openssh_key_fingerprint($private_key);
     my $fingerprint = $info->{fingerprint};
 
@@ -298,7 +300,7 @@ sub decrypt_secret_passphrase {
         return decrypt_rsa(\$key->{secret_passphrase}, $private_key);
     }
 
-    die "The private key ($private_key) is not able to decrypt the keyfile.\n";
+    die "Private key '$private_key' not able to decrypt the keyfile.\n";
 }
 
 =method encrypt_secret
@@ -363,7 +365,7 @@ sub find_public_key {
         my @dirs = split(/:/, $ENV{GROUPSECRET_PATH} || ".:keys:$ENV{HOME}/.ssh");
         for my $dir (@dirs) {
             my $filepath = File::Spec->catfile($dir, $key->{filename});
-            return $filepath if -f $filepath;
+            return $filepath if -e $filepath && !-d $filepath;
         }
     }
 }
This page took 0.019198 seconds and 4 git commands to generate.