diff options
Diffstat (limited to 'src/initconf.c')
| -rw-r--r-- | src/initconf.c | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/src/initconf.c b/src/initconf.c index 7d6aa28..960fb6b 100644 --- a/src/initconf.c +++ b/src/initconf.c | |||
| @@ -93,25 +93,15 @@ int main(int argc, char *argv[]) { | |||
| 93 | gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, root_cert_pem.data, &root_cert_pem.size); | 93 | gnutls_x509_crt_export (root_cert, GNUTLS_X509_FMT_PEM, root_cert_pem.data, &root_cert_pem.size); |
| 94 | gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, host_cert_pem.data, &host_cert_pem.size); | 94 | gnutls_x509_crt_export (host_cert, GNUTLS_X509_FMT_PEM, host_cert_pem.data, &host_cert_pem.size); |
| 95 | 95 | ||
| 96 | /* encode in base64 for storage */ | ||
| 97 | char* root_key_b64 = g_base64_encode (root_key_pem.data,root_key_pem.size); | ||
| 98 | char* host_key_b64 = g_base64_encode (host_key_pem.data,host_key_pem.size); | ||
| 99 | |||
| 100 | char* root_cert_b64 = g_base64_encode (root_cert_pem.data,root_cert_pem.size); | ||
| 101 | char* host_cert_b64 = g_base64_encode (host_cert_pem.data,host_cert_pem.size); | ||
| 102 | 96 | ||
| 103 | /* store values in config file */ | 97 | /* store values in config file */ |
| 104 | 98 | ||
| 105 | init_config_file(host_id, root_key_b64, host_key_b64, root_cert_b64, host_cert_b64); | 99 | init_config_file(host_id, &root_key_pem, &host_key_pem, &root_cert_pem, &host_cert_pem); |
| 106 | 100 | ||
| 107 | gnutls_free(root_key_pem.data); | 101 | gnutls_free(root_key_pem.data); |
| 108 | gnutls_free(host_key_pem.data); | 102 | gnutls_free(host_key_pem.data); |
| 109 | gnutls_free(root_cert_pem.data); | 103 | gnutls_free(root_cert_pem.data); |
| 110 | gnutls_free(host_cert_pem.data); | 104 | gnutls_free(host_cert_pem.data); |
| 111 | g_free(root_key_b64); | ||
| 112 | g_free(host_key_b64); | ||
| 113 | g_free(root_cert_b64); | ||
| 114 | g_free(host_cert_b64); | ||
| 115 | 105 | ||
| 116 | return 0; | 106 | return 0; |
| 117 | } | 107 | } |
