*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ * USA.
*/
#include <config.h>
}
-/* Get the default certificate which is defined as the first one our
- keyDB returns and has a secret key available. */
+/* Get the default certificate which is defined as the first cabable
+ of signing our keyDB returns and has a secret key available. */
int
gpgsm_get_default_cert (ctrl_t ctrl, ksba_cert_t *r_cert)
{
keydb_release (hd);
return rc;
}
-
- p = gpgsm_get_keygrip_hexstring (cert);
- if (p)
+
+ if (!gpgsm_cert_use_sign_p (cert))
{
- if (!gpgsm_agent_havekey (ctrl, p))
+ p = gpgsm_get_keygrip_hexstring (cert);
+ if (p)
{
+ if (!gpgsm_agent_havekey (ctrl, p))
+ {
+ xfree (p);
+ keydb_release (hd);
+ *r_cert = cert;
+ return 0; /* got it */
+ }
xfree (p);
- keydb_release (hd);
- *r_cert = cert;
- return 0; /* got it */
}
- xfree (p);
}
-
+
ksba_cert_release (cert);
cert = NULL;
}
other certificate up in the chain to the Root-CA to the CMS
object. */
static int
-add_certificate_list (CTRL ctrl, ksba_cms_t cms, ksba_cert_t cert)
+add_certificate_list (ctrl_t ctrl, ksba_cms_t cms, ksba_cert_t cert)
{
gpg_error_t err;
int rc = 0;
keys used to sign are taken from SIGNERLIST or the default one will
be used if the value of this argument is NULL. */
int
-gpgsm_sign (CTRL ctrl, CERTLIST signerlist,
+gpgsm_sign (ctrl_t ctrl, certlist_t signerlist,
int data_fd, int detached, FILE *out_fp)
{
int i, rc;
const char *algoid;
int algo;
ksba_isotime_t signed_at;
- CERTLIST cl;
+ certlist_t cl;
int release_signerlist = 0;
kh = keydb_new (0);
}
ctrl->pem_name = "SIGNED MESSAGE";
- rc = gpgsm_create_writer (&b64writer, ctrl, out_fp, &writer);
+ rc = gpgsm_create_writer (&b64writer, ctrl, out_fp, NULL, &writer);
if (rc)
{
log_error ("can't create writer: %s\n", gpg_strerror (rc));
signerlist = xtrycalloc (1, sizeof *signerlist);
if (!signerlist)
{
- rc = OUT_OF_CORE (errno);
+ rc = out_of_core ();
ksba_cert_release (cert);
goto leave;
}