From 56c1e5aacaaec79b24453d406e7c2b218fa0cc9f Mon Sep 17 00:00:00 2001 From: me_desk Date: Mon, 7 Oct 2013 21:24:43 +0000 Subject: update from database schema 1 to 2 with importing old accounts and converting them to the new id formats; implemented new function PICA_get_id_from_cert_string git-svn-id: svn://localhost/project_picapica/trunk@276 fb96df88-216d-11de-830c-f3023f12d8ac --- PICA_client.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'PICA_client.c') diff --git a/PICA_client.c b/PICA_client.c index c11e244..de4aaf3 100755 --- a/PICA_client.c +++ b/PICA_client.c @@ -124,6 +124,23 @@ if (!x) return PICA_id_from_X509(x, id); } +int PICA_get_id_from_cert_string(const char *cert_pem, unsigned char *id) +{ +X509 *x; +BIO *biomem; + +biomem = BIO_new_mem_buf(cert_pem, -1); + +x = PEM_read_bio_X509(biomem, NULL, 0, NULL); + +if (!x) +{ + return 0; +} + +return PICA_id_from_X509(x, id); +} + static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) { //return 1 for self-signed certificates char buf[256]; -- cgit v1.2.1