diff options
-rw-r--r-- | include/libssh/libssh.h | 2 | ||||
-rw-r--r-- | src/session.c | 32 |
2 files changed, 34 insertions, 0 deletions
diff --git a/include/libssh/libssh.h b/include/libssh/libssh.h index b3f6ae4b..412215bf 100644 --- a/include/libssh/libssh.h +++ b/include/libssh/libssh.h @@ -628,6 +628,8 @@ LIBSSH_API int ssh_event_remove_session(ssh_event event, ssh_session session); LIBSSH_API void ssh_event_free(ssh_event event); LIBSSH_API const char* ssh_get_clientbanner(ssh_session session); LIBSSH_API const char* ssh_get_serverbanner(ssh_session session); +LIBSSH_API const char* ssh_get_cipher_in(ssh_session session); +LIBSSH_API const char* ssh_get_cipher_out(ssh_session session); #ifndef LIBSSH_LEGACY_0_4 #include "libssh/legacy.h" diff --git a/src/session.c b/src/session.c index 4d63a19d..01b540f6 100644 --- a/src/session.c +++ b/src/session.c @@ -310,6 +310,38 @@ const char* ssh_get_serverbanner(ssh_session session) { } /** + * @brief get the name of the input for the given session. + * + * @param[in] session The SSH session. + * + * @return Returns cipher name or NULL. + */ +const char* ssh_get_cipher_in(ssh_session session) { + if ((session != NULL) && + (session->current_crypto != NULL) && + (session->current_crypto->in_cipher != NULL)) { + return session->current_crypto->in_cipher->name; + } + return NULL; +} + +/** + * @brief get the name of the output cipher for the given session. + * + * @param[in] session The SSH session. + * + * @return Returns cipher name or NULL. + */ +const char* ssh_get_cipher_out(ssh_session session) { + if ((session != NULL) && + (session->current_crypto != NULL) && + (session->current_crypto->out_cipher != NULL)) { + return session->current_crypto->out_cipher->name; + } + return NULL; +} + +/** * @brief Disconnect impolitely from a remote host by closing the socket. * * Suitable if you forked and want to destroy this session. |