summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2003-10-03 12:16:39 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2003-10-03 12:16:39 +0000
commite01342e2cdc7e52469716fc2c246f44100fa5068 (patch)
treeb66f07b5b7e3c82baaa177d3defbe6a30d7b05a2
parent1dc257e520537614992b4adb25fa8bc8b5591324 (diff)
downloadgnutls-e01342e2cdc7e52469716fc2c246f44100fa5068.tar.gz
Updated the openpgp key API.
-rw-r--r--NEWS3
-rw-r--r--configure.in2
-rw-r--r--doc/tex/Makefile.am9
-rw-r--r--doc/tex/funcs.tex7
-rw-r--r--includes/Makefile.am3
-rw-r--r--includes/gnutls/openpgp.h18
-rw-r--r--lib/x509/crl.c2
-rw-r--r--lib/x509/crq.c2
-rw-r--r--lib/x509/pkcs12.c2
-rw-r--r--lib/x509/pkcs12_bag.c2
-rw-r--r--lib/x509/pkcs7.c2
-rw-r--r--lib/x509/privkey.c2
-rw-r--r--lib/x509/x509.c2
-rw-r--r--libextra/Makefile.am2
-rw-r--r--libextra/gnutls_extra.c4
-rw-r--r--libextra/openpgp/Makefile.am2
-rw-r--r--libextra/openpgp/gnutls_openpgp.h9
-rw-r--r--libextra/openpgp/openpgp.c6
-rw-r--r--libextra/openpgp/openpgp.h32
-rw-r--r--src/common.c81
20 files changed, 149 insertions, 43 deletions
diff --git a/NEWS b/NEWS
index c6ce8e4dc6..c432630492 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,6 @@
+Version 0.9.90
+- Updated the openpgp key API.
+
Version 0.9.8 (02/10/2003)
- Updated the SRP implementation to follow the latest draft
(draft-ietf-tls-srp-05).
diff --git a/configure.in b/configure.in
index e822d8f649..342ced7aef 100644
--- a/configure.in
+++ b/configure.in
@@ -12,7 +12,7 @@ AC_DEFINE_UNQUOTED(T_OS, "$target_os", [OS name])
dnl Gnutls Version
GNUTLS_MAJOR_VERSION=0
GNUTLS_MINOR_VERSION=9
-GNUTLS_MICRO_VERSION=8
+GNUTLS_MICRO_VERSION=90
GNUTLS_VERSION=$GNUTLS_MAJOR_VERSION.$GNUTLS_MINOR_VERSION.$GNUTLS_MICRO_VERSION
AC_DEFINE_UNQUOTED(GNUTLS_VERSION, "$GNUTLS_VERSION", [version of gnutls])
diff --git a/doc/tex/Makefile.am b/doc/tex/Makefile.am
index c9aaa9cfe4..e9890e5b68 100644
--- a/doc/tex/Makefile.am
+++ b/doc/tex/Makefile.am
@@ -11,6 +11,7 @@ EXAMPLE_OBJECTS = ex-alert.tex ex-client-srp.tex ex-serv-export.tex \
ex-crq.tex ex-session-info.tex ex-pkcs12.tex
TEX_OBJECTS = gnutls.tex ../../lib/gnutls-api.tex fdl.tex ../../lib/x509/x509-api.tex \
+ ../../libextra/openpgp/pgp-api.tex \
macros.tex cover.tex ciphersuites.tex handshake.tex translayer.tex \
auth.tex ciphers.tex errors.tex layers.tex alert.tex record.tex \
funcs.tex examples.tex ../../libextra/gnutls-extra-api.tex \
@@ -30,6 +31,9 @@ build_api_lib:
build_api_x509:
cd ../../lib/x509 && make x509-api.tex
+build_api_pgp:
+ cd ../../libextra/openpgp && make pgp-api.tex
+
build_api_extra:
cd ../../libextra && make gnutls-extra-api.tex
@@ -45,7 +49,10 @@ gnutls-extra-api.tex: ../../libextra/gnutls-extra-api.tex
x509-api.tex: ../../lib/x509/x509-api.tex
-../scripts/sort1.pl < ../../lib/x509/x509-api.tex > x509-api.tex
-DOC_OBJECTS = x509-api.tex gnutls-api.tex gnutls-extra-api.tex error_codes.tex
+pgp-api.tex: ../../libextra/openpgp/pgp-api.tex
+ -../scripts/sort1.pl < ../../libextra/openpgp/pgp-api.tex > pgp-api.tex
+
+DOC_OBJECTS = pgp-api.tex x509-api.tex gnutls-api.tex gnutls-extra-api.tex error_codes.tex
gnutls.ps: build_api_lib build_api_x509 build_api_extra $(TEX_OBJECTS) $(DOC_OBJECTS)
-latex gnutls.tex
diff --git a/doc/tex/funcs.tex b/doc/tex/funcs.tex
index 04ab42e2c8..ba99204130 100644
--- a/doc/tex/funcs.tex
+++ b/doc/tex/funcs.tex
@@ -23,5 +23,12 @@ These functions are only available in the GPL version of the
library called ``gnutls-extra''. The prototypes for this library lie
in ``gnutls/extra.h''.
+\section{\gnutls{} OpenPGP key handling\index{Function reference!for OpenPGP keys}}
+\label{sec:x509api}
+The following functions are to be used for OpenPGP certificate handling.
+Their prototypes lie in ``gnutls/openpgp.h''.
+
+\input{pgp-api}
+
\input{gnutls-extra-api}
diff --git a/includes/Makefile.am b/includes/Makefile.am
index a363f40443..d75f0fed06 100644
--- a/includes/Makefile.am
+++ b/includes/Makefile.am
@@ -1,7 +1,8 @@
## Process this file with automake to produce Makefile.in
nobase_include_HEADERS = gnutls/extra.h gnutls/openssl.h gnutls/gnutls.h \
- gnutls/compat4.h gnutls/x509.h gnutls/compat8.h gnutls/pkcs12.h
+ gnutls/compat4.h gnutls/x509.h gnutls/compat8.h gnutls/pkcs12.h \
+ gnutls/openpgp.h
SUBDIRS = gnutls
diff --git a/includes/gnutls/openpgp.h b/includes/gnutls/openpgp.h
index 6fce2e5b05..a2bef1483e 100644
--- a/includes/gnutls/openpgp.h
+++ b/includes/gnutls/openpgp.h
@@ -32,7 +32,8 @@ extern "C" {
#include <gnutls/gnutls.h>
-struct gnutls_openpgp_key; /* object to hold (parsed) openpgp keys */
+struct gnutls_openpgp_key_int; /* object to hold (parsed) openpgp keys */
+typedef struct gnutls_openpgp_key_int* gnutls_openpgp_key;
typedef enum gnutls_openpgp_key_fmt { GNUTLS_X509_FMT_RAW,
GNUTLS_X509_FMT_BASE64 } gnutls_openpgp_key_fmt;
@@ -47,8 +48,7 @@ int gnutls_openpgp_key_get_fingerprint( gnutls_openpgp_key key,
char* result, size_t* result_size);
int gnutls_openpgp_key_get_name( gnutls_openpgp_key key,
- int idx,
- char *buf, size_t *sizeof_buf);
+ int idx, char *buf, size_t *sizeof_buf);
int gnutls_openpgp_key_get_pk_algorithm(gnutls_openpgp_key key,
int *r_bits);
@@ -62,12 +62,13 @@ int gnutls_openpgp_key_get_id( gnutls_openpgp_key key, unsigned char keyid[8]);
int gnutls_openpgp_key_check_hostname( gnutls_openpgp_key key, const char *hostname);
-int gnutls_openpgp_key_to_xml( gnutls_openpgp_key key key, gnutls_datum *xmlkey,
+int gnutls_openpgp_key_to_xml( gnutls_openpgp_key key, gnutls_datum *xmlkey,
int ext);
/* Keyring stuff.
*/
-struct gnutls_openpgp_keyring;
+struct gnutls_openpgp_keyring_int; /* object to hold (parsed) openpgp keyrings */
+typedef struct gnutls_openpgp_keyring_int* gnutls_openpgp_keyring;
int gnutls_openpgp_keyring_init( gnutls_openpgp_keyring* ring);
void gnutls_openpgp_keyring_deinit(gnutls_openpgp_keyring ring);
@@ -77,7 +78,8 @@ int gnutls_openpgp_keyring_import(gnutls_openpgp_keyring ring,
/* Trustdb functions.
*/
-struct gnutls_openpgp_trustdb;
+struct gnutls_openpgp_trustdb_int; /* object to hold (parsed) openpgp trustdbs */
+typedef struct gnutls_openpgp_trustdb_int* gnutls_openpgp_trustdb;
int gnutls_openpgp_trustdb_init( gnutls_openpgp_trustdb* db);
void gnutls_openpgp_trustdb_deinit(gnutls_openpgp_trustdb db);
@@ -89,13 +91,13 @@ int gnutls_openpgp_trustdb_import(gnutls_openpgp_trustdb db,
int gnutls_openpgp_key_verify_ring(
gnutls_openpgp_key key,
gnutls_openpgp_keyring ring,
- unsigned int flags /* if not used reserved for future use,
+ unsigned int flags,
unsigned int * verify /* the output of the verification */);
int gnutls_openpgp_key_verify_trustdb(
gnutls_openpgp_key key,
gnutls_openpgp_trustdb db,
- unsigned int flags /* if not used reserved for future use,
+ unsigned int flags,
unsigned int * verify /* the output of the verification */);
diff --git a/lib/x509/crl.c b/lib/x509/crl.c
index c0e6c3f670..615a99004e 100644
--- a/lib/x509/crl.c
+++ b/lib/x509/crl.c
@@ -71,6 +71,8 @@ int gnutls_x509_crl_init(gnutls_x509_crl * crl)
**/
void gnutls_x509_crl_deinit(gnutls_x509_crl crl)
{
+ if (!crl) return;
+
if (crl->crl)
asn1_delete_structure(&crl->crl);
_gnutls_free_datum(&crl->signed_data);
diff --git a/lib/x509/crq.c b/lib/x509/crq.c
index 0812594ca3..9a4a03edc1 100644
--- a/lib/x509/crq.c
+++ b/lib/x509/crq.c
@@ -75,6 +75,8 @@ int gnutls_x509_crq_init(gnutls_x509_crq * crq)
**/
void gnutls_x509_crq_deinit(gnutls_x509_crq crq)
{
+ if (!crq) return;
+
if (crq->crq)
asn1_delete_structure(&crq->crq);
diff --git a/lib/x509/pkcs12.c b/lib/x509/pkcs12.c
index b53f2c03e8..dfb709663d 100644
--- a/lib/x509/pkcs12.c
+++ b/lib/x509/pkcs12.c
@@ -145,6 +145,8 @@ int gnutls_pkcs12_init(gnutls_pkcs12 * pkcs12)
**/
void gnutls_pkcs12_deinit(gnutls_pkcs12 pkcs12)
{
+ if (!pkcs12) return;
+
if (pkcs12->pkcs12)
asn1_delete_structure(&pkcs12->pkcs12);
diff --git a/lib/x509/pkcs12_bag.c b/lib/x509/pkcs12_bag.c
index 332fb52c52..2193dd987c 100644
--- a/lib/x509/pkcs12_bag.c
+++ b/lib/x509/pkcs12_bag.c
@@ -79,6 +79,8 @@ int i;
**/
void gnutls_pkcs12_bag_deinit(gnutls_pkcs12_bag bag)
{
+ if (!bag) return;
+
_pkcs12_bag_free_data( bag);
gnutls_free(bag);
diff --git a/lib/x509/pkcs7.c b/lib/x509/pkcs7.c
index b7ae363310..9f9ad12cfb 100644
--- a/lib/x509/pkcs7.c
+++ b/lib/x509/pkcs7.c
@@ -161,6 +161,8 @@ int gnutls_pkcs7_init(gnutls_pkcs7 * pkcs7)
**/
void gnutls_pkcs7_deinit(gnutls_pkcs7 pkcs7)
{
+ if (!pkcs7) return;
+
if (pkcs7->pkcs7)
asn1_delete_structure(&pkcs7->pkcs7);
diff --git a/lib/x509/privkey.c b/lib/x509/privkey.c
index ba989bf13f..cdc2c755bf 100644
--- a/lib/x509/privkey.c
+++ b/lib/x509/privkey.c
@@ -67,6 +67,8 @@ void gnutls_x509_privkey_deinit(gnutls_x509_privkey key)
{
int i;
+ if (!key) return;
+
for (i = 0; i < key->params_size; i++) {
_gnutls_mpi_release( &key->params[i]);
}
diff --git a/lib/x509/x509.c b/lib/x509/x509.c
index c0b7a6666b..f7fbe07ff9 100644
--- a/lib/x509/x509.c
+++ b/lib/x509/x509.c
@@ -123,6 +123,8 @@ gnutls_datum tmp;
**/
void gnutls_x509_crt_deinit(gnutls_x509_crt cert)
{
+ if (!cert) return;
+
if (cert->cert)
asn1_delete_structure(&cert->cert);
_gnutls_free_datum(&cert->signed_data);
diff --git a/libextra/Makefile.am b/libextra/Makefile.am
index a0279ac02a..175313cc09 100644
--- a/libextra/Makefile.am
+++ b/libextra/Makefile.am
@@ -33,7 +33,7 @@ libgnutls_extra_la_SOURCES = $(COBJECTS_EXTRA)
libgnutls_extra_la_LIBADD = $(LZO_OBJECTS) ../lib/libgnutls.la \
openpgp/openpgp.lo openpgp/xml.lo openpgp/gnutls_openpgp.lo \
- openpgp/extras.lo openpgp/verify.lo
+ openpgp/extras.lo openpgp/verify.lo openpgp/compat.lo
EXTRA_libgnutls_extra_la_SOURCES = minilzo.c
diff --git a/libextra/gnutls_extra.c b/libextra/gnutls_extra.c
index 5938e9ff92..2e2c27c3a8 100644
--- a/libextra/gnutls_extra.c
+++ b/libextra/gnutls_extra.c
@@ -22,7 +22,7 @@
#include <gnutls_errors.h>
#include <gnutls_extensions.h>
#include <ext_srp.h>
-#include <gnutls_openpgp.h>
+#include <openpgp/gnutls_openpgp.h>
#include <gnutls_extra.h>
#include <gnutls_algorithms.h>
#include <minilzo.h>
@@ -151,12 +151,14 @@ extern OPENPGP_FINGERPRINT _E_gnutls_openpgp_fingerprint;
extern OPENPGP_KEY_REQUEST _E_gnutls_openpgp_request_key;
static void _gnutls_add_openpgp_functions(void) {
+#ifdef HAVE_LIBOPENCDK
_E_gnutls_openpgp_verify_key = gnutls_openpgp_verify_key;
_E_gnutls_openpgp_extract_key_expiration_time = gnutls_openpgp_extract_key_expiration_time;
_E_gnutls_openpgp_extract_key_creation_time = gnutls_openpgp_extract_key_creation_time;
_E_gnutls_openpgp_fingerprint = gnutls_openpgp_fingerprint;
_E_gnutls_openpgp_request_key = _gnutls_openpgp_request_key;
_E_gnutls_openpgp_cert2gnutls_cert = _gnutls_openpgp_cert2gnutls_cert;
+#endif
}
extern const char* gnutls_check_version( const char*);
diff --git a/libextra/openpgp/Makefile.am b/libextra/openpgp/Makefile.am
index 787a84ae54..6c47b1835a 100644
--- a/libextra/openpgp/Makefile.am
+++ b/libextra/openpgp/Makefile.am
@@ -3,7 +3,7 @@ EXTRA_DIST = openpgp.h gnutls_openpgp.h
noinst_LTLIBRARIES = libpgp.la
-COBJECTS = openpgp.c xml.c gnutls_openpgp.c verify.c extras.c
+COBJECTS = openpgp.c xml.c gnutls_openpgp.c verify.c extras.c compat.c
libpgp_la_SOURCES = $(COBJECTS)
diff --git a/libextra/openpgp/gnutls_openpgp.h b/libextra/openpgp/gnutls_openpgp.h
index e89708d10e..7a60dfa1c4 100644
--- a/libextra/openpgp/gnutls_openpgp.h
+++ b/libextra/openpgp/gnutls_openpgp.h
@@ -80,5 +80,14 @@ keybox_blob* kbx_read_blob( const gnutls_datum* keyring, size_t pos );
cdk_keydb_hd_t kbx_to_keydb( keybox_blob *blob );
void kbx_blob_release( keybox_blob *ctx );
+int gnutls_openpgp_verify_key(const char *trustdb,
+ const gnutls_datum * keyring,
+ const gnutls_datum * cert_list,
+ int cert_list_length);
+int gnutls_openpgp_fingerprint(const gnutls_datum * cert,
+ unsigned char *fpr, size_t * fprlen);
+time_t gnutls_openpgp_extract_key_creation_time(const gnutls_datum * cert);
+time_t gnutls_openpgp_extract_key_expiration_time(const gnutls_datum * cert);
+
#endif /*GNUTLS_OPENPGP_H*/
diff --git a/libextra/openpgp/openpgp.c b/libextra/openpgp/openpgp.c
index c24c8a14f9..c30a3a1062 100644
--- a/libextra/openpgp/openpgp.c
+++ b/libextra/openpgp/openpgp.c
@@ -62,6 +62,8 @@ int gnutls_openpgp_key_init(gnutls_openpgp_key * key)
**/
void gnutls_openpgp_key_deinit(gnutls_openpgp_key key)
{
+ if (!key) return;
+
if (key->knode) {
cdk_kbnode_release( key->knode);
key->knode = NULL;
@@ -275,7 +277,7 @@ gnutls_openpgp_key_get_pk_algorithm( gnutls_openpgp_key key, int *r_bits)
* Extract the version of the OpenPGP key.
**/
int
-gnutls_openpgp_extract_key_version( gnutls_openpgp_key key)
+gnutls_openpgp_key_get_version( gnutls_openpgp_key key)
{
CDK_PACKET *pkt;
int version = 0;
@@ -298,7 +300,7 @@ gnutls_openpgp_extract_key_version( gnutls_openpgp_key key)
* Returns the timestamp when the OpenPGP key was created.
**/
time_t
-gnutls_openpgp_extract_key_creation_time( gnutls_openpgp_key key)
+gnutls_openpgp_key_get_creation_time( gnutls_openpgp_key key)
{
CDK_PACKET *pkt;
time_t timestamp = 0;
diff --git a/libextra/openpgp/openpgp.h b/libextra/openpgp/openpgp.h
index b559522da7..e98ad18de8 100644
--- a/libextra/openpgp/openpgp.h
+++ b/libextra/openpgp/openpgp.h
@@ -28,6 +28,38 @@ int
gnutls_openpgp_key_get_name( gnutls_openpgp_key key,
int idx,
char *buf, size_t *sizeof_buf);
+int gnutls_openpgp_key_get_fingerprint( gnutls_openpgp_key key,
+ unsigned char *fpr, size_t *fprlen);
+int gnutls_openpgp_key_get_pk_algorithm( gnutls_openpgp_key key, int *r_bits);
+int gnutls_openpgp_key_get_version( gnutls_openpgp_key key);
+time_t gnutls_openpgp_key_get_creation_time( gnutls_openpgp_key key);
+time_t gnutls_openpgp_key_get_expiration_time( gnutls_openpgp_key key);
+int gnutls_openpgp_key_get_id( gnutls_openpgp_key key,
+ unsigned char keyid[8]);
+int gnutls_openpgp_key_init(gnutls_openpgp_key * key);
+void gnutls_openpgp_key_deinit(gnutls_openpgp_key key);
+int gnutls_openpgp_key_import(gnutls_openpgp_key key,
+ const gnutls_datum * data, gnutls_openpgp_key_fmt format);
+
+
+void gnutls_openpgp_keyring_deinit(gnutls_openpgp_keyring keyring);
+int gnutls_openpgp_keyring_init(gnutls_openpgp_keyring * keyring);
+int gnutls_openpgp_keyring_import(gnutls_openpgp_keyring keyring,
+ const gnutls_datum * data,
+ gnutls_openpgp_key_fmt format);
+
+void gnutls_openpgp_trustdb_deinit(gnutls_openpgp_trustdb trustdb);
+int gnutls_openpgp_trustdb_init(gnutls_openpgp_trustdb * trustdb);
+int gnutls_openpgp_trustdb_import_file(gnutls_openpgp_trustdb trustdb,
+ const char * file);
+
+int gnutls_openpgp_key_verify_ring( gnutls_openpgp_key key,
+ gnutls_openpgp_keyring keyring,
+ unsigned int flags, unsigned int *verify);
+
+int gnutls_openpgp_key_verify_trustdb( gnutls_openpgp_key key,
+ gnutls_openpgp_trustdb trustdb,
+ unsigned int flags, unsigned int *verify);
#endif
diff --git a/src/common.c b/src/common.c
index 702136bd2a..ecc9a9eeb4 100644
--- a/src/common.c
+++ b/src/common.c
@@ -4,6 +4,7 @@
#include <gnutls/gnutls.h>
#include <gnutls/extra.h>
#include <gnutls/x509.h>
+#include <gnutls/openpgp.h>
#include <time.h>
#include <common.h>
@@ -12,8 +13,7 @@
int xml = 0;
#define PRINTX(x,y) if (y[0]!=0) printf(" # %s %s\n", x, y)
-#define PRINT_PGP_NAME(X) PRINTX( "NAME:", X.name); \
- PRINTX( "EMAIL:", X.email)
+#define PRINT_PGP_NAME(X) PRINTX( "NAME:", name)
const char str_unknown[] = "(unknown)";
@@ -178,36 +178,67 @@ void print_x509_info(gnutls_session session, const char* hostname)
}
-void print_openpgp_info(gnutls_session session)
+void print_openpgp_info(gnutls_session session, const char* hostname)
{
- gnutls_openpgp_name pgp_name;
char digest[20];
- int digest_size = sizeof(digest), i;
+ int digest_size = sizeof(digest), i, ret;
char printable[120];
char *print;
+ char name[256];
+ size_t name_len = sizeof(name);
+ gnutls_openpgp_key crt;
const gnutls_datum *cert_list;
int cert_list_size = 0;
- time_t expiret = gnutls_certificate_expiration_time_peers(session);
- time_t activet = gnutls_certificate_activation_time_peers(session);
-
+ time_t expiret;
+ time_t activet;
+
cert_list = gnutls_certificate_get_peers(session, &cert_list_size);
if (cert_list_size > 0) {
int algo, bits;
-#if 0
- if (xml) {
- gnutls_datum res;
+ gnutls_openpgp_key_init(&crt);
+ ret =
+ gnutls_openpgp_key_import(crt, &cert_list[0], 0);
+ if (ret < 0) {
+ const char* str = gnutls_strerror(ret);
+ if (str == NULL) str = str_unknown;
+ fprintf(stderr, "Decoding error: %s\n", str);
+ return;
+ }
+
+ if (hostname != NULL) { /* Check the hostname of the first certificate
+ * if it matches the name of the host we
+ * connected to.
+ */
+ if (gnutls_openpgp_key_check_hostname( crt, hostname)==0) {
+ printf(" # The hostname in the key does NOT match '%s'.\n", hostname);
+ } else {
+ printf(" # The hostname in the key matches '%s'.\n", hostname);
+ }
+ }
- gnutls_openpgp_key_to_xml(&cert_list[0], &res, 0);
- puts(res.data);
+ if (xml) {
+ gnutls_datum xml_data;
- free(res.data);
+ ret = gnutls_openpgp_key_to_xml( crt, &xml_data, 0);
+ if (ret < 0) {
+ const char* str = gnutls_strerror(ret);
+ if (str == NULL) str = str_unknown;
+ fprintf(stderr, "XML encoding error: %s\n",
+ str);
+ return;
+ }
+
+ printf("%s", xml_data.data);
+ gnutls_free( xml_data.data);
return;
}
-#endif
+
+ activet = gnutls_openpgp_key_get_creation_time( crt);
+ expiret = gnutls_openpgp_key_get_expiration_time( crt);
printf(" # Key was created at: %s", my_ctime(&activet));
printf(" # Key expires: ");
@@ -216,8 +247,8 @@ void print_openpgp_info(gnutls_session session)
else
printf("Never\n");
- if (gnutls_openpgp_fingerprint
- (&cert_list[0], digest, &digest_size) >= 0) {
+ if (gnutls_openpgp_key_get_fingerprint(crt, digest, &digest_size) >= 0)
+ {
print = printable;
for (i = 0; i < digest_size; i++) {
sprintf(print, "%.2x ",
@@ -226,12 +257,10 @@ void print_openpgp_info(gnutls_session session)
}
printf(" # PGP Key version: %d\n",
- gnutls_openpgp_extract_key_version
- (&cert_list[0]));
+ gnutls_openpgp_key_get_version(crt));
algo =
- gnutls_openpgp_extract_key_pk_algorithm
- (&cert_list[0], &bits);
+ gnutls_openpgp_key_get_pk_algorithm(crt, &bits);
printf(" # PGP Key public key algorithm: ");
@@ -247,14 +276,12 @@ void print_openpgp_info(gnutls_session session)
printf(" # PGP Key fingerprint: %s\n", printable);
- if (gnutls_openpgp_extract_key_name(&cert_list[0],
- 0,
- &pgp_name) <
- 0) {
+ name_len = sizeof(name);
+ if (gnutls_openpgp_key_get_name(crt, 0, name, &name_len) < 0) {
fprintf(stderr,
"Could not extract name\n");
} else {
- PRINT_PGP_NAME(pgp_name);
+ PRINT_PGP_NAME(name);
}
}
@@ -386,7 +413,7 @@ void print_cert_info(gnutls_session session, const char* hostname)
break;
case GNUTLS_CRT_OPENPGP:
printf("OpenPGP\n");
- print_openpgp_info(session);
+ print_openpgp_info(session, hostname);
break;
}