;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
;;; USA.
-;;; Written by Ludovic Courtès <ludo@chbouib.org>
+;;; Written by Ludovic Courtès <ludo@gnu.org>
(define-module (gnutls extra)
:use-module (gnutls)
:export (;; OpenPGP keys
- openpgp-public-key? openpgp-private-key?
- import-openpgp-public-key import-openpgp-private-key
- openpgp-public-key-id openpgp-public-key-id!
- openpgp-public-key-fingerprint openpgp-public-key-fingerprint!
- openpgp-public-key-name openpgp-public-key-names
- openpgp-public-key-algorithm openpgp-public-key-version
- openpgp-public-key-usage
+ openpgp-certificate? openpgp-private-key?
+ import-openpgp-certificate import-openpgp-private-key
+ openpgp-certificate-id openpgp-certificate-id!
+ openpgp-certificate-fingerprint openpgp-certificate-fingerprint!
+ openpgp-certificate-name openpgp-certificate-names
+ openpgp-certificate-algorithm openpgp-certificate-version
+ openpgp-certificate-usage
;; OpenPGP keyrings
openpgp-keyring? import-openpgp-keyring
set-certificate-credentials-openpgp-keys!
;; enum->string functions
- openpgp-key-format->string
+ openpgp-certificate-format->string
;; enum values
- openpgp-key-format/raw
- openpgp-key-format/base64))
+ openpgp-certificate-format/raw
+ openpgp-certificate-format/base64))
(load-extension "libguile-gnutls-extra-v-0" "scm_init_gnutls_extra")
+\f
+;;;
+;;; Aliases kept for backward compatibility with GnuTLS 2.0.x. These aliases
+;;; are deprecated in 2.2 and should be removed in 2.4.x.
+;;;
+
+(define-public openpgp-public-key? openpgp-certificate?)
+(define-public import-openpgp-public-key import-openpgp-certificate)
+(define-public openpgp-public-key-id openpgp-certificate-id)
+(define-public openpgp-public-key-id! openpgp-certificate-id!)
+(define-public openpgp-public-key-fingerprint openpgp-certificate-fingerprint)
+(define-public openpgp-public-key-fingerprint! openpgp-certificate-fingerprint!)
+(define-public openpgp-public-key-name openpgp-certificate-name)
+(define-public openpgp-public-key-names openpgp-certificate-names)
+(define-public openpgp-public-key-algorithm openpgp-certificate-algorithm)
+(define-public openpgp-public-key-version openpgp-certificate-version)
+(define-public openpgp-public-key-usage openpgp-certificate-usage)
+
+(define-public openpgp-key-format->string openpgp-certificate-format->string)
+(define-public openpgp-key-format/raw openpgp-certificate-format/raw)
+(define-public openpgp-key-format/base64 openpgp-certificate-format/base64)
+
+
;;; Local Variables:
;;; mode: scheme
;;; coding: latin-1
;;; End:
-;;; arch-tag: 2eb7693e-a221-41d3-8a14-a57426e9e670
/* Maximum size we support for the name of OpenPGP keys. */
#define GUILE_GNUTLS_MAX_OPENPGP_NAME_LENGTH 2048
-SCM_DEFINE (scm_gnutls_import_openpgp_public_key, "import-openpgp-public-key",
+SCM_DEFINE (scm_gnutls_import_openpgp_certificate, "import-openpgp-certificate",
2, 0, 0,
(SCM data, SCM format),
- "Return a new OpenPGP public key object resulting from the "
+ "Return a new OpenPGP certificate object resulting from the "
"import of @var{data} (a uniform array) according to "
"@var{format}.")
-#define FUNC_NAME s_scm_gnutls_import_openpgp_public_key
+#define FUNC_NAME s_scm_gnutls_import_openpgp_certificate
{
int err;
gnutls_openpgp_crt_t c_key;
size_t c_data_len;
SCM_VALIDATE_ARRAY (1, data);
- c_format = scm_to_gnutls_openpgp_key_format (format, 2, FUNC_NAME);
+ c_format = scm_to_gnutls_openpgp_certificate_format (format, 2, FUNC_NAME);
c_data = scm_gnutls_get_array (data, &c_data_handle, &c_data_len,
FUNC_NAME);
scm_gnutls_error (err, FUNC_NAME);
}
- return (scm_from_gnutls_openpgp_public_key (c_key));
+ return (scm_from_gnutls_openpgp_certificate (c_key));
}
#undef FUNC_NAME
size_t c_data_len, c_pass_len;
SCM_VALIDATE_ARRAY (1, data);
- c_format = scm_to_gnutls_openpgp_key_format (format, 2, FUNC_NAME);
+ c_format = scm_to_gnutls_openpgp_certificate_format (format, 2, FUNC_NAME);
if ((pass == SCM_UNDEFINED) || (scm_is_false (pass)))
c_pass = NULL;
else
}
#undef FUNC_NAME
-SCM_DEFINE (scm_gnutls_openpgp_public_key_id, "openpgp-public-key-id",
+SCM_DEFINE (scm_gnutls_openpgp_certificate_id, "openpgp-certificate-id",
1, 0, 0,
(SCM key),
- "Return the ID (an 8-element u8vector) of public key "
+ "Return the ID (an 8-element u8vector) of certificate "
"@var{key}.")
-#define FUNC_NAME s_scm_gnutls_openpgp_public_key_id
+#define FUNC_NAME s_scm_gnutls_openpgp_certificate_id
{
int err;
unsigned char *c_id;
gnutls_openpgp_crt_t c_key;
- c_key = scm_to_gnutls_openpgp_public_key (key, 1, FUNC_NAME);
+ c_key = scm_to_gnutls_openpgp_certificate (key, 1, FUNC_NAME);
c_id = (unsigned char * ) malloc (8);
if (c_id == NULL)
}
#undef FUNC_NAME
-SCM_DEFINE (scm_gnutls_openpgp_public_key_id_x, "openpgp-public-key-id!",
+SCM_DEFINE (scm_gnutls_openpgp_certificate_id_x, "openpgp-certificate-id!",
2, 0, 0,
(SCM key, SCM id),
- "Store the ID (an 8 byte sequence) of public key "
+ "Store the ID (an 8 byte sequence) of certificate "
"@var{key} in @var{id} (a u8vector).")
-#define FUNC_NAME s_scm_gnutls_openpgp_public_key_id_x
+#define FUNC_NAME s_scm_gnutls_openpgp_certificate_id_x
{
int err;
char *c_id;
size_t c_id_size;
gnutls_openpgp_crt_t c_key;
- c_key = scm_to_gnutls_openpgp_public_key (key, 1, FUNC_NAME);
+ c_key = scm_to_gnutls_openpgp_certificate (key, 1, FUNC_NAME);
c_id = scm_gnutls_get_writable_array (id, &c_id_handle, &c_id_size,
FUNC_NAME);
}
#undef FUNC_NAME
-SCM_DEFINE (scm_gnutls_openpgp_public_key_fingerpint_x,
- "openpgp-public-key-fingerprint!",
+SCM_DEFINE (scm_gnutls_openpgp_certificate_fingerpint_x,
+ "openpgp-certificate-fingerprint!",
2, 0, 0,
(SCM key, SCM fpr),
"Store in @var{fpr} (a u8vector) the fingerprint of @var{key}. "
"Return the number of bytes stored in @var{fpr}.")
-#define FUNC_NAME s_scm_gnutls_openpgp_public_key_fingerpint_x
+#define FUNC_NAME s_scm_gnutls_openpgp_certificate_fingerpint_x
{
int err;
gnutls_openpgp_crt_t c_key;
scm_t_array_handle c_fpr_handle;
size_t c_fpr_len, c_actual_len = 0;
- c_key = scm_to_gnutls_openpgp_public_key (key, 1, FUNC_NAME);
+ c_key = scm_to_gnutls_openpgp_certificate (key, 1, FUNC_NAME);
SCM_VALIDATE_ARRAY (2, fpr);
c_fpr = scm_gnutls_get_writable_array (fpr, &c_fpr_handle, &c_fpr_len,
}
#undef FUNC_NAME
-SCM_DEFINE (scm_gnutls_openpgp_public_key_fingerprint,
- "openpgp-public-key-fingerprint",
+SCM_DEFINE (scm_gnutls_openpgp_certificate_fingerprint,
+ "openpgp-certificate-fingerprint",
1, 0, 0,
(SCM key),
"Return a new u8vector denoting the fingerprint of "
"@var{key}.")
-#define FUNC_NAME s_scm_gnutls_openpgp_public_key_fingerprint
+#define FUNC_NAME s_scm_gnutls_openpgp_certificate_fingerprint
{
int err;
gnutls_openpgp_crt_t c_key;
unsigned char *c_fpr;
size_t c_fpr_len, c_actual_len;
- c_key = scm_to_gnutls_openpgp_public_key (key, 1, FUNC_NAME);
+ c_key = scm_to_gnutls_openpgp_certificate (key, 1, FUNC_NAME);
/* V4 fingerprints are 160-bit SHA-1 hashes (see RFC2440). */
c_fpr_len = 20;
}
#undef FUNC_NAME
-SCM_DEFINE (scm_gnutls_openpgp_public_key_name, "openpgp-public-key-name",
+SCM_DEFINE (scm_gnutls_openpgp_certificate_name, "openpgp-certificate-name",
2, 0, 0,
(SCM key, SCM index),
"Return the @var{index}th name of @var{key}.")
-#define FUNC_NAME s_scm_gnutls_openpgp_public_key_name
+#define FUNC_NAME s_scm_gnutls_openpgp_certificate_name
{
int err;
gnutls_openpgp_crt_t c_key;
char c_name[GUILE_GNUTLS_MAX_OPENPGP_NAME_LENGTH];
size_t c_name_len = sizeof (c_name);
- c_key = scm_to_gnutls_openpgp_public_key (key, 1, FUNC_NAME);
+ c_key = scm_to_gnutls_openpgp_certificate (key, 1, FUNC_NAME);
c_index = scm_to_int (index);
err = gnutls_openpgp_crt_get_name (c_key, c_index, c_name,
}
#undef FUNC_NAME
-SCM_DEFINE (scm_gnutls_openpgp_public_key_names, "openpgp-public-key-names",
+SCM_DEFINE (scm_gnutls_openpgp_certificate_names, "openpgp-certificate-names",
1, 0, 0,
(SCM key),
"Return the list of names for @var{key}.")
-#define FUNC_NAME s_scm_gnutls_openpgp_public_key_names
+#define FUNC_NAME s_scm_gnutls_openpgp_certificate_names
{
int err;
SCM result = SCM_EOL;
char c_name[GUILE_GNUTLS_MAX_OPENPGP_NAME_LENGTH];
size_t c_name_len = sizeof (c_name);
- c_key = scm_to_gnutls_openpgp_public_key (key, 1, FUNC_NAME);
+ c_key = scm_to_gnutls_openpgp_certificate (key, 1, FUNC_NAME);
do
{
}
#undef FUNC_NAME
-SCM_DEFINE (scm_gnutls_openpgp_public_key_algorithm,
- "openpgp-public-key-algorithm",
+SCM_DEFINE (scm_gnutls_openpgp_certificate_algorithm,
+ "openpgp-certificate-algorithm",
1, 0, 0,
(SCM key),
- "Return two values: the public key algorithm used by "
+ "Return two values: the certificate algorithm used by "
"@var{key} and the number of bits used.")
-#define FUNC_NAME s_scm_gnutls_openpgp_public_key_algorithm
+#define FUNC_NAME s_scm_gnutls_openpgp_certificate_algorithm
{
gnutls_openpgp_crt_t c_key;
unsigned int c_bits;
gnutls_pk_algorithm_t c_algo;
- c_key = scm_to_gnutls_openpgp_public_key (key, 1, FUNC_NAME);
+ c_key = scm_to_gnutls_openpgp_certificate (key, 1, FUNC_NAME);
c_algo = gnutls_openpgp_crt_get_pk_algorithm (c_key, &c_bits);
return (scm_values (scm_list_2 (scm_from_gnutls_pk_algorithm (c_algo),
}
#undef FUNC_NAME
-SCM_DEFINE (scm_gnutls_openpgp_public_key_version,
- "openpgp-public-key-version",
+SCM_DEFINE (scm_gnutls_openpgp_certificate_version,
+ "openpgp-certificate-version",
1, 0, 0,
(SCM key),
"Return the version of the OpenPGP message format (RFC2440) "
"honored by @var{key}.")
-#define FUNC_NAME s_scm_gnutls_openpgp_public_key_version
+#define FUNC_NAME s_scm_gnutls_openpgp_certificate_version
{
int c_version;
gnutls_openpgp_crt_t c_key;
- c_key = scm_to_gnutls_openpgp_public_key (key, 1, FUNC_NAME);
+ c_key = scm_to_gnutls_openpgp_certificate (key, 1, FUNC_NAME);
c_version = gnutls_openpgp_crt_get_version (c_key);
return (scm_from_int (c_version));
}
#undef FUNC_NAME
-SCM_DEFINE (scm_gnutls_openpgp_public_key_usage, "openpgp-public-key-usage",
+SCM_DEFINE (scm_gnutls_openpgp_certificate_usage, "openpgp-certificate-usage",
1, 0, 0,
(SCM key),
"Return a list of values denoting the key usage of @var{key}.")
-#define FUNC_NAME s_scm_gnutls_openpgp_public_key_usage
+#define FUNC_NAME s_scm_gnutls_openpgp_certificate_usage
{
int err;
unsigned int c_usage = 0;
gnutls_openpgp_crt_t c_key;
- c_key = scm_to_gnutls_openpgp_public_key (key, 1, FUNC_NAME);
+ c_key = scm_to_gnutls_openpgp_certificate (key, 1, FUNC_NAME);
err = gnutls_openpgp_crt_get_key_usage (c_key, &c_usage);
if (EXPECT_FALSE (err))
size_t c_data_len;
SCM_VALIDATE_ARRAY (1, data);
- c_format = scm_to_gnutls_openpgp_key_format (format, 2, FUNC_NAME);
+ c_format = scm_to_gnutls_openpgp_certificate_format (format, 2, FUNC_NAME);
c_data = scm_gnutls_get_array (data, &c_data_handle, &c_data_len,
FUNC_NAME);
"set-certificate-credentials-openpgp-keys!",
3, 0, 0,
(SCM cred, SCM pub, SCM sec),
- "Use public key @var{pub} and secret key @var{sec} in "
+ "Use certificate @var{pub} and secret key @var{sec} in "
"certificate credentials @var{cred}.")
#define FUNC_NAME s_scm_gnutls_set_certificate_credentials_openpgp_keys_x
{
gnutls_openpgp_privkey_t c_sec;
c_cred = scm_to_gnutls_certificate_credentials (cred, 1, FUNC_NAME);
- c_pub = scm_to_gnutls_openpgp_public_key (pub, 2, FUNC_NAME);
+ c_pub = scm_to_gnutls_openpgp_certificate (pub, 2, FUNC_NAME);
c_sec = scm_to_gnutls_openpgp_private_key (sec, 3, FUNC_NAME);
err = gnutls_certificate_set_openpgp_key (c_cred, c_pub, c_sec);