mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-09-22 04:29:01 +00:00
Compare commits
3 Commits
d2c96631ac
...
630b589f80
Author | SHA1 | Date | |
---|---|---|---|
|
630b589f80 | ||
|
1d9a6bf8b0 | ||
|
901a79f0ec |
@ -20,6 +20,7 @@ namespace phpseclib3\Crypt\Common\Formats\Keys;
|
|||||||
use phpseclib3\Common\Functions\Strings;
|
use phpseclib3\Common\Functions\Strings;
|
||||||
use phpseclib3\Crypt\AES;
|
use phpseclib3\Crypt\AES;
|
||||||
use phpseclib3\Crypt\Random;
|
use phpseclib3\Crypt\Random;
|
||||||
|
use phpseclib3\Exception\BadDecryptionException;
|
||||||
use phpseclib3\Exception\RuntimeException;
|
use phpseclib3\Exception\RuntimeException;
|
||||||
use phpseclib3\Exception\UnexpectedValueException;
|
use phpseclib3\Exception\UnexpectedValueException;
|
||||||
|
|
||||||
@ -97,7 +98,7 @@ abstract class OpenSSH
|
|||||||
$crypto->setPassword($password, 'bcrypt', $salt, $rounds, 32);
|
$crypto->setPassword($password, 'bcrypt', $salt, $rounds, 32);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException('The only supported cipherse are: none, aes256-ctr (' . $ciphername . ' is being used)');
|
throw new RuntimeException('The only supported ciphers are: none, aes256-ctr (' . $ciphername . ' is being used)');
|
||||||
}
|
}
|
||||||
|
|
||||||
[$publicKey, $paddedKey] = Strings::unpackSSH2('ss', $key);
|
[$publicKey, $paddedKey] = Strings::unpackSSH2('ss', $key);
|
||||||
@ -108,7 +109,10 @@ abstract class OpenSSH
|
|||||||
[$checkint1, $checkint2] = Strings::unpackSSH2('NN', $paddedKey);
|
[$checkint1, $checkint2] = Strings::unpackSSH2('NN', $paddedKey);
|
||||||
// any leftover bytes in $paddedKey are for padding? but they should be sequential bytes. eg. 1, 2, 3, etc.
|
// any leftover bytes in $paddedKey are for padding? but they should be sequential bytes. eg. 1, 2, 3, etc.
|
||||||
if ($checkint1 != $checkint2) {
|
if ($checkint1 != $checkint2) {
|
||||||
throw new RuntimeException('The two checkints do not match');
|
if (isset($crypto)) {
|
||||||
|
throw new BadDecryptionException('Unable to decrypt key - please verify the password you are using');
|
||||||
|
}
|
||||||
|
throw new RuntimeException("The two checkints do not match ($checkint1 vs. $checkint2)");
|
||||||
}
|
}
|
||||||
self::checkType($type);
|
self::checkType($type);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user