Encrypt or Decrypt File
[High Level API]


Functions

ops_boolean_t ops_encrypt_file (const char *input_filename, const char *output_filename, const ops_keydata_t *pub_key, const ops_boolean_t use_armour, const ops_boolean_t allow_overwrite)
 Encrypt a file.
void ops_encrypt_stream (ops_create_info_t *cinfo, const ops_keydata_t *public_key, const ops_secret_key_t *secret_key, const ops_boolean_t compress, const ops_boolean_t use_armour)
 Encrypt a compressed, signed stream.
ops_boolean_t ops_decrypt_memory (const unsigned char *encrypted_memory, int em_length, unsigned char **decrypted_memory, int *out_length, ops_keyring_t *keyring, const ops_boolean_t use_armour, ops_parse_cb_t *cb_get_passphrase)
 Decrypt a chunk of memory, containing a encrypted stream.
ops_boolean_t ops_decrypt_file (const char *input_filename, const char *output_filename, ops_keyring_t *keyring, const ops_boolean_t use_armour, const ops_boolean_t allow_overwrite, ops_parse_cb_t *cb_get_passphrase)
 Decrypt a file.

Function Documentation

ops_boolean_t ops_decrypt_file const char *  input_filename,
const char *  output_filename,
ops_keyring_t keyring,
const ops_boolean_t  use_armour,
const ops_boolean_t  allow_overwrite,
ops_parse_cb_t *  cb_get_passphrase
 

Decrypt a file.

Parameters:
input_filename Name of file to be decrypted
output_filename Name of file to write to. If NULL, the filename is constructed from the input filename, following GPG conventions.
keyring Keyring to use
use_armour Expect armoured text, if set
allow_overwrite Allow output file to overwritten, if set.
cb_get_passphrase Callback to use to get passphrase

ops_boolean_t ops_decrypt_memory const unsigned char *  encrypted_memory,
int  em_length,
unsigned char **  decrypted_memory,
int *  out_length,
ops_keyring_t keyring,
const ops_boolean_t  use_armour,
ops_parse_cb_t *  cb_get_passphrase
 

Decrypt a chunk of memory, containing a encrypted stream.

Parameters:
input_filename Name of file to be decrypted
output_filename Name of file to write to. If NULL, the filename is constructed from the input filename, following GPG conventions.
keyring Keyring to use
use_armour Expect armoured text, if set
allow_overwrite Allow output file to overwritten, if set.
cb_get_passphrase Callback to use to get passphrase

ops_boolean_t ops_encrypt_file const char *  input_filename,
const char *  output_filename,
const ops_keydata_t pub_key,
const ops_boolean_t  use_armour,
const ops_boolean_t  allow_overwrite
 

Encrypt a file.

Parameters:
input_filename Name of file to be encrypted
output_filename Name of file to write to. If NULL, name is constructed from input_filename
pub_key Public Key to encrypt file for
use_armour Write armoured text, if set
allow_overwrite Allow output file to be overwrwritten if it exists
Returns:
ops_true if OK; else ops_false

void ops_encrypt_stream ops_create_info_t cinfo,
const ops_keydata_t public_key,
const ops_secret_key_t secret_key,
const ops_boolean_t  compress,
const ops_boolean_t  use_armour
 

Encrypt a compressed, signed stream.

Parameters:
cinfo the structure describing where the output will be written.
public_key the key used to encrypt the data
secret_key the key used to sign the data. If NULL, the data will not be signed
compress If true, compress the stream before encrypting
use_armour Write armoured text, if set
See also:
ops_setup_file_write
Example Code:
    const char* filename = "armour_nocompress_sign.asc";
    ops_create_info_t *info;
    int fd = ops_setup_file_write(&info, filename, ops_true);
    if (fd < 0) {
      fprintf(stderr, "Cannot write to %s\n", filename);
      return -1;
    }
    ops_encrypt_stream(info, public_key, secret_key, ops_false, ops_true);
    ops_write(cleartext, strlen(cleartext), info);
    ops_writer_close(info);
    ops_create_info_delete(info);


Generated on Sun May 19 00:00:02 2013 for OpenPGP:SDK by  doxygen 1.4.6