diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2004-05-13 21:55:30 +0000 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2004-05-13 21:55:30 +0000 |
commit | 9bf2bac8a7c13e353ce789fc408f4757febaa9e3 (patch) | |
tree | 1b8b2480cb3c9e7939404effd7e0eb31251afc56 | |
parent | e26e51e198cf8428cbf87155f2aae06ccbae247f (diff) | |
download | gnutls-9bf2bac8a7c13e353ce789fc408f4757febaa9e3.tar.gz |
removed gnutls_const_datum type.
-rw-r--r-- | doc/tex/ex-pkcs12.tex | 9 | ||||
-rw-r--r-- | doc/tex/examples.tex | 3 | ||||
-rw-r--r-- | lib/gnutls.h.in.in | 6 | ||||
-rw-r--r-- | lib/gnutls_int.h | 5 | ||||
-rw-r--r-- | lib/x509/pkcs12_bag.c | 2 | ||||
-rw-r--r-- | src/certtool.c | 12 |
6 files changed, 12 insertions, 25 deletions
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/lib/gnutls.h.in.in b/lib/gnutls.h.in.in index a961f262bd..114f348bda 100644 --- a/lib/gnutls.h.in.in +++ b/lib/gnutls.h.in.in @@ -192,11 +192,7 @@ typedef struct { unsigned int size; } gnutls_datum; - -typedef struct { - const unsigned char * data; - unsigned int size; -} gnutls_const_datum; +#define gnutls_const_datum gnutls_datum /* internal functions */ diff --git a/lib/gnutls_int.h b/lib/gnutls_int.h index 5c41b9d145..3646f5b555 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 <gnutls_buffer.h> /* 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); |