static PyObject *sendAuthChallenge(PyObject *self, PyObject *args) { //cn, domain, reqid, publicKey //return answer to challenge int cn; char *domain; uint id; char *publicKey; server::clientinfo *ci; if(!PyArg_ParseTuple(args, "isIs", &cn, &domain, &id, &publicKey)) return 0; ci = server::getinfo(cn); if(!ci) { PyErr_SetString(PyExc_ValueError, "Invalid cn specified"); return 0; } uint seed[3] = { randomMT(), randomMT(), randomMT() }; vector<char> challengeBuf; vector<char> answerBuf; void *parsedKey = parsepubkey(publicKey); genchallengestr(parsedKey, seed, sizeof(seed), challengeBuf, answerBuf); freepubkey(parsedKey); sendf(ci->clientnum, 1, "risis", N_AUTHCHAL, domain, id, challengeBuf.getbuf()); return Py_BuildValue("s", answerBuf.getbuf()); }
~key() { if(m_key) freepubkey(m_key); }