}
+static const char *
+map_input_enc (GpgmeData d)
+{
+ switch (gpgme_data_get_encoding (d))
+ {
+ case GPGME_DATA_ENCODING_NONE: break;
+ case GPGME_DATA_ENCODING_BINARY: return "--binary";
+ case GPGME_DATA_ENCODING_BASE64: return "--base64";
+ case GPGME_DATA_ENCODING_ARMOR: return "--armor";
+ }
+
+ return NULL;
+}
+
+
GpgmeError
_gpgme_gpgsm_op_decrypt (GpgsmObject gpgsm, GpgmeData ciph, GpgmeData plain)
{
return mk_error (Out_Of_Core);
gpgsm->input_data = ciph;
- err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server, 0);
+ err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server,
+ map_input_enc (gpgsm->input_data));
if (err)
return mk_error (General_Error); /* FIXME */
gpgsm->output_data = plain;
return mk_error (Out_Of_Core);
gpgsm->input_data = plain;
- err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server, 0);
+ err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server,
+ map_input_enc (gpgsm->input_data));
if (err)
return err;
gpgsm->output_data = ciph;
return mk_error (Out_Of_Core);
gpgsm->input_data = help_data;
- err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server, 0);
+ err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server,
+ map_input_enc (gpgsm->input_data));
if (err)
return err;
gpgsm->output_data = pubkey;
return mk_error (Out_Of_Core);
gpgsm->input_data = keydata;
- err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server, 0);
+ err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server,
+ map_input_enc (gpgsm->input_data));
if (err)
return err;
_gpgme_io_close (gpgsm->output_fd);
return err;
gpgsm->input_data = in;
- err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server, 0);
+ err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server,
+ map_input_enc (gpgsm->input_data));
if (err)
return err;
gpgsm->output_data = out;
return mk_error (Out_Of_Core);
gpgsm->input_data = sig;
- err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server, 0);
+ err = gpgsm_set_fd (gpgsm->assuan_ctx, "INPUT", gpgsm->input_fd_server,
+ map_input_enc (gpgsm->input_data));
if (err)
return err;
if (_gpgme_data_get_mode (text) == GPGME_DATA_MODE_IN)
}
GpgmeDataType;
+/* The possible encoding mode of GpgmeData objects. */
+typedef enum
+ {
+ GPGME_DATA_ENCODING_NONE = 0, /* i.e. not specified */
+ GPGME_DATA_ENCODING_BINARY = 1,
+ GPGME_DATA_ENCODING_BASE64 = 2,
+ GPGME_DATA_ENCODING_ARMOR = 3 /* Either PEM or OpenPGP Armor */
+ }
+GpgmeDataEncoding;
+
/* The possible signature stati. */
typedef enum
{
/* Return the type of the data buffer DH. */
GpgmeDataType gpgme_data_get_type (GpgmeData dh);
+/* Return the encoding attribute of the data buffer DH */
+GpgmeDataEncoding gpgme_data_get_encoding (GpgmeData dh);
+
+/* Set the encoding attribute of data buffer DH to ENC */
+GpgmeError gpgme_data_set_encoding (GpgmeData dh, GpgmeDataEncoding enc);
+
/* Reset the read pointer in DH. */
GpgmeError gpgme_data_rewind (GpgmeData dh);