| 511 /* Obtain the output size required */ |
511 /* Obtain the output size required */ |
| 512 ret = gnutls_x509_crt_export(crt_dat, GNUTLS_X509_FMT_PEM, |
512 ret = gnutls_x509_crt_export(crt_dat, GNUTLS_X509_FMT_PEM, |
| 513 NULL, /* Provide no buffer yet */ |
513 NULL, /* Provide no buffer yet */ |
| 514 &out_size /* Put size here */ |
514 &out_size /* Put size here */ |
| 515 ); |
515 ); |
| 516 g_return_val_if_fail(ret == 0, FALSE); |
516 g_return_val_if_fail(ret == GNUTLS_E_SHORT_MEMORY_BUFFER, FALSE); |
| 517 |
517 |
| 518 /* Now allocate a buffer and *really* export it */ |
518 /* Now allocate a buffer and *really* export it */ |
| 519 out_buf = g_new0(gchar, out_size); |
519 out_buf = g_new0(gchar, out_size); |
| 520 ret = gnutls_x509_crt_export(crt_dat, GNUTLS_X509_FMT_PEM, |
520 ret = gnutls_x509_crt_export(crt_dat, GNUTLS_X509_FMT_PEM, |
| 521 out_buf, /* Export to our new buffer */ |
521 out_buf, /* Export to our new buffer */ |