Skip to content
Snippets Groups Projects
Commit 83f950f5 authored by Dmitriy A. Gerasimov's avatar Dmitriy A. Gerasimov
Browse files

[*] Some updates

parent c8422b7a
Branches master rct
No related tags found
No related merge requests found
......@@ -51,7 +51,7 @@ PyObject* dap_cert_cert_signs_py(PyObject *self, PyObject *args);
PyObject* dap_cert_compare_py(PyObject *self, PyObject *args);
PyObject* dap_cert_save_py(PyObject *self, PyObject *args);
PyObject* dap_cert_load_py(PyObject *self, PyObject *args);
PyObject* dap_cert_close_py(PyObject *self, PyObject *args);
void dap_cert_delete_py(PyObject *self);
PyObject* dap_cert_folder_add_py(PyObject *self, PyObject *args);
PyObject* dap_cert_folder_get_py(PyObject *self, PyObject *args);
......@@ -67,8 +67,7 @@ static PyMethodDef g_crypto_cert_methods_py[] = {
{"certSignAdd", dap_cert_cert_sign_add_py, METH_VARARGS, ""},
{"certSigns", dap_cert_cert_signs_py, METH_VARARGS , ""},
{"compare", dap_cert_compare_py, METH_VARARGS, ""},
{"save", dap_cert_save_py, METH_VARARGS , ""},
{"close", dap_cert_close_py, METH_VARARGS , ""},
{"save", dap_cert_save_py, METH_VARARGS , "Save to the first directory in cert folders list"},
{NULL, NULL, 0, NULL}
};
......@@ -77,7 +76,7 @@ static PyTypeObject g_crypto_cert_type_py = {
"CellFrame.Cert", /* tp_name */
sizeof(PyCryptoCertObject), /* tp_basicsize */
0, /* tp_itemsize */
0, /* tp_dealloc */
dap_cert_delete_py, /* tp_dealloc */
0, /* tp_print */
0, /* tp_getattr */
0, /* tp_setattr */
......@@ -112,6 +111,16 @@ static PyTypeObject g_crypto_cert_type_py = {
0, /* tp_init */
0, /* tp_alloc */
PyType_GenericNew, /* tp_new */
0,
0,
0,
0,
0,
0,
0,
0,
0,
0
};
#ifdef __cplusplus
......
......@@ -41,7 +41,7 @@ PyObject* dap_cert_generate_py(PyObject *self, PyObject *args)
const char *l_arg_seed_string = NULL;
if (!PyArg_ParseTuple(args, "sis", &l_arg_cert_name, &l_arg_cert_key_type, &l_arg_seed_string) ){
PyErr_SetString(PyExc_SyntaxError, "Wrong arguments list");
PyErr_SetString(PyExc_SyntaxError, "Wrong arguments list in function call");
return NULL;
}
......@@ -126,11 +126,9 @@ PyObject* dap_cert_compare_py(PyObject *self, PyObject *args)
PyObject* dap_cert_save_py(PyObject *self, PyObject *args)
{
(void) self;
(void) args;
/// TODO: Implement it!
PyErr_SetString(PyExc_TypeError, "Unimplemented function");
return NULL;
int res = dap_cert_save_to_folder(((PyCryptoCertObject*)self)->cert, dap_cert_get_folder(0) );
return PyLong_FromLong(res);
}
PyObject* dap_cert_load_py(PyObject *self, PyObject *args)
......@@ -151,6 +149,15 @@ PyObject* dap_cert_close_py(PyObject *self, PyObject *args)
return NULL;
}
void dap_cert_delete_py(PyObject *self)
{
PyCryptoCertObject *certObject = (PyCryptoCertObject *)self;
dap_cert_delete( certObject->cert );
Py_TYPE(certObject)->tp_free((PyObject*)certObject);
}
PyObject* dap_cert_folder_add_py(PyObject *self, PyObject *args)
{
(void) self;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment