Beispiel #1
0
static gpg_error_t
register_commands (assuan_context_t ctx)
{
  static struct
  {
    const char *name;
    gpg_error_t (*handler) (assuan_context_t, char *line);
  } table[] =
      {
	{ "ECHO", cmd_echo },
	{ "INPUT", NULL },
	{ "OUTPUT", NULL },
	{ NULL, NULL }
      };
  int i;
  gpg_error_t rc;

  for (i=0; table[i].name; i++)
    {
      rc = assuan_register_command (ctx, table[i].name, table[i].handler, NULL);
      if (rc)
        return rc;
    }
  return 0;
}
Beispiel #2
0
/** Register commands with assuan. */
static
int
register_commands (const assuan_context_t ctx)
{
	static struct {
		const char *name;
		assuan_handler_t handler;
		const char * const help;
	} table[] = {
		{ "SERIALNO",	cmd_serialno, NULL },
		{ "LEARN",	cmd_learn, NULL },
		{ "READCERT",	cmd_readcert, NULL },
		{ "READKEY",	cmd_readkey, NULL },
		{ "KEY-DATA",	NULL, NULL },
		{ "SETDATA",	cmd_setdata, NULL },
		{ "PKSIGN",	cmd_pksign, NULL },
		{ "PKAUTH",	NULL, NULL },
		{ "PKDECRYPT",	cmd_pkdecrypt, NULL },
		{ "INPUT",	NULL, NULL }, 
		{ "OUTPUT",	NULL, NULL }, 
		{ "GETATTR",	cmd_getattr, NULL },
		{ "SETATTR",	cmd_setattr, NULL },
		{ "WRITECERT",	NULL, NULL },
		{ "WRITEKEY",	NULL, NULL },
		{ "GENKEY",	cmd_genkey, NULL },
		{ "RANDOM",	NULL, NULL },
		{ "PASSWD",	NULL, NULL },
		{ "CHECKPIN",	cmd_null, NULL },
		{ "LOCK",	NULL, NULL },
		{ "UNLOCK",	NULL, NULL },
		{ "GETINFO",	cmd_getinfo, NULL },
		{ "RESTART",	cmd_restart, NULL },
		{ "DISCONNECT",	cmd_null, NULL },
		{ "APDU",	NULL, NULL },
		{ "CHV-STATUS-1", cmd_null, NULL },	/* gnupg-1.X */
		{ NULL, NULL, NULL }
	};
	int i, ret;

	for(i=0; table[i].name; i++) {
		if (
			(ret = assuan_register_command (
				ctx,
				table[i].name,
				table[i].handler,
				table[i].help
			))
		) {
			return ret;
		}
	} 

	assuan_set_hello_line (ctx, "PKCS#11 smart-card server for GnuPG ready");
	/*assuan_register_reset_notify(ctx, reset_notify);*/
	/*assuan_register_option_handler(ctx, option_handler);*/
	return 0;
}
Beispiel #3
0
/* Helper to register the standards commands */
gpg_error_t
_assuan_register_std_commands (assuan_context_t ctx)
{
  gpg_error_t rc;
  int i;

  for (i = 0; std_cmd_table[i].name; i++)
    {
      if (std_cmd_table[i].always)
        {
          rc = assuan_register_command (ctx, std_cmd_table[i].name, NULL, NULL);
          if (rc)
            return rc;
        }
    }
  return 0;
}
Beispiel #4
0
/* Tell the assuan library about our commands */
static int
register_commands (assuan_context_t ctx)
{
  static struct {
    const char *name;
    assuan_handler_t handler;
    const char * const help;
  } table[] = {
    { "RECIPIENT",     cmd_recipient, hlp_recipient },
    { "SIGNER",        cmd_signer,    hlp_signer },
    { "ENCRYPT",       cmd_encrypt,   hlp_encrypt },
    { "DECRYPT",       cmd_decrypt,   hlp_decrypt },
    { "VERIFY",        cmd_verify,    hlp_verify },
    { "SIGN",          cmd_sign,      hlp_sign },
    { "IMPORT",        cmd_import,    hlp_import },
    { "EXPORT",        cmd_export,    hlp_export },
    { "INPUT",         NULL,          hlp_input },
    { "OUTPUT",        NULL,          hlp_output },
    { "MESSAGE",       cmd_message,   hlp_message },
    { "LISTKEYS",      cmd_listkeys,  hlp_listkeys },
    { "DUMPKEYS",      cmd_dumpkeys,  hlp_listkeys },
    { "LISTSECRETKEYS",cmd_listsecretkeys, hlp_listkeys },
    { "DUMPSECRETKEYS",cmd_dumpsecretkeys, hlp_listkeys },
    { "GENKEY",        cmd_genkey,    hlp_genkey },
    { "DELKEYS",       cmd_delkeys,   hlp_delkeys },
    { "GETAUDITLOG",   cmd_getauditlog,    hlp_getauditlog },
    { "GETINFO",       cmd_getinfo,   hlp_getinfo },
    { "PASSWD",        cmd_passwd,    hlp_passwd },
    { NULL }
  };
  int i, rc;

  for (i=0; table[i].name; i++)
    {
      rc = assuan_register_command (ctx, table[i].name, table[i].handler,
                                    table[i].help);
      if (rc)
        return rc;
    }
  return 0;
}
Beispiel #5
0
/* Tell the assuan library about our commands.  */
static int
register_commands (ASSUAN_CONTEXT ctx)
{
  static struct
  {
    const char *name;
    int cmd_id;
    int (*handler) (ASSUAN_CONTEXT, char *line);
  } table[] =
    {
      { "SETDESC",    0,  cmd_setdesc },
      { "SETPROMPT",  0,  cmd_setprompt },
      { "SETERROR",   0,  cmd_seterror },
      { "SETOK",      0,  cmd_setok },
      { "SETNOTOK",   0,  cmd_setnotok },
      { "SETCANCEL",  0,  cmd_setcancel },
      { "GETPIN",     0,  cmd_getpin },
      { "CONFIRM",    0,  cmd_confirm },
      { "MESSAGE",    0,  cmd_message },
      { "SETQUALITYBAR", 0,  cmd_setqualitybar },
      { "SETQUALITYBAR_TT", 0,  cmd_setqualitybar_tt },
      { "GETINFO",    0,  cmd_getinfo },
      { "SETTITLE",   0,  cmd_settitle },
      { NULL }
    };
  int i, j, rc;

  for (i = j = 0; table[i].name; i++)
    {
      rc = assuan_register_command (ctx,
                                    table[i].cmd_id ? table[i].cmd_id
                                                   : (ASSUAN_CMD_USER + j++),
                                    table[i].name, table[i].handler);
      if (rc)
        return rc;
    } 
  return 0;
}
Beispiel #6
0
/* Helper to register our commands with libassuan. */
static int
register_commands (assuan_context_t ctx)
{
  static struct 
  {
    const char *name;
    assuan_handler_t handler;
  } table[] = {
    { "RECIPIENT",     cmd_recipient },
    { "SIGNER",        cmd_signer    },
    { "ENCRYPT",       cmd_encrypt   },
    { "DECRYPT",       cmd_decrypt   },
    { "VERIFY",        cmd_verify    },
    { "SIGN",          cmd_sign      },
    { "IMPORT",        cmd_import    },
    { "EXPORT",        cmd_export    },
    { "INPUT",         NULL          }, 
    { "OUTPUT",        NULL          }, 
    { "MESSAGE",       cmd_message   },
    { "LISTKEYS",      cmd_listkeys  },
    { "LISTSECRETKEYS",cmd_listsecretkeys },
    { "GENKEY",        cmd_genkey    },
    { "DELKEYS",       cmd_delkeys   },
    { "GETINFO",       cmd_getinfo   },
    { NULL }
  };
  int i, rc;

  for (i=0; table[i].name; i++)
    {
      rc = assuan_register_command (ctx, table[i].name, table[i].handler, NULL);
      if (rc)
        return rc;
    } 
  return 0;
}