~logan/ubuntu/wily/pinentry/0.9.2

« back to all changes in this revision

Viewing changes to pinentry/pinentry.h

  • Committer: Logan Rosen
  • Date: 2015-05-26 02:53:55 UTC
  • mfrom: (4.1.8 sid)
  • Revision ID: logan@ubuntu.com-20150526025355-xv8gmurkxvx2qai1
Tags: 0.9.2-1ubuntu1
* Merge from Debian unstable. Remaining changes:
  - debian/patches/kubuntu_fix_stayontop.diff: Make pinentry stay on top.
* Refresh patch.
* debian/rules: Install README.Debian in all packages instead of using
  symlinks.
* new upstream version (Closes: #516489)
* add pinentry-tty package (Closes: #782888)
* debian/copyright: use DEP5
* use --enable-pinentry-qt4-clipboard (Closes: #637029)
* terminate politely if TTY vanishes (Closes: #559936)
* use dh-autoreconf
* New Upstream Release
* Bringing package under team maintenance, with Peter's agreement.
* Non-maintainer upload
* new upstream release (Closes: #765532)
* bumped Standards-Version to 3.9.6 (no changes needed)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* pinentry.h - The interface for the PIN entry support library.
2
 
   Copyright (C) 2002, 2003, 2010 g10 Code GmbH
3
 
   
 
2
   Copyright (C) 2002, 2003, 2010, 2015 g10 Code GmbH
 
3
 
4
4
   This file is part of PINENTRY.
5
 
   
 
5
 
6
6
   PINENTRY is free software; you can redistribute it and/or modify it
7
7
   under the terms of the GNU General Public License as published by
8
8
   the Free Software Foundation; either version 2 of the License, or
9
9
   (at your option) any later version.
10
 
 
 
10
 
11
11
   PINENTRY is distributed in the hope that it will be useful, but
12
12
   WITHOUT ANY WARRANTY; without even the implied warranty of
13
13
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
14
   General Public License for more details.
15
 
 
 
15
 
16
16
   You should have received a copy of the GNU General Public License
17
 
   along with this program; if not, see <http://www.gnu.org/licenses/>. 
 
17
   along with this program; if not, see <http://www.gnu.org/licenses/>.
18
18
 */
19
19
 
20
20
#ifndef PINENTRY_H
22
22
 
23
23
#ifdef __cplusplus
24
24
extern "C" {
25
 
#if 0 
 
25
#if 0
26
26
}
27
27
#endif
28
28
#endif
57
57
  char *pin;
58
58
  /* The length of the buffer.  */
59
59
  int pin_len;
 
60
  /* Whether the pin was read from an external cache (1) or entered by
 
61
     the user (0). */
 
62
  int pin_from_cache;
60
63
 
61
64
  /* The name of the X display to use if X is available and supported.  */
62
65
  char *display;
101
104
     conversion occured. */
102
105
  int locale_err;
103
106
 
 
107
  /* The user should set this to an gpg-error so that commands are
 
108
     abale to return specific error codes.  This is an ugly hack due
 
109
     to the fact that pinentry_cmd_handler_t return the length of the
 
110
     passphrase or an negative error code.  */
 
111
  int specific_err;
 
112
 
104
113
  /* The user should set this to true if the window close button has
105
114
     been used.  This flag is used in addition to a regular return
106
115
     value.  */
111
120
     dismiss button is required. */
112
121
  int one_button;
113
122
 
 
123
  /* If true a second prompt for the passphrase is shown and the user
 
124
     is expected to enter the same passphrase again.  Pinentry checks
 
125
     that both match.  */
 
126
  char *repeat_passphrase;
 
127
 
 
128
  /* The string to show if a repeated passphrase does not match.  */
 
129
  char *repeat_error_string;
 
130
 
 
131
  /* Set to true if the passphrase has been entered a second time and
 
132
     matches the first passphrase.  */
 
133
  int repeat_okay;
 
134
 
114
135
  /* If this is not NULL, a passphrase quality indicator is shown.
115
136
     There will also be an inquiry back to the caller to get an
116
137
     indication of the quality for the passphrase entered so far.  The
133
154
  char *default_ok;
134
155
  char *default_cancel;
135
156
  char *default_prompt;
 
157
  char *default_pwmngr;
 
158
 
 
159
  /* Whether we are allowed to read the password from an external
 
160
     cache.  */
 
161
  int allow_external_password_cache;
 
162
 
 
163
  /* We only try the cache once.  */
 
164
  int tried_password_cache;
 
165
 
 
166
  /* A stable identifier for the key.  */
 
167
  char *keyinfo;
 
168
 
 
169
  /* Whether we may cache the password (according to the user).  */
 
170
  int may_cache_password;
 
171
 
 
172
  /* NOTE: If you add any additional fields to this structure, be sure
 
173
     to update the initializer in pinentry/pinentry.c!!!  */
136
174
 
137
175
  /* For the quality indicator we need to do an inquiry.  Thus we need
138
176
     to save the assuan ctx.  */
146
184
   PIN.  If PIN->pin is zero, request a confirmation, otherwise a PIN
147
185
   entry.  On confirmation, the function should return TRUE if
148
186
   confirmed, and FALSE otherwise.  On PIN entry, the function should
149
 
   return -1 if cancelled and the length of the secret otherwise.  */
 
187
   return -1 if an error occured or the user cancelled the operation
 
188
   and the length of the secret otherwise.  */
150
189
typedef int (*pinentry_cmd_handler_t) (pinentry_t pin);
151
190
 
152
191
/* Start the pinentry event loop.  The program will start to process
161
200
 
162
201
/* Convert the UTF-8 encoded string TEXT to the encoding given in
163
202
   LC_CTYPE.  Return NULL on error. */
164
 
char *pinentry_utf8_to_local (char *lc_ctype, char *text);
 
203
char *pinentry_utf8_to_local (const char *lc_ctype, const char *text);
165
204
 
166
205
/* Convert TEXT which is encoded according to LC_CTYPE to UTF-8.  With
167
206
   SECURE set to true, use secure memory for the returned buffer.
170
209
 
171
210
 
172
211
/* Run a quality inquiry for PASSPHRASE of LENGTH. */
173
 
int pinentry_inq_quality (pinentry_t pin, 
 
212
int pinentry_inq_quality (pinentry_t pin,
174
213
                          const char *passphrase, size_t length);
175
214
 
176
215
/* Try to make room for at least LEN bytes for the pin in the pinentry
185
224
   "--display". */
186
225
int pinentry_have_display (int argc, char **argv);
187
226
 
188
 
/* Parse the command line options.  Returns 1 if user should print
189
 
   version and exit.  Can exit the program if only help output is
190
 
   requested.  */
191
 
int pinentry_parse_opts (int argc, char *argv[]);
 
227
/* Parse the command line options.  May exit the program if only help
 
228
   or version output is requested.  */
 
229
void pinentry_parse_opts (int argc, char *argv[]);
192
230
 
193
231
 
194
232
/* The caller must define this variable to process assuan commands.  */
206
244
 
207
245
 
208
246
 
209
 
#if 0 
 
247
#if 0
210
248
{
211
249
#endif
212
250
#ifdef __cplusplus