1
/* simple-pwquery.c - A simple password query cleint for gpg-agent
2
* Copyright (C) 2002 Free Software Foundation, Inc.
4
* This file is part of GnuPG.
6
* GnuPG is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
9
* (at your option) any later version.
11
* GnuPG is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
21
#ifndef SIMPLE_PWQUERY_H
22
#define SIMPLE_PWQUERY_H
24
#ifdef SIMPLE_PWQUERY_IMPLEMENTATION /* Begin configuration stuff. */
26
/* Include whatever files you need. */
28
#include "../jnlib/logging.h"
30
/* Try to write error message using the standard log mechanism. The
31
current implementation requires that the HAVE_JNLIB_LOGGING is also
33
#define SPWQ_USE_LOGGING 1
35
/* Memory allocation functions used by the implementation. Note, that
36
the returned value is expected to be freed with
38
#define spwq_malloc(a) gcry_malloc (a)
39
#define spwq_free(a) gcry_free (a)
40
#define spwq_secure_malloc(a) gcry_malloc_secure (a)
41
#define spwq_secure_free(a) gcry_free (a)
44
#endif /*SIMPLE_PWQUERY_IMPLEMENTATION*/ /* End configuration stuff. */
47
/* Ask the gpg-agent for a passphrase and present the user with a
48
DESCRIPTION, a PROMPT and optiaonlly with a TRYAGAIN extra text.
49
If a CACHEID is not NULL it is used to locate the passphrase in in
50
the cache and store it under this ID. If ERRORCODE is not NULL it
51
should point a variable receiving an errorcode; thsi errocode might
52
be 0 if the user canceled the operation. The function returns NULL
53
to indicate an error. */
54
char *simple_pwquery (const char *cacheid,
57
const char *description,
61
#define SPWQ_OUT_OF_CORE 1
62
#define SPWQ_IO_ERROR 2
63
#define SPWQ_PROTOCOL_ERROR 3
64
#define SPWQ_ERR_RESPONSE 4
65
#define SPWQ_NO_AGENT 5
66
#define SPWQ_SYS_ERROR 6
67
#define SPWQ_GENERAL_ERROR 7
69
#endif /*SIMPLE_PWQUERY_H*/