Index: openpgpsdk/trunk/include/openpgpsdk/armour.h =================================================================== --- openpgpsdk/trunk/include/openpgpsdk/armour.h (revision 533) +++ openpgpsdk/trunk/include/openpgpsdk/armour.h (revision 534) @@ -10,5 +10,4 @@ void ops_writer_push_clearsigned(ops_create_info_t *info, ops_create_signature_t *sig); -void ops_writer_push_armoured_message(ops_create_info_t *info, - ops_create_signature_t *sig); +void ops_writer_push_armoured_message(ops_create_info_t *info); void ops_writer_switch_to_armoured_signature(ops_create_info_t *info); Index: openpgpsdk/trunk/include/openpgpsdk/crypto.h =================================================================== --- openpgpsdk/trunk/include/openpgpsdk/crypto.h (revision 516) +++ openpgpsdk/trunk/include/openpgpsdk/crypto.h (revision 534) @@ -5,4 +5,5 @@ #define OPS_CRYPTO_H +#include "keyring.h" #include "util.h" #include "packet.h" @@ -138,3 +139,5 @@ const struct ops_key_data *key); +void ops_encrypt_file(const char* input_filename, const char* output_filename, const ops_key_data_t *pub_key, const int use_armour); + #endif Index: openpgpsdk/trunk/src/advanced/adv_armour.c =================================================================== --- openpgpsdk/trunk/src/advanced/adv_armour.c (revision 533) +++ openpgpsdk/trunk/src/advanced/adv_armour.c (revision 534) @@ -1100,14 +1100,13 @@ } -void ops_writer_push_armoured_message(ops_create_info_t *info, - ops_create_signature_t *sig) - { - static char header[]="-----BEGIN PGP MESSAGE-----\r\nHash: "; - const char *hash=ops_text_from_hash(ops_signature_get_hash(sig)); +void ops_writer_push_armoured_message(ops_create_info_t *info) +// ops_create_signature_t *sig) + { + static char header[]="-----BEGIN PGP MESSAGE-----\r\n"; + base64_arg_t *base64; ops_write(header,sizeof header-1,info); - ops_write(hash,strlen(hash),info); - ops_write("\r\n\r\n",4,info); + ops_write("\r\n",2,info); base64=ops_mallocz(sizeof *base64); base64->checksum=CRC24_INIT; Index: openpgpsdk/trunk/src/standard/Makefile.template =================================================================== --- openpgpsdk/trunk/src/standard/Makefile.template (revision 530) +++ openpgpsdk/trunk/src/standard/Makefile.template (revision 534) @@ -11,5 +11,5 @@ all: Makefile headers .depend lib -LIBOBJS = std_keyring.o std_print.o std_signature.o +LIBOBJS = std_keyring.o std_print.o std_signature.o std_encrypt.o headers: Index: openpgpsdk/trunk/src/standard/std_signature.c =================================================================== --- openpgpsdk/trunk/src/standard/std_signature.c (revision 533) +++ openpgpsdk/trunk/src/standard/std_signature.c (revision 534) @@ -105,5 +105,5 @@ int fd_out=0; - ops_create_info_t *cinfo_out=NULL; + ops_create_info_t *cinfo=NULL; ops_hash_algorithm_t hash_alg=OPS_HASH_SHA1; @@ -133,11 +133,12 @@ sig=ops_create_signature_new(); ops_signature_start_message_signature(sig,(ops_secret_key_t *)skey, hash_alg, sig_type); + // set up output file - cinfo_out=ops_create_info_new(); - ops_writer_set_fd(cinfo_out,fd_out); + cinfo=ops_create_info_new(); + ops_writer_set_fd(cinfo,fd_out); // set armoured/not armoured here if (use_armour) - ops_writer_push_armoured_message(cinfo_out,sig); + ops_writer_push_armoured_message(cinfo); if (debug) @@ -145,5 +146,5 @@ // write one_pass_sig - ops_write_one_pass_sig(skey, hash_alg, sig_type, cinfo_out); + ops_write_one_pass_sig(skey, hash_alg, sig_type, cinfo); // hash file contents @@ -156,5 +157,5 @@ { fprintf(stderr,"** Writing out data now\n"); } - ops_write_literal_data_from_buf(ops_memory_get_data(mem_buf), ops_memory_get_length(mem_buf), OPS_LDT_BINARY, cinfo_out); + ops_write_literal_data_from_buf(ops_memory_get_data(mem_buf), ops_memory_get_length(mem_buf), OPS_LDT_BINARY, cinfo); if (debug) @@ -173,11 +174,10 @@ // write out sig - ops_write_signature(sig,(ops_public_key_t *)&skey->public_key,(ops_secret_key_t *)skey,cinfo_out); - ops_writer_close(cinfo_out); + ops_write_signature(sig,(ops_public_key_t *)&skey->public_key,(ops_secret_key_t *)skey,cinfo); + ops_writer_close(cinfo); close(fd_out); - // ops_writer_close(cinfo_ld); - // tidy up + ops_create_info_delete(cinfo); ops_create_signature_delete(sig); ops_memory_free(mem_buf);