1 /* signers.c - maintain signer sets
2 * Copyright (C) 2001 Werner Koch (dd9jn)
3 * Copyright (C) 2001 g10 Code GmbH
5 * This file is part of GPGME.
7 * GPGME is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * GPGME is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
31 /* The signers are directly stored in the context.
32 * So this is quite different to a recipient set.
37 gpgme_signers_clear (GpgmeCtx c)
45 for (i=0; i < c->signers_size; i++ ) {
48 gpgme_key_unref (c->signers[i]);
55 gpgme_signers_add (GpgmeCtx c, const GpgmeKey key)
60 return mk_error (Invalid_Value);
65 for (i=0; i < c->signers_size && c->signers[i]; i++ )
67 if ( !(i < c->signers_size) ) {
70 int n = c->signers_size + 5;
72 newarr = xtrycalloc ( n, sizeof *newarr );
74 return mk_error (Out_Of_Core);
75 for (j=0; j < c->signers_size; j++ )
76 newarr[j] = c->signers[j];
88 gpgme_signers_enum (const GpgmeCtx c, int seq )
92 return_null_if_fail (c);
93 return_null_if_fail (seq>=0);
97 for (i=0; i < c->signers_size && c->signers[i]; i++ ) {
99 gpgme_key_ref (c->signers[i]);
100 return c->signers[i];