create.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_CREATE_H
00026 #define OPS_CREATE_H
00027 
00028 #include <openpgpsdk/types.h>
00029 #include <openpgpsdk/packet.h>
00030 #include <openpgpsdk/crypto.h>
00031 #include <openpgpsdk/memory.h>
00032 #include <openpgpsdk/errors.h>
00033 #include <openpgpsdk/keyring.h>
00034 #include <openpgpsdk/writer.h>
00035 
00040 struct ops_create_info
00041     {
00042     ops_writer_info_t winfo;
00043     ops_error_t *errors;        
00044     };
00045 
00046 void ops_prepare_parent_info(ops_create_info_t *parent_info,
00047                              ops_writer_info_t *winfo);
00048 ops_create_info_t *ops_create_info_new(void);
00049 void ops_create_info_delete(ops_create_info_t *info);
00050 
00051 ops_memory_t* ops_write_mem_from_file(const char *filename, int* errnum);
00052 int ops_write_file_from_buf(const char *filename, const char* buf, const size_t len, const ops_boolean_t overwrite);
00053 
00054 ops_boolean_t ops_calc_session_key_checksum(ops_pk_session_key_t *session_key, unsigned char *cs);
00055 void ops_build_public_key(ops_memory_t *out,const ops_public_key_t *key,
00056                           ops_boolean_t make_packet);
00057 ops_boolean_t ops_write_struct_user_id(ops_user_id_t *id,
00058                                        ops_create_info_t *info);
00059 ops_boolean_t ops_write_struct_public_key(const ops_public_key_t *key,
00060                                           ops_create_info_t *info);
00061 
00062 ops_boolean_t ops_write_ss_header(unsigned length,ops_content_tag_t type,
00063                                   ops_create_info_t *info);
00064 ops_boolean_t ops_write_struct_secret_key(const ops_secret_key_t *key,
00065                                           const unsigned char* passphrase,
00066                                           const size_t pplen,
00067                                           ops_create_info_t *info);
00068 ops_boolean_t ops_write_one_pass_sig(const ops_secret_key_t* skey,
00069                                      const ops_hash_algorithm_t hash_alg,
00070                                      const ops_sig_type_t sig_type,
00071                                      ops_create_info_t* info);
00072 ops_boolean_t ops_write_literal_data_from_buf(const unsigned char *data, 
00073                                               const int maxlen, 
00074                                               const ops_literal_data_type_t type,
00075                                               ops_create_info_t *info);
00076 ops_pk_session_key_t *ops_create_pk_session_key(const ops_keydata_t *key);
00077 ops_boolean_t ops_write_pk_session_key(ops_create_info_t *info,
00078                                        ops_pk_session_key_t *pksk);
00079 ops_boolean_t ops_write_transferable_public_key(const ops_keydata_t *key, ops_boolean_t armoured, ops_create_info_t *info);
00080 ops_boolean_t ops_write_transferable_secret_key(const ops_keydata_t *key, const unsigned char* passphrase, const size_t pplen, ops_boolean_t armoured, ops_create_info_t *info);
00081 
00082 #endif /*OPS_CREATE_H*/
00083 
00084 // eof

Generated on Mon May 20 00:00:02 2013 for OpenPGP:SDK by  doxygen 1.4.6