diff options
author | Ingela Anderton Andin <[email protected]> | 2012-02-06 11:23:53 +0100 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2012-02-10 15:34:28 +0100 |
commit | f5f4a7015569dd5bbd7114d89a370ea1bed09023 (patch) | |
tree | 9f7206379482af18d681246739623df97eefbe47 /lib/ssh/src/ssh.erl | |
parent | c957dbd73a69a34662c9fdfb45edaa53cb089c45 (diff) | |
download | otp-f5f4a7015569dd5bbd7114d89a370ea1bed09023.tar.gz otp-f5f4a7015569dd5bbd7114d89a370ea1bed09023.tar.bz2 otp-f5f4a7015569dd5bbd7114d89a370ea1bed09023.zip |
Cleaned up code so that ssh_file can become a template for a documented
ssh_keys behavior
Diffstat (limited to 'lib/ssh/src/ssh.erl')
-rw-r--r-- | lib/ssh/src/ssh.erl | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl index 29294b836f..eec17fd5d6 100644 --- a/lib/ssh/src/ssh.erl +++ b/lib/ssh/src/ssh.erl @@ -23,6 +23,7 @@ -include("ssh.hrl"). -include("ssh_connect.hrl"). +-include_lib("public_key/include/public_key.hrl"). -export([start/0, start/1, stop/0, connect/3, connect/4, close/1, connection_info/2, channel_info/3, @@ -367,7 +368,7 @@ inetopt(false) -> %% Description: Use SSH key to sign data. %%-------------------------------------------------------------------- sign_data(Data, Algorithm) when is_binary(Data) -> - case ssh_file:private_identity_key(Algorithm,[]) of + case ssh_file:user_key(Algorithm,[]) of {ok, Key} when Algorithm == "ssh-rsa" -> public_key:sign(Data, sha, Key); Error -> @@ -385,9 +386,9 @@ sign_data(Data, Algorithm) when is_binary(Data) -> %% Description: Use SSH signature to verify data. %%-------------------------------------------------------------------- verify_data(Data, Signature, Algorithm) when is_binary(Data), is_binary(Signature) -> - case ssh_file:public_identity_key(Algorithm, []) of - {ok, Key} when Algorithm == "ssh-rsa" -> - public_key:verify(Data, sha, Signature, Key); + case ssh_file:user_key(Algorithm, []) of + {ok, #'RSAPrivateKey'{publicExponent = E, modulus = N}} when Algorithm == "ssh-rsa" -> + public_key:verify(Data, sha, Signature, #'RSAPublicKey'{publicExponent = E, modulus = N}); Error -> Error end. |