Create
[Core API]

These functions allow an OpenPGP object to be created. More...

Functions

ops_boolean_t ops_write_ss_header (unsigned length, ops_content_tag_t type, ops_create_info_t *info)
void ops_fast_create_user_id (ops_user_id_t *id, unsigned char *user_id)
 ops_fast_create_user_id() sets id->user_id to the given user_id.
void ops_fast_create_rsa_public_key (ops_public_key_t *key, time_t time, BIGNUM *n, BIGNUM *e)
void ops_build_public_key (ops_memory_t *out, const ops_public_key_t *key, ops_boolean_t make_packet)
void ops_fast_create_rsa_secret_key (ops_secret_key_t *key, time_t time, BIGNUM *d, BIGNUM *p, BIGNUM *q, BIGNUM *u, BIGNUM *n, BIGNUM *e)
 Create an RSA secret key structure.
ops_create_info_tops_create_info_new (void)
 Create a new ops_create_info_t structure.
void ops_create_info_delete (ops_create_info_t *info)
 Delete an ops_create_info_t strucut and associated resources.
ops_boolean_t ops_calc_session_key_checksum (ops_pk_session_key_t *session_key, unsigned char cs[2])
 Calculate the checksum for a session key.
ops_boolean_t encode_m_buf (const unsigned char *M, size_t mLen, const ops_public_key_t *pkey, unsigned char *EM)
 implementation of EME-PKCS1-v1_5-ENCODE, as defined in OpenPGP RFC
ops_pk_session_key_tops_create_pk_session_key (const ops_keydata_t *key)
 Creates an ops_pk_session_key_t struct from keydata.
void ops_packet_free (ops_packet_t *packet)
 Free allocated memory.
void ops_headers_free (ops_headers_t *headers)
 Free allocated memory.
void ops_signed_cleartext_trailer_free (ops_signed_cleartext_trailer_t *trailer)
 Free allocated memory.
void ops_cmd_get_passphrase_free (ops_secret_key_passphrase_t *skp)
 Free allocated memory.
void ops_parser_content_free (ops_parser_content_t *c)
 Free allocated memory.
void ops_pk_session_key_free (ops_pk_session_key_t *sk)
 Free allocated memory.
void ops_public_key_free (ops_public_key_t *p)
 Free allocated memory.
void ops_ss_regexp_free (ops_ss_regexp_t *regexp)
 Free allocated memory.
void ops_ss_policy_url_free (ops_ss_policy_url_t *policy_url)
 Free allocated memory.
void ops_ss_preferred_key_server_free (ops_ss_preferred_key_server_t *preferred_key_server)
 Free allocated memory.
void ops_user_attribute_free (ops_user_attribute_t *user_att)
 Free allocated memory.
void ops_user_id_free (ops_user_id_t *id)
 Free allocated memory.
void free_unknown_sig_pka (ops_unknown_signature_t *unknown_sig)
 Free the memory used when parsing a private/experimental PKA signature.
void ops_signature_free (ops_signature_t *sig)
 Free the memory used when parsing a signature.
void ops_ss_preferred_ska_free (ops_ss_preferred_ska_t *ss_preferred_ska)
 Free the memory used when parsing this signature sub-packet type.
void ops_ss_preferred_hash_free (ops_ss_preferred_hash_t *ss_preferred_hash)
 Free the memory used when parsing this signature sub-packet type.
void ops_ss_preferred_compression_free (ops_ss_preferred_compression_t *ss_preferred_compression)
 Free the memory used when parsing this signature sub-packet type.
void ops_ss_key_flags_free (ops_ss_key_flags_t *ss_key_flags)
 Free the memory used when parsing this signature sub-packet type.
void ops_ss_features_free (ops_ss_features_t *ss_features)
 Free the memory used when parsing this signature sub-packet type.
void ops_ss_key_server_prefs_free (ops_ss_key_server_prefs_t *ss_key_server_prefs)
 Free the memory used when parsing this signature sub-packet type.
void ops_ss_userdefined_free (ops_ss_userdefined_t *ss_userdefined)
 Free the memory used when parsing this signature sub-packet type.
void ops_ss_reserved_free (ops_ss_unknown_t *ss_unknown)
 Free the memory used when parsing this signature sub-packet type.
void ops_ss_notation_data_free (ops_ss_notation_data_t *ss_notation_data)
 Free the memory used when parsing this signature sub-packet type.
void ops_ss_revocation_reason_free (ops_ss_revocation_reason_t *ss_revocation_reason)
 Free the memory used when parsing this signature sub-packet type.
void ops_trust_free (ops_trust_t *trust)
 Free the memory used when parsing this packet type.
void ops_secret_key_free (ops_secret_key_t *key)
 ops_secret_key_free() frees the memory associated with "key".
ops_boolean_t encode_hash_buf (const unsigned char *M, size_t mLen, const ops_hash_algorithm_t hash_alg, unsigned char *EM)
 implementation of EMSA-PKCS1-v1_5, as defined in OpenPGP RFC

Detailed Description

These functions allow an OpenPGP object to be created.


Function Documentation

ops_boolean_t encode_hash_buf const unsigned char *  M,
size_t  mLen,
const ops_hash_algorithm_t  hash_alg,
unsigned char *  EM
 

implementation of EMSA-PKCS1-v1_5, as defined in OpenPGP RFC

Parameters:
M 
mLen 
hash_alg Hash algorithm to use
EM 
Returns:
ops_true if OK; else ops_false

ops_boolean_t encode_m_buf const unsigned char *  M,
size_t  mLen,
const ops_public_key_t pkey,
unsigned char *  EM
 

implementation of EME-PKCS1-v1_5-ENCODE, as defined in OpenPGP RFC

Parameters:
M 
mLen 
pkey 
EM 
Returns:
ops_true if OK; else ops_false

void free_unknown_sig_pka ops_unknown_signature_t unknown_sig  ) 
 

Free the memory used when parsing a private/experimental PKA signature.

Parameters:
unknown_sig 

void ops_build_public_key ops_memory_t out,
const ops_public_key_t key,
ops_boolean_t  make_packet
 

Parameters:
out 
key 
make_packet 

ops_boolean_t ops_calc_session_key_checksum ops_pk_session_key_t session_key,
unsigned char  cs[2]
 

Calculate the checksum for a session key.

Parameters:
session_key Session Key to use
cs Checksum to be written
Returns:
ops_true if OK; else ops_false

void ops_create_info_delete ops_create_info_t info  ) 
 

Delete an ops_create_info_t strucut and associated resources.

Delete an ops_create_info_t structure. If a writer is active, then that is also deleted.

Parameters:
info the structure to be deleted.

ops_create_info_t* ops_create_info_new void   ) 
 

Create a new ops_create_info_t structure.

Returns:
the new structure.
Note:
It is the responsiblity of the caller to call ops_create_info_delete().
See also:
ops_create_info_delete()

ops_pk_session_key_t* ops_create_pk_session_key const ops_keydata_t key  ) 
 

Creates an ops_pk_session_key_t struct from keydata.

Parameters:
key Keydata to use
Returns:
ops_pk_session_key_t struct
Note:
It is the caller's responsiblity to free the returned pointer. Before freeing, the key must be cleared by calling ops_pk_session_key_free()

Currently hard-coded to use CAST5

Currently hard-coded to use RSA

void ops_fast_create_rsa_public_key ops_public_key_t key,
time_t  time,
BIGNUM *  n,
BIGNUM *  e
 

Parameters:
key 
time 
n 
e 

void ops_fast_create_rsa_secret_key ops_secret_key_t key,
time_t  time,
BIGNUM *  d,
BIGNUM *  p,
BIGNUM *  q,
BIGNUM *  u,
BIGNUM *  n,
BIGNUM *  e
 

Create an RSA secret key structure.

If a parameter is marked as [OPTIONAL], then it can be omitted and will be calculated from other parameters - or, in the case of e, will default to 0x10001.

Parameters are _not_ copied, so will be freed if the structure is freed.

Parameters:
key The key structure to be initialised.
time 
d The RSA parameter d (=e^-1 mod (p-1)(q-1)) [OPTIONAL]
p The RSA parameter p
q The RSA parameter q (q > p)
u The RSA parameter u (=p^-1 mod q) [OPTIONAL]
n The RSA public parameter n (=p*q) [OPTIONAL]
e The RSA public parameter e

void ops_fast_create_user_id ops_user_id_t id,
unsigned char *  user_id
 

ops_fast_create_user_id() sets id->user_id to the given user_id.

This is fast because it is only copying a char*. However, if user_id is changed or freed in the future, this could have injurious results.

Parameters:
id 
user_id 

void ops_packet_free ops_packet_t packet  ) 
 

Free allocated memory.

Free packet memory, set pointer to NULL

void ops_parser_content_free ops_parser_content_t c  ) 
 

Free allocated memory.

Free any memory allocated when parsing the packet content

void ops_public_key_free ops_public_key_t p  ) 
 

Free allocated memory.

Free the memory used when parsing a public key

void ops_secret_key_free ops_secret_key_t key  ) 
 

ops_secret_key_free() frees the memory associated with "key".

Note that the key itself is not freed.

Parameters:
key 

void ops_signature_free ops_signature_t sig  ) 
 

Free the memory used when parsing a signature.

Parameters:
sig 

void ops_ss_policy_url_free ops_ss_policy_url_t policy_url  ) 
 

Free allocated memory.

Free the memory used when parsing this signature sub-packet type

void ops_ss_preferred_hash_free ops_ss_preferred_hash_t ss_preferred_hash  ) 
 

Free the memory used when parsing this signature sub-packet type.

Parameters:
ss_preferred_hash 

void ops_ss_preferred_key_server_free ops_ss_preferred_key_server_t preferred_key_server  ) 
 

Free allocated memory.

Free the memory used when parsing this signature sub-packet type

void ops_ss_preferred_ska_free ops_ss_preferred_ska_t ss_preferred_ska  ) 
 

Free the memory used when parsing this signature sub-packet type.

Parameters:
ss_preferred_ska 

void ops_ss_regexp_free ops_ss_regexp_t regexp  ) 
 

Free allocated memory.

Free the memory used when parsing this signature sub-packet type

void ops_user_attribute_free ops_user_attribute_t user_att  ) 
 

Free allocated memory.

Free the memory used when parsing this packet type

void ops_user_id_free ops_user_id_t id  ) 
 

Free allocated memory.

Free the memory used when parsing this packet type

ops_boolean_t ops_write_ss_header unsigned  length,
ops_content_tag_t  type,
ops_create_info_t info
 

Parameters:
length 
type 
info 
Returns:
ops_true if OK, otherwise ops_false


Generated on Wed Jun 19 00:00:02 2013 for OpenPGP:SDK by  doxygen 1.4.6