* Version 2.5.6 (unreleased)
+** Add interface to deal with public key algorithms.
+The functions are called gnutls_pk_list and gnutls_pk_get_id.
+Suggested by Sam Varshavchik <mrsam@courier-mta.com>.
+
+** API and ABI modifications:
+gnutls_pk_list: ADDED
+gnutls_pk_get_id: ADDED
+
* Version 2.5.5 (released 2008-08-29)
** libgnutls: New API to get a string corresponding to a error symbol.
gnutls_kx_algorithm_t gnutls_kx_get_id (const char* name);
gnutls_protocol_t gnutls_protocol_get_id (const char* name);
gnutls_certificate_type_t gnutls_certificate_type_get_id (const char* name);
-
+ gnutls_pk_algorithm_t gnutls_pk_get_id (const char *name);
/* list supported algorithms */
const gnutls_cipher_algorithm_t *gnutls_cipher_list (void);
const gnutls_protocol_t *gnutls_protocol_list (void);
const gnutls_certificate_type_t *gnutls_certificate_type_list (void);
const gnutls_kx_algorithm_t *gnutls_kx_list (void);
+ const gnutls_pk_algorithm_t *gnutls_pk_list (void);
const char *gnutls_cipher_suite_info (size_t i,
char *id,
gnutls_kx_algorithm_t *kx,
return ret;
}
+/**
+ * gnutls_pk_list - Get a list of supported public key algorithms
+ *
+ * Get a list of supported public key algorithms.
+ *
+ * Returns: a zero-terminated list of #gnutls_pk_algorithm_t integers
+ * indicating the available ciphers.
+ *
+ * Since: 2.6.0
+ **/
+const gnutls_pk_algorithm_t *
+gnutls_pk_list (void)
+{
+ const static supported_pks[] = {
+ GNUTLS_PK_RSA,
+ GNUTLS_PK_DSA
+ };
+
+ return supported_pks;
+}
+
+/**
+ * gnutls_pk_get_id - Get #gnutls_pk_algorithm_t from a string
+ * @name: is a string containing a public key algorithm name.
+ *
+ * Convert a string to a #gnutls_pk_algorithm_t value. The names are
+ * compared in a case insensitive way. For example,
+ * gnutls_pk_get_id("RSA") will return %GNUTLS_PK_RSA.
+ *
+ * Returns: an #gnutls_pk_algorithm_tid of the specified in a string
+ * public key algorithm, or %GNUTLS_PK_UNKNOWN on failures.
+ *
+ * Since: 2.6.0
+ **/
+gnutls_pk_algorithm_t
+gnutls_pk_get_id (const char *name)
+{
+ if (strcasecmp (name, "RSA") == 0)
+ return GNUTLS_PK_RSA;
+ else if (strcasecmp (name, "DSA") == 0)
+ return GNUTLS_PK_DSA;
+
+ return GNUTLS_PK_UNKNOWN;
+}
+
gnutls_pk_algorithm_t
_gnutls_x509_oid2pk_algorithm (const char *oid)
{