Changeset 534

Show
Ignore:
Timestamp:
02/01/08 09:40:41
Author:
rachel
Message:

Added new high-level function: ops_encrypt_file.
Other minor changes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openpgpsdk/trunk/include/openpgpsdk/armour.h

    r533 r534  
    1010void ops_writer_push_clearsigned(ops_create_info_t *info, 
    1111                                  ops_create_signature_t *sig); 
    12 void ops_writer_push_armoured_message(ops_create_info_t *info, 
    13                                   ops_create_signature_t *sig); 
     12void ops_writer_push_armoured_message(ops_create_info_t *info); 
    1413void ops_writer_switch_to_armoured_signature(ops_create_info_t *info); 
  • openpgpsdk/trunk/include/openpgpsdk/crypto.h

    r516 r534  
    55#define OPS_CRYPTO_H 
    66 
     7#include "keyring.h" 
    78#include "util.h" 
    89#include "packet.h" 
     
    138139                             const struct ops_key_data *key); 
    139140 
     141void ops_encrypt_file(const char* input_filename, const char* output_filename, const ops_key_data_t *pub_key, const int use_armour); 
     142 
    140143#endif 
  • openpgpsdk/trunk/src/advanced/adv_armour.c

    r533 r534  
    11001100    } 
    11011101 
    1102 void ops_writer_push_armoured_message(ops_create_info_t *info, 
    1103                                 ops_create_signature_t *sig) 
    1104     { 
    1105     static char header[]="-----BEGIN PGP MESSAGE-----\r\nHash: "; 
    1106     const char *hash=ops_text_from_hash(ops_signature_get_hash(sig)); 
     1102void ops_writer_push_armoured_message(ops_create_info_t *info) 
     1103//                              ops_create_signature_t *sig) 
     1104    { 
     1105    static char header[]="-----BEGIN PGP MESSAGE-----\r\n"; 
     1106 
    11071107    base64_arg_t *base64; 
    11081108 
    11091109    ops_write(header,sizeof header-1,info); 
    1110     ops_write(hash,strlen(hash),info); 
    1111     ops_write("\r\n\r\n",4,info); 
     1110    ops_write("\r\n",2,info); 
    11121111    base64=ops_mallocz(sizeof *base64); 
    11131112    base64->checksum=CRC24_INIT; 
  • openpgpsdk/trunk/src/standard/Makefile.template

    r530 r534  
    1111all: Makefile headers .depend lib 
    1212 
    13 LIBOBJS = std_keyring.o std_print.o std_signature.o 
     13LIBOBJS = std_keyring.o std_print.o std_signature.o std_encrypt.o 
    1414 
    1515headers: 
  • openpgpsdk/trunk/src/standard/std_signature.c

    r533 r534  
    105105 
    106106    int fd_out=0; 
    107     ops_create_info_t *cinfo_out=NULL; 
     107    ops_create_info_t *cinfo=NULL; 
    108108 
    109109    ops_hash_algorithm_t hash_alg=OPS_HASH_SHA1; 
     
    133133    sig=ops_create_signature_new(); 
    134134    ops_signature_start_message_signature(sig,(ops_secret_key_t *)skey, hash_alg, sig_type); 
     135 
    135136    // set up output file 
    136     cinfo_out=ops_create_info_new(); 
    137     ops_writer_set_fd(cinfo_out,fd_out);  
     137    cinfo=ops_create_info_new(); 
     138    ops_writer_set_fd(cinfo,fd_out);  
    138139 
    139140    //  set armoured/not armoured here 
    140141    if (use_armour) 
    141         ops_writer_push_armoured_message(cinfo_out,sig); 
     142        ops_writer_push_armoured_message(cinfo); 
    142143 
    143144    if (debug) 
     
    145146 
    146147    // write one_pass_sig 
    147     ops_write_one_pass_sig(skey, hash_alg, sig_type, cinfo_out); 
     148    ops_write_one_pass_sig(skey, hash_alg, sig_type, cinfo); 
    148149 
    149150    // hash file contents 
     
    156157        { fprintf(stderr,"** Writing out data now\n"); } 
    157158 
    158     ops_write_literal_data_from_buf(ops_memory_get_data(mem_buf), ops_memory_get_length(mem_buf), OPS_LDT_BINARY, cinfo_out); 
     159    ops_write_literal_data_from_buf(ops_memory_get_data(mem_buf), ops_memory_get_length(mem_buf), OPS_LDT_BINARY, cinfo); 
    159160 
    160161    if (debug) 
     
    173174 
    174175    // write out sig 
    175     ops_write_signature(sig,(ops_public_key_t *)&skey->public_key,(ops_secret_key_t *)skey,cinfo_out); 
    176     ops_writer_close(cinfo_out); 
     176    ops_write_signature(sig,(ops_public_key_t *)&skey->public_key,(ops_secret_key_t *)skey,cinfo); 
     177    ops_writer_close(cinfo); 
    177178    close(fd_out); 
    178179 
    179     //    ops_writer_close(cinfo_ld); 
    180  
    181180    // tidy up 
     181    ops_create_info_delete(cinfo); 
    182182    ops_create_signature_delete(sig); 
    183183    ops_memory_free(mem_buf);