int certify(int argc, char **argv) { char *id; char *public; int count = IBE_threshold(params); char **sfiles; int i; byte_string_t master; byte_string_t pub; byte_string_t cert; if (argc < 2) { printf("Usage: certify ID SHAREFILES\n\n"); printf("Creates a certificate for the ID, signed by share\n"); return 1; } id = IBE_system(params); public = argv[1];
int request(int argc, char **argv) { int default_port; char **servers; int status; int t = IBE_threshold(params); char **hostname = malloc (sizeof(char *) *t); int * port = malloc (sizeof(int) * t); int i; int success; netstartupjunk(); if (argc < 2) { fprintf(stderr, "Usage: request ID\n"); return(1); } SSL_library_init(); ssl_ctx = SSL_CTX_new(SSLv3_method()); if (!ssl_ctx) { fprintf(stderr, "SSL_CTX_new: failure\n"); return(-1); } emailaddr = argv[1]; default_port = GetIntParam(cnfctx, "default_port", 0, 31831); printf("Threshold: %d\n", t); servers = GetListParam(cnfctx, "servers", 0, NULL); if (!servers) { fprintf(stderr, "no servers given in config file\n"); return(1); } SSL_library_init(); for (i=success=0; success<t; i++) { int len; int j; if (!servers[i]) { fprintf(stderr, "not enough working servers\n"); return(1); } len = strlen(servers[i]); for (j=0; j<len && servers[i][j] != ':'; j++); hostname[i] = (char *) malloc(j + 1); memcpy(hostname[i], servers[i], j); hostname[i][j] = 0; if (j >= len - 1) { port[i] = default_port; } else { port[i] = atoi(&servers[i][j+1]); } printf("trying: %s:%d\n", hostname[i], port[i]); status = single_request(hostname[i], port[i]); if (status == 1) success++; } for (i=0; i<t; i++) { free(hostname[i]); } return(0); }