signature.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2005-2008 Nominet UK (www.nic.uk)
00003  * All rights reserved.
00004  * Contributors: Ben Laurie, Rachel Willmer. The Contributors have asserted
00005  * their moral rights under the UK Copyright Design and Patents Act 1988 to
00006  * be recorded as the authors of this copyright work.
00007  *
00008  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
00009  * use this file except in compliance with the License. 
00010  * 
00011  * You may obtain a copy of the License at 
00012  *     http://www.apache.org/licenses/LICENSE-2.0 
00013  * 
00014  * Unless required by applicable law or agreed to in writing, software 
00015  * distributed under the License is distributed on an "AS IS" BASIS, 
00016  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
00017  * 
00018  * See the License for the specific language governing permissions and
00019  * limitations under the License.
00020  */
00021 
00025 #ifndef OPS_SIGNATURE_H
00026 #define OPS_SIGNATURE_H
00027 
00028 #include "packet.h"
00029 #include "util.h"
00030 #include "create.h"
00031 
00032 typedef struct ops_create_signature ops_create_signature_t;
00033 
00034 ops_create_signature_t *ops_create_signature_new(void);
00035 void ops_create_signature_delete(ops_create_signature_t *sig);
00036 
00037 ops_boolean_t
00038 ops_check_user_id_certification_signature(const ops_public_key_t *key,
00039                                           const ops_user_id_t *id,
00040                                           const ops_signature_t *sig,
00041                                           const ops_public_key_t *signer,
00042                                           const unsigned char *raw_packet);
00043 ops_boolean_t
00044 ops_check_user_attribute_certification_signature(const ops_public_key_t *key,
00045                                                  const ops_user_attribute_t *attribute,
00046                                                  const ops_signature_t *sig,
00047                                                  const ops_public_key_t *signer,
00048                                                  const unsigned char *raw_packet);
00049 ops_boolean_t
00050 ops_check_subkey_signature(const ops_public_key_t *key,
00051                            const ops_public_key_t *subkey,
00052                            const ops_signature_t *sig,
00053                            const ops_public_key_t *signer,
00054                            const unsigned char *raw_packet);
00055 ops_boolean_t
00056 ops_check_direct_signature(const ops_public_key_t *key,
00057                            const ops_signature_t *sig,
00058                            const ops_public_key_t *signer,
00059                            const unsigned char *raw_packet);
00060 ops_boolean_t
00061 ops_check_hash_signature(ops_hash_t *hash,
00062                          const ops_signature_t *sig,
00063                          const ops_public_key_t *signer);
00064 void ops_signature_start_key_signature(ops_create_signature_t *sig,
00065                                        const ops_public_key_t *key,
00066                                        const ops_user_id_t *id,
00067                                        ops_sig_type_t type);
00068 void ops_signature_start_cleartext_signature(ops_create_signature_t *sig,
00069                                              const ops_secret_key_t *key,
00070                                              const ops_hash_algorithm_t hash,
00071                                              const ops_sig_type_t type);
00072 void ops_signature_start_message_signature(ops_create_signature_t *sig,
00073                                              const ops_secret_key_t *key,
00074                                              const ops_hash_algorithm_t hash,
00075                                              const ops_sig_type_t type);
00076 
00077 void ops_signature_add_data(ops_create_signature_t *sig,const void *buf,
00078                             size_t length);
00079 ops_hash_t *ops_signature_get_hash(ops_create_signature_t *sig);
00080 ops_boolean_t ops_signature_hashed_subpackets_end(ops_create_signature_t *sig);
00081 ops_boolean_t ops_write_signature(ops_create_signature_t *sig,const ops_public_key_t *key,
00082                          const ops_secret_key_t *skey, ops_create_info_t *opt);
00083 ops_boolean_t ops_signature_add_creation_time(ops_create_signature_t *sig,time_t when);
00084 ops_boolean_t ops_signature_add_issuer_key_id(ops_create_signature_t *sig,
00085                                      const unsigned char keyid[OPS_KEY_ID_SIZE]);
00086 void ops_signature_add_primary_user_id(ops_create_signature_t *sig,
00087                                        ops_boolean_t primary);
00088 
00089 // Standard Interface
00090 ops_boolean_t ops_sign_file_as_cleartext(const char* input_filename,
00091                                          const char* output_filename,
00092                                          const ops_secret_key_t *skey,
00093                                          const ops_boolean_t overwrite);
00094 ops_boolean_t ops_sign_buf_as_cleartext(const char* input,
00095                                         const size_t len, ops_memory_t** output,
00096                                         const ops_secret_key_t *skey);
00097 ops_boolean_t ops_sign_file(const char* input_filename,
00098                             const char* output_filename,
00099                             const ops_secret_key_t *skey,
00100                             const ops_boolean_t use_armour,
00101                             const ops_boolean_t overwrite);
00102 ops_memory_t * ops_sign_buf(const void* input,
00103                             const size_t input_len,
00104                             const ops_sig_type_t sig_type,
00105                             const ops_secret_key_t *skey,
00106                             const ops_boolean_t use_armour,
00107                             ops_boolean_t include_data);
00108 ops_boolean_t ops_writer_push_signed(ops_create_info_t *cinfo,
00109                                      const ops_sig_type_t sig_type,
00110                                      const ops_secret_key_t *skey);
00111 
00112 #endif

Generated on Wed May 22 00:00:02 2013 for OpenPGP:SDK by  doxygen 1.4.6