From: Nikos Mavrogiannopoulos Date: Thu, 13 May 2004 21:53:04 +0000 (+0000) Subject: removed gnutls_const_datum type. X-Git-Tag: gnutls_1_1_11~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0c65f2ec50eda689c8c2cb99fad351bc5670023d;p=thirdparty%2Fgnutls.git removed gnutls_const_datum type. --- diff --git a/doc/tex/ex-pkcs12.tex b/doc/tex/ex-pkcs12.tex index 137f4d98c7..71fba2fa24 100644 --- a/doc/tex/ex-pkcs12.tex +++ b/doc/tex/ex-pkcs12.tex @@ -29,7 +29,6 @@ int write_pkcs12(const gnutls_datum * cert, const gnutls_datum * pkcs8_key, gnutls_datum key_id = { "\x00\x00\x07", 3 }; gnutls_global_init(); - gnutls_global_set_log_level(2); /* Firstly we create two helper bags, which hold the certificate, * and the (encrypted) key. @@ -58,7 +57,9 @@ int write_pkcs12(const gnutls_datum * cert, const gnutls_datum * pkcs8_key, */ gnutls_pkcs12_bag_set_key_id(bag, bag_index, &key_id); - gnutls_pkcs12_bag_encrypt(bag, password, 0); + /* use weak encryption for the certificate. + */ + gnutls_pkcs12_bag_encrypt(bag, password, GNUTLS_PKCS_USE_PKCS12_RC2_40); /* Now the key. */ @@ -71,8 +72,8 @@ int write_pkcs12(const gnutls_datum * cert, const gnutls_datum * pkcs8_key, exit(1); } - /* Note that since the PKCS #8 key is encrypted we don't - * bother encrypting the bag. + /* Note that since the PKCS #8 key is already encrypted we don't + * bother encrypting that bag. */ bag_index = ret; diff --git a/doc/tex/examples.tex b/doc/tex/examples.tex index 5b642a1357..863fa7fd24 100644 --- a/doc/tex/examples.tex +++ b/doc/tex/examples.tex @@ -107,13 +107,14 @@ The following example is about generating a certificate request, and a private key. A certificate request can be later be processed by a CA, which should return a signed certificate. +\input{ex-crq} + \subsection{PKCS \#12 structure generation} \label{ex:pkcs12} The following example is about generating a PKCS \#12 structure. \input{ex-pkcs12} -\input{ex-crq} \input{openssl} diff --git a/includes/gnutls/pkcs12.h b/includes/gnutls/pkcs12.h index 59d8bb3b92..0a2503236d 100644 --- a/includes/gnutls/pkcs12.h +++ b/includes/gnutls/pkcs12.h @@ -65,7 +65,7 @@ typedef enum gnutls_pkcs12_bag_type { } gnutls_pkcs12_bag_type; gnutls_pkcs12_bag_type gnutls_pkcs12_bag_get_type(gnutls_pkcs12_bag bag, int indx); -int gnutls_pkcs12_bag_get_data(gnutls_pkcs12_bag bag, int indx, gnutls_const_datum* data); +int gnutls_pkcs12_bag_get_data(gnutls_pkcs12_bag bag, int indx, gnutls_datum* data); int gnutls_pkcs12_bag_set_data(gnutls_pkcs12_bag bag, gnutls_pkcs12_bag_type type, const gnutls_datum* data); int gnutls_pkcs12_bag_set_crl(gnutls_pkcs12_bag bag, gnutls_x509_crl crl); diff --git a/lib/gnutls.h.in.in b/lib/gnutls.h.in.in index a961f262bd..07be18d25f 100644 --- a/lib/gnutls.h.in.in +++ b/lib/gnutls.h.in.in @@ -193,11 +193,6 @@ typedef struct { } gnutls_datum; -typedef struct { - const unsigned char * data; - unsigned int size; -} gnutls_const_datum; - /* internal functions */ int gnutls_init(gnutls_session * session, gnutls_connection_end con_end); diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h index 40743a02b9..47aecbfb79 100644 --- a/lib/gnutls_int.h +++ b/lib/gnutls_int.h @@ -146,11 +146,6 @@ typedef struct { unsigned int size; } gnutls_datum; -typedef struct { - const opaque * data; - unsigned int size; -} gnutls_const_datum; - #include /* This is the maximum number of algorithms (ciphers or macs etc). diff --git a/lib/x509/pkcs12_bag.c b/lib/x509/pkcs12_bag.c index 466f4e7970..622b225964 100644 --- a/lib/x509/pkcs12_bag.c +++ b/lib/x509/pkcs12_bag.c @@ -134,7 +134,7 @@ int gnutls_pkcs12_bag_get_count(gnutls_pkcs12_bag bag) * This function will return the bag's data. * **/ -int gnutls_pkcs12_bag_get_data(gnutls_pkcs12_bag bag, int indx, gnutls_const_datum * data) +int gnutls_pkcs12_bag_get_data(gnutls_pkcs12_bag bag, int indx, gnutls_datum * data) { if (bag == NULL) { gnutls_assert(); diff --git a/src/certtool.c b/src/certtool.c index 98fe2aa0c5..62fd598ac8 100644 --- a/src/certtool.c +++ b/src/certtool.c @@ -2228,9 +2228,9 @@ void print_bag_data(gnutls_pkcs12_bag bag) { int result; int count, i, type; -gnutls_const_datum cdata; +gnutls_datum cdata; const char* str; -gnutls_datum out, data; +gnutls_datum out; count = gnutls_pkcs12_bag_get_count( bag); if (count < 0) { @@ -2274,14 +2274,8 @@ gnutls_datum out, data; str = NULL; } - /* we have to cast gnutls_const_datum to a - * plain datum. - */ - data.data = (unsigned char*)cdata.data; - data.size = cdata.size; - if (str != NULL) { - gnutls_pem_base64_encode_alloc( str, &data, &out); + gnutls_pem_base64_encode_alloc( str, &cdata, &out); fprintf( outfile, "%s\n", out.data); gnutls_free(out.data);