• Main Page
  • Files
  • File List
  • File Members

aegis_certman.h

Go to the documentation of this file.
00001 /* -*- mode:c++; tab-width:4; c-basic-offset:4; -*-
00002  *
00003  * This file is part of maemo-security-certman
00004  *
00005  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
00006  *
00007  * Contact: Juhani Mäkelä <ext-juhani.3.makela@nokia.com>
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public License
00011  * version 2.1 as published by the Free Software Foundation.
00012  *
00013  * This library is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this library; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00021  * 02110-1301 USA
00022  *
00023  */
00024 
00035 #ifndef AEGIS_CERTMAN_H
00036 #define AEGIS_CERTMAN_H
00037 
00038 #include <openssl/x509.h>
00039 #include <openssl/x509v3.h>
00040 #include <openssl/sha.h>
00041 #include "aegis_common.h"
00042 
00043 #ifdef  __cplusplus
00044 extern "C" {
00045 #endif
00046 
00053     #define AEGIS_CERTMAN_DOMAIN_PRIVATE 0
00054     
00059     #define AEGIS_CERTMAN_DOMAIN_SHARED 1
00060     
00067     typedef void* domain_handle;
00068 
00074     #define AEGIS_CERTMAN_DOMAIN_NONE (void*)(0)
00075 
00080     #define AEGIS_KEY_ID_LEN SHA_DIGEST_LENGTH
00081 
00088     typedef unsigned char aegis_key_id [AEGIS_KEY_ID_LEN];
00089 
00095     #define AEGIS_KEY_ID_STR_LEN 2*SHA_DIGEST_LENGTH + 1
00096 
00104     int aegis_certman_key_id_to_str(aegis_key_id key_id,
00105                                     char* to_buf,
00106                                     unsigned max_len);
00107 
00114     int aegis_certman_str_to_key_id(char* from_str,
00115                                     aegis_key_id key_id);
00116 
00117 
00119 
00120 
00128     int aegis_certman_open(X509_STORE** my_cert_store);
00129 
00139     int aegis_certman_collect(const char* domain, 
00140                               int shared, 
00141                               X509_STORE* my_cert_store);
00142 
00148     int aegis_certman_close(X509_STORE* my_cert_store);
00149 
00151 
00153 
00154 
00168     int aegis_certman_iterate_domains(int flags,
00169                                       aegis_callback* cb_func,
00170                                       void* ctx);
00171 
00181     int aegis_certman_set_credentials(const char* token_name);
00182 
00193     int aegis_certman_open_domain(const char* domain_name, 
00194                                   int flags, 
00195                                   domain_handle* handle);
00196 
00216     int aegis_certman_iterate_certs(domain_handle the_domain, 
00217                                     int cb_func(int, X509*, void*), 
00218                                     void* ctx);
00219 
00220 
00230     int aegis_certman_load_cert(domain_handle the_domain, 
00231                                 aegis_key_id with_id, 
00232                                 X509** cert);
00233 
00245     int aegis_certman_add_cert(domain_handle to_domain, X509* cert);
00246 
00259     int aegis_certman_add_certs(domain_handle to_domain, 
00260                                 char* cert_files[], 
00261                                 unsigned count);
00262 
00274     int aegis_certman_rm_cert(domain_handle from_domain, aegis_key_id key_id);
00275 
00281     int aegis_certman_nbrof_certs(domain_handle in_domain);
00282 
00291     int aegis_certman_close_domain(domain_handle handle);
00292 
00299     int aegis_certman_domain_changed(domain_handle the_domain);
00300 
00308     int aegis_certman_get_key_id(X509* of_cert, aegis_key_id to_this);
00309 
00318     int aegis_certman_store_key(aegis_key_id with_id, 
00319                                 EVP_PKEY* the_key, 
00320                                 char* with_passwd);
00321 
00332     int aegis_certman_retrieve_key(aegis_key_id with_id, 
00333                                    EVP_PKEY** the_key, 
00334                                    char* with_passwd);
00335 
00346     int aegis_certman_iterate_keys(aegis_callback* cb_func, void* ctx);
00347 
00356     int aegis_certman_get_nickname(X509* of_cert, 
00357                                    char* to_buf, 
00358                                    unsigned buf_len);
00359 
00360     /*
00361      * TODO: Document
00362      */
00363     int aegis_certman_has_private_key(X509* cert);
00364     int aegis_certman_has_private_key_by_id(aegis_key_id key_id);
00365 
00372     int aegis_certman_gui_check_certificate(X509 *cert, long timeout);
00373 
00385     int aegis_certman_gui_get_private_key(aegis_key_id with_id, 
00386                                           const char* with_credentials, 
00387                                           long timeout, 
00388                                           EVP_PKEY** the_key);
00389 
00418     int aegis_certman_gui_get_private_key_async(aegis_key_id with_id,
00419                                       const char* with_credentials,
00420                                       long timeout,
00421                                       void (*notify)(void *, int, EVP_PKEY *),
00422                                       void* state);
00423 
00451     int aegis_certman_gui_check_certificate_async(X509 *cert,
00452                                       long timeout,
00453                                       void (*notify)(void*, int),
00454                                       void* state);
00455 
00480     void aegis_certman_gui_poll(long wait);
00481 
00483 
00484 #ifdef  __cplusplus
00485 } // extern "C"
00486 #endif
00487 
00488 #endif

Generated on Tue Jun 28 2011 14:40:53 for Aegis Certman by  doxygen 1.7.1