From: Nikos Mavrogiannopoulos Date: Fri, 6 Sep 2002 17:12:54 +0000 (+0000) Subject: added versioning in the XML output of certificate functions. X-Git-Tag: gnutls_0_5_6~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d7abdc0ddfb833cd052df4c9a70ec75396fc2b09;p=thirdparty%2Fgnutls.git added versioning in the XML output of certificate functions. --- diff --git a/NEWS b/NEWS index d1664ce59d..833ea8b732 100644 --- a/NEWS +++ b/NEWS @@ -1,10 +1,11 @@ -Version 0.5.6 +Version 0.5.6 (6/09/2002) - Corrected bugs in SRP implementation, which prevented gnutls to interoperate with other implementations. (interoperability testing was done by David Taylor) - Corrected bug in cert_type extension. - Corrected extension type checks which used an 8 bit extension size, instead of 16 bits. +- Added versioning in the XML output of certificate functions. - Removed the X.509 test suite. Version 0.5.5 (3/09/2002) diff --git a/doc/tex/pgpcert.xml.tex b/doc/tex/pgpcert.xml.tex index fe66e35e67..1e11aeb4fe 100644 --- a/doc/tex/pgpcert.xml.tex +++ b/doc/tex/pgpcert.xml.tex @@ -1,7 +1,9 @@ \begin{verbatim} - + + + BD572CDCCCC07C3 BE615E88D6CFF27225B8A2E7BD572CDCCCC07C35 @@ -51,6 +53,7 @@ 1011533167 BD572CDCCCC07C3 - + + \end{verbatim} diff --git a/doc/tex/x509cert.xml.tex b/doc/tex/x509cert.xml.tex index d66aa4032e..0451be10c5 100644 --- a/doc/tex/x509cert.xml.tex +++ b/doc/tex/x509cert.xml.tex @@ -1,7 +1,9 @@ \begin{verbatim} - + + + 02 01 @@ -182,6 +184,7 @@ B73945273AF2A395EC54BF5DC669D953885A9D811A3B92909D24792D36A44EC27E1C463AF8738BEFD29B311CCE8C6D9661BEC30911DAABB39B8813382B32D2E259581EBCD26C495C083984763966FF35D1DEFE432891E610C85072578DA7423244A8F5997B41A1F44E61F4F22C94375775055A5E72F25D5E4557467A91BD4251 - + + \end{verbatim} diff --git a/lib/x509_xml.c b/lib/x509_xml.c index a8e1287664..2a051f49dd 100644 --- a/lib/x509_xml.c +++ b/lib/x509_xml.c @@ -173,8 +173,10 @@ static int normalize_name( ASN1_TYPE p, char* output, int output_size) return 0; } -#define XML_HEADER "\n" +#define XML_HEADER "\n\n" \ + "\n" +#define XML_FOOTER "\n" static int _gnutls_asn1_get_structure_xml(ASN1_TYPE structure, const char *name, @@ -195,6 +197,7 @@ _gnutls_asn1_get_structure_xml(ASN1_TYPE structure, const char *name, _gnutls_string_init( &str, malloc, realloc, free); STR_APPEND(XML_HEADER); + indent = 1; root = _asn1_find_node(structure, name); @@ -551,8 +554,9 @@ _gnutls_asn1_get_structure_xml(ASN1_TYPE structure, const char *name, } } + STR_APPEND(XML_FOOTER); APPEND( "\n\0", 2); - + *res = _gnutls_string2datum( &str); return 0; diff --git a/libextra/gnutls_openpgp.c b/libextra/gnutls_openpgp.c index 4544e2279b..84c769ab3e 100644 --- a/libextra/gnutls_openpgp.c +++ b/libextra/gnutls_openpgp.c @@ -1851,8 +1851,12 @@ gnutls_openpgp_key_to_xml( const gnutls_datum *cert, s = "\n\n"; rc = _gnutls_string_append_str( &string_xml_key, s ); if ( rc < 0 ) return rc; + + s = "\n"; + rc = _gnutls_string_append_str( &string_xml_key, s ); + if ( rc < 0 ) return rc; - s = "\n"; + s = " \n"; rc = _gnutls_string_append_str( &string_xml_key, s ); if ( rc < 0 ) return rc; @@ -1885,7 +1889,12 @@ gnutls_openpgp_key_to_xml( const gnutls_datum *cert, break; } } - s = "\n"; + s = " \n"; + rc = _gnutls_string_append_str( &string_xml_key, s ); + if ( rc < 0 ) return rc; + + + s = "\n"; rc = _gnutls_string_append_str( &string_xml_key, s ); if ( rc < 0 ) return rc; diff --git a/src/common.c b/src/common.c index f6ef4c5179..44360d5d48 100644 --- a/src/common.c +++ b/src/common.c @@ -1,10 +1,13 @@ #include +#include #include #include #include void print_cert_info(gnutls_session session); +#define XML + #define PRINTX(x,y) if (y[0]!=0) printf(" # %s %s\n", x, y) #define PRINT_DN(X) PRINTX( "CN:", X.common_name); \ PRINTX( "OU:", X.organizational_unit_name); \ @@ -49,6 +52,19 @@ void print_x509_info(gnutls_session session) if (cert_list_size <= 0) return; +#ifdef XML + { + gnutls_datum res; + + gnutls_x509_certificate_to_xml( &cert_list[0], &res, 0); + printf( res.data); + + free(res.data); + + return; + } +#endif + printf(" - Certificate info:\n"); printf(" # Certificate is valid since: %s", my_ctime( &activet)); @@ -125,6 +141,19 @@ void print_openpgp_info(gnutls_session session) if (cert_list_size > 0) { int algo, bits; +#ifdef XML + { + gnutls_datum res; + + gnutls_openpgp_key_to_xml( &cert_list[0], &res, 0); + printf( res.data); + + free(res.data); + + return; + } +#endif + printf(" # Key was created at: %s", my_ctime( &activet)); printf(" # Key expires: "); if (expiret != 0) diff --git a/src/gnutls-http-serv b/src/gnutls-http-serv index 78ab4925ae..396e3e5599 100755 --- a/src/gnutls-http-serv +++ b/src/gnutls-http-serv @@ -1,5 +1,6 @@ #! /bin/sh ./gnutls-serv --http --x509certfile x509/cert.pem --x509keyfile x509/key.pem --x509cafile x509/ca.pem \ - --srppasswd srp/tpasswd --srppasswdconf srp/tpasswd.conf $* + --srppasswd srp/tpasswd --srppasswdconf srp/tpasswd.conf \ + --pgpkeyfile openpgp/sec.asc --pgpcertfile openpgp/pub.asc $*