forked from paramiko/paramiko
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -341,6 +341,8 @@ def _finalize_pubkey_algorithm(self, key_type): | |
DEBUG, | ||
"NOTE: you may use the 'disabled_algorithms' SSHClient/Transport init kwarg to disable that or other algorithms if your server does not support them!", # noqa | ||
) | ||
if key_type.endswith("[email protected]"): | ||
pubkey_algo += "[email protected]" | ||
self.transport._agreed_pubkey_algorithm = pubkey_algo | ||
return pubkey_algo | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -129,7 +129,7 @@ def sign_ssh_data(self, data, algorithm="ssh-rsa"): | |
algorithm=self.HASHES[algorithm](), | ||
) | ||
m = Message() | ||
m.add_string(algorithm) | ||
m.add_string(algorithm.replace("[email protected]", "")) | ||
m.add_string(sig) | ||
return m | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -754,3 +754,22 @@ def test_new_keyfiles_avoid_descriptor_race_integration(self): | |
finally: | ||
if os.path.exists(new): | ||
os.unlink(new) | ||
|
||
def test_sign_rsa_with_certificate(self): | ||
data = b"ice weasels" | ||
key_path = _support(os.path.join("cert_support", "test_rsa.key")) | ||
key = RSAKey.from_private_key_file(key_path) | ||
msg = key.sign_ssh_data(data, "rsa-sha2-256") | ||
msg.rewind() | ||
assert "rsa-sha2-256" == msg.get_text() | ||
sign = msg.get_binary() | ||
cert_path = _support( | ||
os.path.join("cert_support", "test_rsa.key-cert.pub") | ||
) | ||
key.load_certificate(cert_path) | ||
msg = key.sign_ssh_data(data, "[email protected]") | ||
msg.rewind() | ||
assert "rsa-sha2-256" == msg.get_text() | ||
assert sign == msg.get_binary() | ||
msg.rewind() | ||
assert key.verify_ssh_sig(b"ice weasels", msg) |