diff options
| -rw-r--r-- | NEWS | 6 | ||||
| -rw-r--r-- | doc/api-keys.texi | 4 | ||||
| -rw-r--r-- | libguile-ssh/key-func.c | 11 | ||||
| -rw-r--r-- | libguile-ssh/key-type.c | 9 | ||||
| -rw-r--r-- | libguile-ssh/key-type.h | 2 | ||||
| -rw-r--r-- | modules/ssh/key.scm | 33 | ||||
| -rw-r--r-- | tests/key.scm | 3 |
7 files changed, 46 insertions, 22 deletions
@@ -7,6 +7,12 @@ Copyright (C) Artyom V. Poptsov <poptsov.artyom@gmail.com> are permitted in any medium without royalty provided the copyright notice and this notice are preserved. +* Unreleased +** Deprecation +*** In (ssh key) + - 'get-key-type' (use 'key-type' instead) + - 'get-public-key-hash' (use 'public-key-hash' instead) + * Changes in version 0.10.2 (2016-11-25) ** New procedures *** New procedure 'channel-send-eof' in (ssh channel) diff --git a/doc/api-keys.texi b/doc/api-keys.texi index c718dbd..722e012 100644 --- a/doc/api-keys.texi +++ b/doc/api-keys.texi @@ -77,12 +77,12 @@ Read public key from a @var{file}. Return a public key or @code{#f} on error. @end deffn -@deffn {Scheme Procedure} get-key-type key +@deffn {Scheme Procedure} key-type key 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 +@deffn {Scheme Procedure} public-key-hash public-key type @cindex fingerprint @tindex fingerprint Get a @var{public-key} hash of @var{type} as a bytevector. Return the diff --git a/libguile-ssh/key-func.c b/libguile-ssh/key-func.c index cfb3026..0a00c21 100644 --- a/libguile-ssh/key-func.c +++ b/libguile-ssh/key-func.c @@ -242,14 +242,9 @@ static struct symbol_mapping hash_types[] = { { NULL, -1 } }; -SCM_DEFINE (guile_ssh_get_public_key_hash, "get-public-key-hash", 2, 0, 0, - (SCM key, SCM type), - "\ -Get hash of the public KEY as a bytevector.\n\ -Possible types are: 'sha1, 'md5\n\ -Return a bytevector on success, #f on error.\ -") -#define FUNC_NAME s_guile_ssh_get_public_key_hash +SCM_GSSH_DEFINE (gssh_public_key_hash, "%gssh-public-key-hash", 2, + (SCM key, SCM type)) +#define FUNC_NAME s_gssh_public_key_hash { struct key_data *kd = _scm_to_key_data (key); unsigned char *hash = NULL; diff --git a/libguile-ssh/key-type.c b/libguile-ssh/key-type.c index 058ed06..acbec59 100644 --- a/libguile-ssh/key-type.c +++ b/libguile-ssh/key-type.c @@ -75,7 +75,7 @@ static int print_key (SCM smob, SCM port, scm_print_state *pstate) { struct key_data *key_data = _scm_to_key_data (smob); - SCM type = guile_ssh_key_get_type (smob); + SCM type = gssh_key_type (smob); scm_puts ("#<key ", port); scm_display (type, port); @@ -108,12 +108,7 @@ _scm_to_ssh_key_type (SCM type) Return a key type as a Scheme symbol. The type can be one of the following list: 'dss, 'rsa, 'rsa1, 'unknown */ -SCM_DEFINE (guile_ssh_key_get_type, "get-key-type", 1, 0, 0, - (SCM key), - "\ -Get a symbol that represents the type of the SSH key KEY.\n\ -Possible types are: 'dss, 'rsa, 'rsa1, 'ecdsa, 'unknown\ -") +SCM_GSSH_DEFINE (gssh_key_type, "%gssh-key-type", 1, (SCM key)) { struct key_data *data = _scm_to_key_data (key); enum ssh_keytypes_e type = ssh_key_type (data->ssh_key); diff --git a/libguile-ssh/key-type.h b/libguile-ssh/key-type.h index b3e1f68..46d0c33 100644 --- a/libguile-ssh/key-type.h +++ b/libguile-ssh/key-type.h @@ -41,7 +41,7 @@ extern SCM guile_ssh_is_key_p (SCM arg1); extern SCM guile_ssh_is_public_key_p (SCM arg1); extern SCM guile_ssh_is_private_key_p (SCM arg1); -extern SCM guile_ssh_key_get_type (SCM arg1); +extern SCM gssh_key_type (SCM arg1); extern void init_key_type (void); diff --git a/modules/ssh/key.scm b/modules/ssh/key.scm index 450c4ce..7146488 100644 --- a/modules/ssh/key.scm +++ b/modules/ssh/key.scm @@ -28,14 +28,14 @@ ;; public-key? ;; private-key? ;; make-keypair -;; get-key-type +;; key-type ;; public-key->string ;; string->pubilc-key ;; public-key-from-file ;; private-key->public-key ;; private-key-from-file ;; private-key-to-file -;; get-public-key-hash +;; public-key-hash ;; bytevector->hex-string @@ -50,14 +50,16 @@ public-key? private-key? make-keypair - get-key-type + key-type + get-key-type ; deprecated public-key->string string->public-key public-key-from-file private-key->public-key private-key-from-file private-key-to-file - get-public-key-hash + public-key-hash + get-public-key-hash ; deprecated bytevector->hex-string)) (define (bytevector->hex-string bv) @@ -66,6 +68,29 @@ (bytevector->u8-list bv)) ":")) + +(define (key-type key) + "Get a symbol that represents the type of the SSH key KEY. +Possible types are: 'dss, 'rsa, 'rsa1, 'ecdsa, 'unknown" + (%gssh-key-type key)) + +(define (get-key-type key) + (issue-deprecation-warning "'get-key-type' is deprecated. " + "Use 'key-type' instead.'") + (%gssh-key-type key)) + + +(define (public-key-hash key type) + "Get hash of the public KEY as a bytevector. Possible types are: 'sha1, +'md5. Return a bytevector on success, #f on error." + (%gssh-public-key-hash key type)) + +(define (get-public-key-hash key type) + (issue-deprecation-warning "'get-public-key-hash' is deprecated. " + "Use 'public-key-hash' instead.'") + (%gssh-public-key-hash key type)) + + (load-extension "libguile-ssh" "init_key") ;;; key.scm ends here. diff --git a/tests/key.scm b/tests/key.scm index c4394b1..4c91a2c 100644 --- a/tests/key.scm +++ b/tests/key.scm @@ -164,6 +164,9 @@ (and (key? key) (eq? (get-key-type key) 'ecdsa)))))) +(test-assert-with-log "public-key-hash" + (public-key-hash (make-keypair 'rsa 128) 'sha1)) + ;;; (test-end "key") |
