2012 2013 Ericsson AB, All Rights Reserved The contents of this file are subject to the Erlang Public License, Version 1.1, (the "License"); you may not use this file except in compliance with the License. You should have received a copy of the Erlang Public License along with this software. If not, it can be retrieved online at http://www.erlang.org/. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Initial Developer of the Original Code is Ericsson AB. ssh_client_key_api
ssh_client_key_api -behaviour(ssh_client_key_api).

Behavior describing the API for an SSH client's public key handling. By implementing the callbacks defined. in this behavior it is possible to customize the SSH client's public key handling. By default the SSH application implements this behavior with help of the standard openssh files, see ssh(6).

DATA TYPES

Type definitions that are used more than once in this module and/or abstractions to indicate the intended use of the data type:

boolean() = true | false

string() = [byte()]

public_key() = #'RSAPublicKey'{}| {integer(), #'Dss-Parms'{}}| term()

private_key() = #'RSAPublicKey'{}| {integer(), #'Dss-Parms'{}}| term()

public_key_algorithm() = 'ssh-rsa'| 'ssh-dss' | atom()

Module:add_host_key(HostNames, Key, ConnectOptions) -> ok | {error, Reason} Adds a host key to the set of trusted host keys HostNames = string() Description of the host that owns the PublicKey Key = public_key() Normally an RSA or DSA public key but handling of other public keys can be added ConnectOptions = proplists:proplist() Options provided to ssh:connect/[3,4] Reason = term()

Adds a host key to the set of trusted host keys

Module:is_host_key(Key, Host, Algorithm, ConnectOptions) -> Result Checks if a host key is trusted Key = public_key() Normally an RSA or DSA public key but handling of other public keys can be added Host = string() Description of the host Algorithm = public_key_algorithm() Host key algorithm. Should support 'ssh-rsa'| 'ssh-dss' but additional algorithms can be handled. ConnectOptions = proplists:proplist() Options provided to ssh:connect/[3,4] Result = boolean()

Checks if a host key is trusted

Module:user_key(Algorithm, ConnectOptions) -> {ok, PrivateKey} | {error, Reason} Fetches the users "public key" matching the Algorithm. Algorithm = public_key_algorithm() Host key algorithm. Should support 'ssh-rsa'| 'ssh-dss' but additional algorithms can be handled. ConnectOptions = proplists:proplist() Options provided to ssh:connect/[3,4] PrivateKey = private_key() The private key of the user matching the Algorithm Reason = term()

Fetches the users "public key" matching the Algorithm.

The private key contains the public key