using Callback Based Data Buffers with Java
hans at guardianproject.info
Tue Jul 16 03:19:09 CEST 2013
On 07/15/2013 06:03 PM, Werner Koch wrote:
> On Mon, 15 Jul 2013 22:44, hans at guardianproject.info said:
>> For the GnuPGData.c implementation of the Java class that corresponds to
>> gpgme_data_t, it needs to include both gpgme.h and data.h since it needs to
> No way. data.h is internal to gpgme and not part of the API. It may
> change with any release. Internal data structures may never be used by
> other applications or even language bindings. The reason why
> gpgme_data_t is an opaque pointer is just to not expose it in the API.
> A language binding need to take this as an opaque pointer and is not
> allowed to assume anything about it. The only exception is NULL, which
> means that the data object is not allocated.
Ok, that makes sense. So I have to figure out the proper way here. I'm using
gpgme_data_new_from_stream() in gpgmeDataNewFromFilename():
FILE* stream = fopen(filename_str, mode_str);
gpgme_error_t err = gpgme_data_new_from_stream(&data, stream);
Then in gpgmeDataRelease(), I believe I'm responsible for closing that stream.
So I need to maintain the FILE *stream outside of gpgme_data_t? I looked
around a lot for examples of code that uses gpgme_data_new_from_stream() and
gpgme_data_new_from_cbs() but didn't find any. I'd love some pointers for that.
PGP fingerprint: 5E61 C878 0F86 295C E17D 8677 9F0F E587 374B BE81
More information about the Gnupg-devel