Remmina - The GTK+ Remote Desktop Client  v1.4.34
Remmina is a remote desktop client written in GTK+, aiming to be useful for system administrators and travellers, who need to work with lots of remote computers in front of either large monitors or tiny netbooks. Remmina supports multiple network protocols in an integrated and consistent user interface. Currently RDP, VNC, NX, XDMCP and SSH are supported.
remmina_utils.h
Go to the documentation of this file.
1 /*
2  * Remmina - The GTK+ Remote Desktop Client
3  * Copyright (C) 2016-2023 Antenore Gatta, Giovanni Panozzo
4  * Copyright (C) 2023-2024 Hiroyuki Tanaka, Sunil Bhat
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  * In addition, as a special exception, the copyright holders give
22  * permission to link the code of portions of this program with the
23  * OpenSSL library under certain conditions as described in each
24  * individual source file, and distribute linked combinations
25  * including the two.
26  * You must obey the GNU General Public License in all respects
27  * for all of the code used other than OpenSSL. * If you modify
28  * file(s) with this exception, you may extend this exception to your
29  * version of the file(s), but you are not obligated to do so. * If you
30  * do not wish to do so, delete this exception statement from your
31  * version. * If you delete this exception statement from all source
32  * files in the program, then also delete it here.
33  *
34  */
35 
41 #pragma once
42 
43 #include <glib.h>
44 #include <gio/gio.h>
45 #include <openssl/rsa.h>
46 #include <openssl/evp.h>
47 #include <openssl/decoder.h>
48 
49 #define MAX_COMPRESSED_FILE_SIZE 100000 //100kb file size max
50 #define NAME_OF_DIGEST "SHA256"
51 #define RSA_KEYTYPE "RSA"
52 
53 extern const char *remmina_RSA_PubKey_v1;
54 extern const char *remmina_RSA_PubKey_v2;
55 extern const char *remmina_EC_PubKey;
56 G_BEGIN_DECLS
57 gint remmina_utils_string_find(GString *haystack, gint start, gint end, const gchar *needle);
58 gint remmina_utils_string_replace(GString *str, gint pos, gint len, const gchar *replace);
59 
60 guint remmina_utils_string_replace_all(GString *haystack, const gchar *needle, const gchar *replace);
61 gchar *remmina_utils_string_strip(const gchar *s);
62 
63 gchar *remmina_utils_get_lang();
71 GHashTable *remmina_utils_get_etc_release();
72 gchar *remmina_utils_get_dev();
74 gchar *remmina_utils_get_link();
76 gchar *remmina_utils_get_mage();
77 gchar *remmina_sha256_buffer(const guchar *buffer, gssize length);
78 gchar *remmina_sha1_file(const gchar *filename);
80 EVP_PKEY *remmina_get_pubkey(const char *keytype, const char *public_key_selection);
81 gchar *remmina_rsa_encrypt_string(EVP_PKEY *pubkey, const char *instr);
82 int remmina_decompress_from_memory_to_file(guchar *source, int len, GFile* plugin_file);
83 int remmina_compress_from_file_to_file(GFile *source, GFile *dest);
84 gboolean remmina_verify_plugin_signature(const guchar *signature, GFile* plugin_file, size_t message_length, size_t signature_length);
85 gboolean remmina_execute_plugin_signature_verification(GFile* plugin_file, size_t msg_len, const guchar *sig, size_t sig_len, EVP_PKEY* public_key);
86 G_END_DECLS
gchar * remmina_utils_get_logical()
Print address associated with default route.
gchar * remmina_utils_get_lang()
Return the current language defined in the LC_ALL.
int remmina_compress_from_file_to_file(GFile *source, GFile *dest)
Compresses file @source to file @dest.
int remmina_decompress_from_memory_to_file(guchar *source, int len, GFile *plugin_file)
Decompresses pointer @source with length @len to file pointed to by @plugin_file.
EVP_PKEY * remmina_get_pubkey(const char *keytype, const char *public_key_selection)
Uses OSSL_DECODER_CTX to convert public key string to usable OpenSSL structs.
gboolean remmina_verify_plugin_signature(const guchar *signature, GFile *plugin_file, size_t message_length, size_t signature_length)
Attempts to verify the contents of plugin_file with base64 encoded signature.
gchar * remmina_utils_get_lsb_codename()
Print the Distribution codename as specified by the lsb_release command.
G_BEGIN_DECLS gint remmina_utils_string_find(GString *haystack, gint start, gint end, const gchar *needle)
gchar * remmina_gen_random_uuid()
Generate a random sting of chars to be used as part of UID for news or stats.
GHashTable * remmina_utils_get_etc_release()
Print the distribution description if found.
gchar * remmina_utils_get_lsb_release()
Print the Distribution release name as specified by the lsb_release command.
gchar * remmina_utils_get_kernel_name()
Return the OS name as in "uname -s".
const char * remmina_EC_PubKey
gchar * remmina_sha256_buffer(const guchar *buffer, gssize length)
Create a hexadecimal string version of the SHA-256 digest of the buffer.
gchar * remmina_utils_get_link()
Print link associated with default route.
gchar * remmina_rsa_encrypt_string(EVP_PKEY *pubkey, const char *instr)
Calls EVP_PKEY_encrypt multiple times to encrypt instr.
gchar * remmina_utils_get_python()
Print python version.
gint remmina_utils_string_replace(GString *str, gint pos, gint len, const gchar *replace)
gchar * remmina_utils_get_lsb_id()
Print the Distributor as specified by the lsb_release command.
gchar * remmina_utils_get_kernel_arch()
Return the machine hardware name as in "uname -m".
const char * remmina_RSA_PubKey_v2
gchar * remmina_utils_get_dev()
Print device associated with default route.
gchar * remmina_utils_get_lsb_description()
Print the Distribution description as specified by the lsb_release command.
gchar * remmina_utils_get_mage()
Print machine age.
const char * remmina_RSA_PubKey_v1
guint remmina_utils_string_replace_all(GString *haystack, const gchar *needle, const gchar *replace)
Replaces all occurrences of needle in haystack with replace.
gchar * remmina_utils_get_kernel_release()
Return the OS version as in "uname -r".
gboolean remmina_execute_plugin_signature_verification(GFile *plugin_file, size_t msg_len, const guchar *sig, size_t sig_len, EVP_PKEY *public_key)
A helper function that performs the actual signature verification (that is, this function makes direc...
gchar * remmina_utils_string_strip(const gchar *s)
Strip , \t and " from a given string.
gchar * remmina_sha1_file(const gchar *filename)
Create a hexadecimal string version of the SHA-1 digest of the contents of the named file.