Skip to content

Commit

Permalink
Added checking on private key format, only munge if header and traile…
Browse files Browse the repository at this point in the history
…r aren't already there
  • Loading branch information
Jeff Schilling committed Jan 12, 2010
1 parent 84f9a8c commit f290ec6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion version-new.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ function sign_file($filename, $keydata)
file_put_contents($tmp_file, $binary_hash);

$key_tmp_file = tempnam('/tmp', 'bar');
file_put_contents($key_tmp_file, "-----BEGIN DSA PRIVATE KEY-----\n" . $keydata . "\n-----END DSA PRIVATE KEY-----\n");
if (strpos($keydata,"-----BEGIN DSA PRIVATE KEY-----\n") != 0)
$keydata = "-----BEGIN DSA PRIVATE KEY-----\n" . $keydata . "\n-----END DSA PRIVATE KEY-----\n";
file_put_contents($key_tmp_file, $keydata);

$signed_data = shell_exec("openssl dgst -dss1 -sign $key_tmp_file < $hash_tmp_file");

Expand Down

0 comments on commit f290ec6

Please sign in to comment.