This is an automated email from the git hooks/post-receive script. x2go pushed a commit to branch bugfix/osx in repository x2goclient. commit 4f26db0343a491d73fa689a1127802733d3ace58 Author: Mihai Moldovan <ionic@ionic.de> Date: Sat Sep 24 04:17:05 2016 +0200 src/onmainwindow.{cpp,h}: add new function default_size_for_key_type (). Returns the default key size in bits for the selected key type, after checking for validity. --- debian/changelog | 3 +++ src/onmainwindow.cpp | 25 +++++++++++++++++++++++++ src/onmainwindow.h | 1 + 3 files changed, 29 insertions(+) diff --git a/debian/changelog b/debian/changelog index 352e184..cd6e81a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -438,6 +438,9 @@ x2goclient (4.0.5.3-0x2go1) UNRELEASED; urgency=medium - src/onmainwindow.{cpp,h}: add new function key_type_to_string (). Returns a stringified version of the selected key type, after checking for validity. + - src/onmainwindow.{cpp,h}: add new function default_size_for_key_type (). + Returns the default key size in bits for the selected key type, after + checking for validity. [ Bernard Cafarelli ] * New upstream version (4.0.5.3): diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index daff8fb..419de3f 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -10332,6 +10332,31 @@ QString ONMainWindow::key_type_to_string (ONMainWindow::key_types key_type) { return (ret); } +std::size_t ONMainWindow::default_size_for_key_type (ONMainWindow::key_types key_type) { + ONMainWindow::key_types sanitized_key_type = check_key_type (key_type); + std::size_t ret = 0; + + switch (sanitized_key_type) { + case RSA_KEY_TYPE: + ret = 4096; + break; + case DSA_KEY_TYPE: + ret = 1024; + break; + case ECDSA_KEY_TYPE: + ret = 384; + break; + case ED25519_KEY_TYPE: + /* Fixed key length, flag will be unused. */ + ret = 0; + break; + default: + ret = 0; + } + + return (ret); +} + QString ONMainWindow::generateKey(ONMainWindow::key_types key_type, bool host_key) { ONMainWindow::key_types sanitized_key_type = UNKNOWN_KEY_TYPE; diff --git a/src/onmainwindow.h b/src/onmainwindow.h index 0d3fb49..bf4ed80 100644 --- a/src/onmainwindow.h +++ b/src/onmainwindow.h @@ -1220,6 +1220,7 @@ private: key_types check_key_type (key_types key_type); QString key_type_to_string (key_types key_type); + std::size_t default_size_for_key_type (key_types key_type); ////////////////plugin stuff//////////////////// #ifdef CFGPLUGIN -- Alioth's /srv/git/code.x2go.org/x2goclient.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient.git