libnm-util: add nm_utils_file_is_pkcs12() for checking PKCS#12 file format

This commit is contained in:
Jiří Klimeš 2012-07-16 14:42:06 +02:00
parent 7c841b901a
commit 00297f49fb
3 changed files with 18 additions and 2 deletions

View file

@ -493,6 +493,7 @@ global:
nm_setting_wireless_security_set_wep_key;
nm_utils_deinit;
nm_utils_escape_ssid;
nm_utils_file_is_pkcs12;
nm_utils_gvalue_hash_dup;
nm_utils_hwaddr_atoba;
nm_utils_hwaddr_aton;

View file

@ -21,7 +21,7 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
* (C) Copyright 2005 - 2010 Red Hat, Inc.
* (C) Copyright 2005 - 2012 Red Hat, Inc.
*/
#include "config.h"
@ -2217,6 +2217,20 @@ out:
return ret;
}
/**
* nm_utils_file_is_pkcs12:
* @filename: name of the file to test
*
* Utility function to find out if the @filename is in PKCS#12 format.
*
* Returns: TRUE if the file is PKCS#12, FALSE if it is not
**/
gboolean
nm_utils_file_is_pkcs12 (const char *filename)
{
return crypto_is_pkcs12_file (filename, NULL);
}
/* Band, channel/frequency stuff for wireless */
struct cf_pair {
guint32 chan;

View file

@ -20,7 +20,7 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
* (C) Copyright 2005 - 2011 Red Hat, Inc.
* (C) Copyright 2005 - 2012 Red Hat, Inc.
*/
#ifndef NM_UTILS_H
@ -113,6 +113,7 @@ GByteArray *nm_utils_rsa_key_encrypt (const GByteArray *data,
const char *in_password,
char **out_password,
GError **error);
gboolean nm_utils_file_is_pkcs12 (const char *filename);
guint32 nm_utils_wifi_freq_to_channel (guint32 freq);
guint32 nm_utils_wifi_channel_to_freq (guint32 channel, const char *band);