do_writecert (app_t app, ctrl_t ctrl,
              const char *certidstr,
              gpg_error_t (*pincb)(void*, const char *, char **),
              void *pincb_arg,
              const unsigned char *certdata, size_t certdatalen)
{
  (void)ctrl;
#if GNUPG_MAJOR_VERSION > 1
  if (strcmp (certidstr, "OPENPGP.3"))
    return gpg_error (GPG_ERR_INV_ID);
  if (!certdata || !certdatalen)
    return gpg_error (GPG_ERR_INV_ARG);
  if (!app->app_local->extcap.is_v2)
    return gpg_error (GPG_ERR_NOT_SUPPORTED);
  if (certdatalen > app->app_local->extcap.max_certlen_3)
    return gpg_error (GPG_ERR_TOO_LARGE);
  return do_setattr (app, "CERT-3", pincb, pincb_arg, certdata, certdatalen);
#else
  return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
#endif
}
do_writecert (app_t app, ctrl_t ctrl,
              const char *certidstr,
              gpg_error_t (*pincb)(void*, const char *, char **),
              void *pincb_arg,
              const unsigned char *certdata, size_t certdatalen)
{
  (void)ctrl;
#if GNUPG_MAJOR_VERSION > 1
  if (strcmp (certidstr, "OPENPGP.3"))
    return gpg_error (GPG_ERR_INV_ID);
  if (!certdata || !certdatalen)
    return gpg_error (GPG_ERR_INV_ARG);
  if (!app->app_local->extcap.is_v2)
    return gpg_error (GPG_ERR_NOT_SUPPORTED);
  if (certdatalen > app->app_local->extcap.max_certlen_3)
    return gpg_error (GPG_ERR_TOO_LARGE);
  return do_setattr (app, "CERT-3", pincb, pincb_arg, certdata, certdatalen);
#else
  return gpg_error (GPG_ERR_NOT_IMPLEMENTED);
#endif
}