From 20184b7c861e1aaa6567ba74063c61cc05c6c7ce Mon Sep 17 00:00:00 2001 From: Artyom Poptsov Date: Sat, 31 May 2014 18:10:08 +0400 Subject: Use new libssh 0.6 API for handling of public key fingerprints Use new libssh 0.6 API for handling of public key fingerprints. Update TCs and documentation. * examples/sssh.scm.in (main): Update. * examples/echo/client.scm.in (main): Update. * ssh/session-func.c (guile_ssh_get_server_public_key): New procedure. (guile_ssh_get_public_key_hash): Change arguments. Move to `ssh/key-func.c'. All callers updated. * ssh/session.scm (bytevector->hex-string): Move to `ssh/key.scm'. (get-server-public-key): New procedure. * ssh/key-func.c (guile_ssh_get_public_key_hash): New procedure. * ssh/key.scm (get-public-key-hash, bytevector->hex-string): New procedures. * tests/client-server.scm ("get-public-key-hash"): Check md5 and sha1 fingerprints. * doc/api-sessions.texi (Sessions): Add documentation for `get-server-public-key'. Move `get-public-key-hash', `bytevector->hex-string' to `doc/api-keys.texi'. * doc/api-keys.texi (Keys): Update. * NEWS: Update. --- doc/api-keys.texi | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'doc/api-keys.texi') diff --git a/doc/api-keys.texi b/doc/api-keys.texi index 62f9ccf..c3e1580 100644 --- a/doc/api-keys.texi +++ b/doc/api-keys.texi @@ -52,6 +52,42 @@ Get a symbol that represents the type of the Guile-SSH @var{key}. Possible types are: @code{dss}, @code{rsa}, @code{rsa1}, @code{unknown}. @end deffn +@deffn {Scheme Procedure} get-public-key-hash public-key type +@cindex fingerprint +@tindex fingerprint +Get a @var{public-key} hash of @var{type} as a bytevector. Return the +bytevector on success, @code{#f} on error. + +See also @code{get-server-public-key} in @pxref{Sessions}. + +The @var{type} can be one of the following symbols: @code{md5}, +@code{sha1}. + +Example: + +@lisp +(let ((pubkey (get-server-public-key session))) + (get-public-key-hash pubkey 'md5)) +@result{} #vu8(15 142 110 203 162 228 250 211 20 212 26 217 118 57 217 66) +@end lisp + +@end deffn + +@deffn {Scheme Procedure} bytevector->hex-string bv +@cindex fingerprint +@tindex fingerprint +Convert the given bytevector @var{bv} to a colon separated string. + +Example: + +@lisp +(let ((hash (get-public-key-hash pubkey 'md5))) + (bytevector->hex-string hash)) +@result{} "0f:8e:6e:cb:a2:e4:fa:d3:14:d4:1a:d9:76:39:d9:42" +@end lisp + +@end deffn + @c Local Variables: @c TeX-master: "guile-ssh.texi" @c End: -- cgit v1.2.3