diff options
author | Jonathan Beck | 2008-12-12 23:39:33 +0100 |
---|---|---|
committer | Jonathan Beck | 2008-12-12 23:39:33 +0100 |
commit | 3d8ba053deeacd74e621469d3d45d1db38ee411a (patch) | |
tree | 9c2010c9da179f96d55988f19c861301a68e5eb4 /src/userpref.c | |
parent | 9ca887308d59e6cb5bf684f9f3bd968118e8014f (diff) | |
download | libplist-3d8ba053deeacd74e621469d3d45d1db38ee411a.tar.gz libplist-3d8ba053deeacd74e621469d3d45d1db38ee411a.tar.bz2 |
Change from Base64 encoded buffers to real buffers. Base64 decoding/encoding only happens in xml plists.
Diffstat (limited to 'src/userpref.c')
-rw-r--r-- | src/userpref.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/userpref.c b/src/userpref.c index db54679..b707957 100644 --- a/src/userpref.c +++ b/src/userpref.c @@ -114,10 +114,10 @@ int is_device_known(char *uid) * @return 1 on success and 0 if no public key is given or if it has already * been marked as connected previously. */ -int store_device_public_key(char *uid, char *public_key) +int store_device_public_key(char *uid, gnutls_datum_t public_key) { - if (NULL == public_key || is_device_known(uid)) + if (NULL == public_key.data || is_device_known(uid)) return 0; /* ensure config directory exists */ @@ -127,15 +127,11 @@ int store_device_public_key(char *uid, char *public_key) gchar *device_file = g_strconcat(uid, ".pem", NULL); gchar *pem = g_build_path(G_DIR_SEPARATOR_S, g_get_user_config_dir(), LIBIPHONE_CONF_DIR, device_file, NULL); - /* decode public key for storing */ - gsize decoded_size; - gchar *data = g_base64_decode(public_key, &decoded_size); /* store file */ FILE *pFile = fopen(pem, "wb"); - fwrite(data, 1, decoded_size, pFile); + fwrite(public_key.data, 1, public_key.size, pFile); fclose(pFile); g_free(pem); - g_free(data); g_free(device_file); return 1; } |