signing.h

Go to the documentation of this file.
00001 /**
00002  * @file ccn/signing.h
00003  * 
00004  * Message signing interface.
00005  * This is a veneer so that the ccn code can use various underlying
00006  * implementations of the signature functions without muss and fuss.
00007  *
00008  * Part of the CCNx C Library.
00009  *
00010  * Copyright (C) 2008, 2009 Palo Alto Research Center, Inc.
00011  *
00012  * This library is free software; you can redistribute it and/or modify it
00013  * under the terms of the GNU Lesser General Public License version 2.1
00014  * as published by the Free Software Foundation.
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * Lesser General Public License for more details. You should have received
00019  * a copy of the GNU Lesser General Public License along with this library;
00020  * if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
00021  * Fifth Floor, Boston, MA 02110-1301 USA.
00022  */
00023 
00024 #ifndef CCN_SIGNING_DEFINED
00025 #define CCN_SIGNING_DEFINED
00026 
00027 #include <stddef.h>
00028 #include <ccn/charbuf.h>
00029 
00030 /*
00031  * opaque type for signing context
00032  */
00033 struct ccn_sigc;
00034 
00035 /*
00036  * opaque type for public and private keys
00037  */
00038 struct ccn_pkey;
00039 
00040 /*
00041  * opaque type for signature
00042  */
00043 struct ccn_signature;
00044 
00045 /*
00046  * see ccn/ccn.h
00047  */
00048 struct ccn_parsed_ContentObject;
00049 
00050 struct ccn_sigc *ccn_sigc_create(void);
00051 int ccn_sigc_init(struct ccn_sigc *ctx, const char *digest);
00052 void ccn_sigc_destroy(struct ccn_sigc **);
00053 int ccn_sigc_update(struct ccn_sigc *ctx, const void *data, size_t size);
00054 int ccn_sigc_final(struct ccn_sigc *ctx, struct ccn_signature *signature, size_t *size, const struct ccn_pkey *priv_key);
00055 size_t ccn_sigc_signature_max_size(struct ccn_sigc *ctx, const struct ccn_pkey *priv_key);
00056 int ccn_verify_signature(const unsigned char *msg, size_t size, const struct ccn_parsed_ContentObject *co,
00057                          const struct ccn_pkey *verification_pubkey);
00058 struct ccn_pkey *ccn_d2i_pubkey(const unsigned char *p, size_t size);
00059 void ccn_pubkey_free(struct ccn_pkey *i_pubkey); /* use for result of ccn_d2i_pubkey */
00060 size_t ccn_pubkey_size(const struct ccn_pkey *i_pubkey);
00061 
00062 /*
00063  * ccn_append_pubkey_blob: append a ccnb-encoded blob of the external
00064  * public key, given the internal form
00065  * Returns -1 for error
00066  */
00067 int ccn_append_pubkey_blob(struct ccn_charbuf *c, const struct ccn_pkey *i_pubkey);
00068 
00069 #endif

Generated on Thu Feb 16 00:43:59 2012 for Content-Centric Networking in C by  doxygen 1.5.6