00001 /** 00002 * @file ccn/keystore.h 00003 * 00004 * KEYSTORE interface. 00005 * 00006 * This is a veneer so that the ccn code can avoid exposure to the 00007 * underlying keystore implementation types. 00008 * 00009 * Part of the CCNx C Library. 00010 * 00011 * Copyright (C) 2009 Palo Alto Research Center, Inc. 00012 * 00013 * This library is free software; you can redistribute it and/or modify it 00014 * under the terms of the GNU Lesser General Public License version 2.1 00015 * as published by the Free Software Foundation. 00016 * This library is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 * Lesser General Public License for more details. You should have received 00020 * a copy of the GNU Lesser General Public License along with this library; 00021 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, 00022 * Fifth Floor, Boston, MA 02110-1301 USA. 00023 */ 00024 00025 #ifndef CCN_KEYSTORE_DEFINED 00026 #define CCN_KEYSTORE_DEFINED 00027 00028 #include <stddef.h> 00029 00030 /* 00031 * opaque type for key storage 00032 */ 00033 struct ccn_keystore; 00034 00035 /* 00036 * opaque type for public and private keys 00037 */ 00038 struct ccn_pkey; 00039 00040 /* 00041 * opaque type for (X509) certificates 00042 */ 00043 struct ccn_certificate; 00044 00045 struct ccn_keystore *ccn_keystore_create(void); 00046 void ccn_keystore_destroy(struct ccn_keystore **p); 00047 int ccn_keystore_init(struct ccn_keystore *p, char *name, char *password); 00048 const struct ccn_pkey *ccn_keystore_private_key(struct ccn_keystore *p); 00049 const struct ccn_pkey *ccn_keystore_public_key(struct ccn_keystore *p); 00050 const char *ccn_keystore_digest_algorithm(struct ccn_keystore *p); 00051 ssize_t ccn_keystore_public_key_digest_length(struct ccn_keystore *p); 00052 const unsigned char *ccn_keystore_public_key_digest(struct ccn_keystore *p); 00053 const struct ccn_certificate *ccn_keystore_certificate(struct ccn_keystore *p); 00054 int ccn_keystore_file_init(char *filename, char *password, char *subject, int keylength, int validity_days); 00055 #endif