openpgp

openpgp

Synopsis




enum                gnutls_openpgp_crt_fmt_t;
typedef             gnutls_openpgp_keyid_t;
int                 gnutls_openpgp_crt_init             (gnutls_openpgp_crt_t *key);
void                gnutls_openpgp_crt_deinit           (gnutls_openpgp_crt_t key);
int                 gnutls_openpgp_crt_import           (gnutls_openpgp_crt_t key,
                                                         const gnutls_datum_t *data,
                                                         gnutls_openpgp_crt_fmt_t format);
int                 gnutls_openpgp_crt_export           (gnutls_openpgp_crt_t key,
                                                         gnutls_openpgp_crt_fmt_t format,
                                                         void *output_data,
                                                         size_t *output_data_size);
int                 gnutls_openpgp_crt_print            (gnutls_openpgp_crt_t cert,
                                                         gnutls_certificate_print_formats_t format,
                                                         gnutls_datum_t *out);
int                 gnutls_openpgp_crt_get_key_usage    (gnutls_openpgp_crt_t cert,
                                                         unsigned int *key_usage);
int                 gnutls_openpgp_crt_get_fingerprint  (gnutls_openpgp_crt_t key,
                                                         void *fpr,
                                                         size_t *fprlen);
int                 gnutls_openpgp_crt_get_name         (gnutls_openpgp_crt_t key,
                                                         int idx,
                                                         char *buf,
                                                         size_t *sizeof_buf);
gnutls_pk_algorithm_t gnutls_openpgp_crt_get_pk_algorithm
                                                        (gnutls_openpgp_crt_t key,
                                                         unsigned int *bits);
int                 gnutls_openpgp_crt_get_version      (gnutls_openpgp_crt_t key);
time_t              gnutls_openpgp_crt_get_creation_time
                                                        (gnutls_openpgp_crt_t key);
time_t              gnutls_openpgp_crt_get_expiration_time
                                                        (gnutls_openpgp_crt_t key);
int                 gnutls_openpgp_crt_get_key_id       (gnutls_openpgp_crt_t key,
                                                         gnutls_openpgp_keyid_t keyid);
int                 gnutls_openpgp_crt_check_hostname   (gnutls_openpgp_crt_t key,
                                                         const char *hostname);
int                 gnutls_openpgp_crt_get_revoked_status
                                                        (gnutls_openpgp_crt_t key);
int                 gnutls_openpgp_crt_get_subkey_count (gnutls_openpgp_crt_t key);
int                 gnutls_openpgp_crt_get_subkey_idx   (gnutls_openpgp_crt_t key,
                                                         const gnutls_openpgp_keyid_t keyid);
int                 gnutls_openpgp_crt_get_subkey_revoked_status
                                                        (gnutls_openpgp_crt_t key,
                                                         unsigned int idx);
gnutls_pk_algorithm_t gnutls_openpgp_crt_get_subkey_pk_algorithm
                                                        (gnutls_openpgp_crt_t key,
                                                         unsigned int idx,
                                                         unsigned int *bits);
time_t              gnutls_openpgp_crt_get_subkey_creation_time
                                                        (gnutls_openpgp_crt_t key,
                                                         unsigned int idx);
time_t              gnutls_openpgp_crt_get_subkey_expiration_time
                                                        (gnutls_openpgp_crt_t key,
                                                         unsigned int idx);
int                 gnutls_openpgp_crt_get_subkey_id    (gnutls_openpgp_crt_t key,
                                                         unsigned int idx,
                                                         gnutls_openpgp_keyid_t keyid);
int                 gnutls_openpgp_crt_get_subkey_usage (gnutls_openpgp_crt_t key,
                                                         unsigned int idx,
                                                         unsigned int *key_usage);
int                 gnutls_openpgp_crt_get_subkey_pk_dsa_raw
                                                        (gnutls_openpgp_crt_t crt,
                                                         unsigned int idx,
                                                         gnutls_datum_t *p,
                                                         gnutls_datum_t *q,
                                                         gnutls_datum_t *g,
                                                         gnutls_datum_t *y);
int                 gnutls_openpgp_crt_get_subkey_pk_rsa_raw
                                                        (gnutls_openpgp_crt_t crt,
                                                         unsigned int idx,
                                                         gnutls_datum_t *m,
                                                         gnutls_datum_t *e);
int                 gnutls_openpgp_crt_get_pk_dsa_raw   (gnutls_openpgp_crt_t crt,
                                                         gnutls_datum_t *p,
                                                         gnutls_datum_t *q,
                                                         gnutls_datum_t *g,
                                                         gnutls_datum_t *y);
int                 gnutls_openpgp_crt_get_pk_rsa_raw   (gnutls_openpgp_crt_t crt,
                                                         gnutls_datum_t *m,
                                                         gnutls_datum_t *e);
int                 gnutls_openpgp_crt_get_preferred_key_id
                                                        (gnutls_openpgp_crt_t key,
                                                         gnutls_openpgp_keyid_t keyid);
int                 gnutls_openpgp_crt_set_preferred_key_id
                                                        (gnutls_openpgp_crt_t key,
                                                         const gnutls_openpgp_keyid_t keyid);
int                 gnutls_openpgp_privkey_init         (gnutls_openpgp_privkey_t *key);
void                gnutls_openpgp_privkey_deinit       (gnutls_openpgp_privkey_t key);
gnutls_pk_algorithm_t gnutls_openpgp_privkey_get_pk_algorithm
                                                        (gnutls_openpgp_privkey_t key,
                                                         unsigned int *bits);
int                 gnutls_openpgp_privkey_import       (gnutls_openpgp_privkey_t key,
                                                         const gnutls_datum_t *data,
                                                         gnutls_openpgp_crt_fmt_t format,
                                                         const char *pass,
                                                         unsigned int flags);
int                 gnutls_openpgp_privkey_sign_hash    (gnutls_openpgp_privkey_t key,
                                                         const gnutls_datum_t *hash,
                                                         gnutls_datum_t *signature);
int                 gnutls_openpgp_privkey_get_fingerprint
                                                        (gnutls_openpgp_privkey_t key,
                                                         void *fpr,
                                                         size_t *fprlen);
int                 gnutls_openpgp_privkey_get_key_id   (gnutls_openpgp_privkey_t key,
                                                         gnutls_openpgp_keyid_t keyid);
int                 gnutls_openpgp_privkey_get_subkey_count
                                                        (gnutls_openpgp_privkey_t key);
int                 gnutls_openpgp_privkey_get_subkey_idx
                                                        (gnutls_openpgp_privkey_t key,
                                                         const gnutls_openpgp_keyid_t keyid);
int                 gnutls_openpgp_privkey_get_subkey_revoked_status
                                                        (gnutls_openpgp_privkey_t key,
                                                         unsigned int idx);
int                 gnutls_openpgp_privkey_get_revoked_status
                                                        (gnutls_openpgp_privkey_t key);
gnutls_pk_algorithm_t gnutls_openpgp_privkey_get_subkey_pk_algorithm
                                                        (gnutls_openpgp_privkey_t key,
                                                         unsigned int idx,
                                                         unsigned int *bits);
time_t              gnutls_openpgp_privkey_get_subkey_expiration_time
                                                        (gnutls_openpgp_privkey_t key,
                                                         unsigned int idx);
int                 gnutls_openpgp_privkey_get_subkey_id
                                                        (gnutls_openpgp_privkey_t key,
                                                         unsigned int idx,
                                                         gnutls_openpgp_keyid_t keyid);
time_t              gnutls_openpgp_privkey_get_subkey_creation_time
                                                        (gnutls_openpgp_privkey_t key,
                                                         unsigned int idx);
int                 gnutls_openpgp_privkey_export_subkey_dsa_raw
                                                        (gnutls_openpgp_privkey_t crt,
                                                         unsigned int idx,
                                                         gnutls_datum_t *p,
                                                         gnutls_datum_t *q,
                                                         gnutls_datum_t *g,
                                                         gnutls_datum_t *y,
                                                         gnutls_datum_t *x);
int                 gnutls_openpgp_privkey_export_subkey_rsa_raw
                                                        (gnutls_openpgp_privkey_t crt,
                                                         unsigned int idx,
                                                         gnutls_datum_t *m,
                                                         gnutls_datum_t *e,
                                                         gnutls_datum_t *d,
                                                         gnutls_datum_t *p,
                                                         gnutls_datum_t *q,
                                                         gnutls_datum_t *u);
int                 gnutls_openpgp_privkey_export_dsa_raw
                                                        (gnutls_openpgp_privkey_t crt,
                                                         gnutls_datum_t *p,
                                                         gnutls_datum_t *q,
                                                         gnutls_datum_t *g,
                                                         gnutls_datum_t *y,
                                                         gnutls_datum_t *x);
int                 gnutls_openpgp_privkey_export_rsa_raw
                                                        (gnutls_openpgp_privkey_t crt,
                                                         gnutls_datum_t *m,
                                                         gnutls_datum_t *e,
                                                         gnutls_datum_t *d,
                                                         gnutls_datum_t *p,
                                                         gnutls_datum_t *q,
                                                         gnutls_datum_t *u);
int                 gnutls_openpgp_privkey_export       (gnutls_openpgp_privkey_t key,
                                                         gnutls_openpgp_crt_fmt_t format,
                                                         const char *password,
                                                         unsigned int flags,
                                                         void *output_data,
                                                         size_t *output_data_size);
int                 gnutls_openpgp_privkey_set_preferred_key_id
                                                        (gnutls_openpgp_privkey_t key,
                                                         const gnutls_openpgp_keyid_t keyid);
int                 gnutls_openpgp_privkey_get_preferred_key_id
                                                        (gnutls_openpgp_privkey_t key,
                                                         gnutls_openpgp_keyid_t keyid);
int                 gnutls_openpgp_crt_get_auth_subkey  (gnutls_openpgp_crt_t crt,
                                                         gnutls_openpgp_keyid_t keyid);
int                 gnutls_openpgp_keyring_init         (gnutls_openpgp_keyring_t *keyring);
void                gnutls_openpgp_keyring_deinit       (gnutls_openpgp_keyring_t keyring);
int                 gnutls_openpgp_keyring_import       (gnutls_openpgp_keyring_t keyring,
                                                         const gnutls_datum_t *data,
                                                         gnutls_openpgp_crt_fmt_t format);
int                 gnutls_openpgp_keyring_check_id     (gnutls_openpgp_keyring_t ring,
                                                         const gnutls_openpgp_keyid_t keyid,
                                                         unsigned int flags);
int                 gnutls_openpgp_crt_verify_ring      (gnutls_openpgp_crt_t key,
                                                         gnutls_openpgp_keyring_t keyring,
                                                         unsigned int flags,
                                                         unsigned int *verify);
int                 gnutls_openpgp_crt_verify_self      (gnutls_openpgp_crt_t key,
                                                         unsigned int flags,
                                                         unsigned int *verify);
int                 gnutls_openpgp_keyring_get_crt      (gnutls_openpgp_keyring_t ring,
                                                         unsigned int idx,
                                                         gnutls_openpgp_crt_t *cert);
int                 gnutls_openpgp_keyring_get_crt_count
                                                        (gnutls_openpgp_keyring_t ring);
int                 (*gnutls_openpgp_recv_key_func)     (gnutls_session_t session,
                                                         unsigned char *keyfpr,
                                                         unsigned int keyfpr_length,
                                                         gnutls_datum_t *key);
void                gnutls_openpgp_set_recv_key_function
                                                        (gnutls_session_t session,
                                                         gnutls_openpgp_recv_key_funcfunc );
int                 gnutls_certificate_set_openpgp_key  (gnutls_certificate_credentials_tres ,
                                                         gnutls_openpgp_crt_t key,
                                                         gnutls_openpgp_privkey_t pkey);
int                 gnutls_certificate_set_openpgp_key_file
                                                        (gnutls_certificate_credentials_tres ,
                                                         const char *CERTFILE,
                                                         const char *KEYFILE,
                                                         gnutls_openpgp_crt_fmt_t );
int                 gnutls_certificate_set_openpgp_key_mem
                                                        (gnutls_certificate_credentials_tres ,
                                                         const gnutls_datum_t *CERT,
                                                         const gnutls_datum_t *KEY,
                                                         gnutls_openpgp_crt_fmt_t );
int                 gnutls_certificate_set_openpgp_key_file2
                                                        (gnutls_certificate_credentials_tres ,
                                                         const char *CERTFILE,
                                                         const char *KEYFILE,
                                                         const char *keyid,
                                                         gnutls_openpgp_crt_fmt_t );
int                 gnutls_certificate_set_openpgp_key_mem2
                                                        (gnutls_certificate_credentials_tres ,
                                                         const gnutls_datum_t *CERT,
                                                         const gnutls_datum_t *KEY,
                                                         const char *keyid,
                                                         gnutls_openpgp_crt_fmt_t );
int                 gnutls_certificate_set_openpgp_keyring_mem
                                                        (gnutls_certificate_credentials_t c,
                                                         unsigned char *data,
                                                         size_t dlen,
                                                         gnutls_openpgp_crt_fmt_t );
int                 gnutls_certificate_set_openpgp_keyring_file
                                                        (gnutls_certificate_credentials_t c,
                                                         const char *file,
                                                         gnutls_openpgp_crt_fmt_t );

Description

Details

enum gnutls_openpgp_crt_fmt_t

  typedef enum gnutls_openpgp_crt_fmt
  { GNUTLS_OPENPGP_FMT_RAW,
    GNUTLS_OPENPGP_FMT_BASE64
  } gnutls_openpgp_crt_fmt_t;


gnutls_openpgp_keyid_t


gnutls_openpgp_crt_init ()

int                 gnutls_openpgp_crt_init             (gnutls_openpgp_crt_t *key);

This function will initialize an OpenPGP key structure.

key :

Returns :


gnutls_openpgp_crt_deinit ()

void                gnutls_openpgp_crt_deinit           (gnutls_openpgp_crt_t key);

This function will deinitialize a key structure.

key :


gnutls_openpgp_crt_import ()

int                 gnutls_openpgp_crt_import           (gnutls_openpgp_crt_t key,
                                                         const gnutls_datum_t *data,
                                                         gnutls_openpgp_crt_fmt_t format);

This function will convert the given RAW or Base64 encoded key to the native gnutls_openpgp_crt_t format. The output will be stored in 'key'.

key :

data :

format :

Returns :


gnutls_openpgp_crt_export ()

int                 gnutls_openpgp_crt_export           (gnutls_openpgp_crt_t key,
                                                         gnutls_openpgp_crt_fmt_t format,
                                                         void *output_data,
                                                         size_t *output_data_size);

This function will convert the given key to RAW or Base64 format. If the buffer provided is not long enough to hold the output, then GNUTLS_E_SHORT_MEMORY_BUFFER will be returned.

key :

format :

output_data :

output_data_size :

Returns :


gnutls_openpgp_crt_print ()

int                 gnutls_openpgp_crt_print            (gnutls_openpgp_crt_t cert,
                                                         gnutls_certificate_print_formats_t format,
                                                         gnutls_datum_t *out);

This function will pretty print an OpenPGP certificate, suitable for display to a human.

The format should be zero for future compatibility.

The output out needs to be deallocate using gnutls_free().

cert :

format :

out :

Returns :


gnutls_openpgp_crt_get_key_usage ()

int                 gnutls_openpgp_crt_get_key_usage    (gnutls_openpgp_crt_t cert,
                                                         unsigned int *key_usage);

This function will return certificate's key usage, by checking the key algorithm. The key usage value will ORed values of the: GNUTLS_KEY_DIGITAL_SIGNATURE, GNUTLS_KEY_KEY_ENCIPHERMENT.

A negative value may be returned in case of parsing error.

cert :

key_usage :

Returns :


gnutls_openpgp_crt_get_fingerprint ()

int                 gnutls_openpgp_crt_get_fingerprint  (gnutls_openpgp_crt_t key,
                                                         void *fpr,
                                                         size_t *fprlen);

key :

fpr :

fprlen :

Returns :


gnutls_openpgp_crt_get_name ()

int                 gnutls_openpgp_crt_get_name         (gnutls_openpgp_crt_t key,
                                                         int idx,
                                                         char *buf,
                                                         size_t *sizeof_buf);

Extracts the userID from the parsed OpenPGP key.

key :

idx :

buf :

sizeof_buf :

Returns :


gnutls_openpgp_crt_get_pk_algorithm ()

gnutls_pk_algorithm_t gnutls_openpgp_crt_get_pk_algorithm
                                                        (gnutls_openpgp_crt_t key,
                                                         unsigned int *bits);

This function will return the public key algorithm of an OpenPGP certificate.

If bits is non null, it should have enough size to hold the parameters size in bits. For RSA the bits returned is the modulus. For DSA the bits returned are of the public exponent.

key :

bits :

Returns :


gnutls_openpgp_crt_get_version ()

int                 gnutls_openpgp_crt_get_version      (gnutls_openpgp_crt_t key);

Extract the version of the OpenPGP key.

key :

Returns :


gnutls_openpgp_crt_get_creation_time ()

time_t              gnutls_openpgp_crt_get_creation_time
                                                        (gnutls_openpgp_crt_t key);

key :

Returns :


gnutls_openpgp_crt_get_expiration_time ()

time_t              gnutls_openpgp_crt_get_expiration_time
                                                        (gnutls_openpgp_crt_t key);

key :

Returns :


gnutls_openpgp_crt_get_key_id ()

int                 gnutls_openpgp_crt_get_key_id       (gnutls_openpgp_crt_t key,
                                                         gnutls_openpgp_keyid_t keyid);

key :

keyid :

Returns :


gnutls_openpgp_crt_check_hostname ()

int                 gnutls_openpgp_crt_check_hostname   (gnutls_openpgp_crt_t key,
                                                         const char *hostname);

This function will check if the given key's owner matches the given hostname. This is a basic implementation of the matching described in RFC2818 (HTTPS), which takes into account wildcards.

key :

hostname :

Returns :


gnutls_openpgp_crt_get_revoked_status ()

int                 gnutls_openpgp_crt_get_revoked_status
                                                        (gnutls_openpgp_crt_t key);

key :

Returns :


gnutls_openpgp_crt_get_subkey_count ()

int                 gnutls_openpgp_crt_get_subkey_count (gnutls_openpgp_crt_t key);

This function will return the number of subkeys present in the given OpenPGP certificate.

key :

Returns :


gnutls_openpgp_crt_get_subkey_idx ()

int                 gnutls_openpgp_crt_get_subkey_idx   (gnutls_openpgp_crt_t key,
                                                         const gnutls_openpgp_keyid_t keyid);

key :

keyid :

Returns :


gnutls_openpgp_crt_get_subkey_revoked_status ()

int                 gnutls_openpgp_crt_get_subkey_revoked_status
                                                        (gnutls_openpgp_crt_t key,
                                                         unsigned int idx);

key :

idx :

Returns :


gnutls_openpgp_crt_get_subkey_pk_algorithm ()

gnutls_pk_algorithm_t gnutls_openpgp_crt_get_subkey_pk_algorithm
                                                        (gnutls_openpgp_crt_t key,
                                                         unsigned int idx,
                                                         unsigned int *bits);

This function will return the public key algorithm of a subkey of an OpenPGP certificate.

If bits is non null, it should have enough size to hold the parameters size in bits. For RSA the bits returned is the modulus. For DSA the bits returned are of the public exponent.

key :

idx :

bits :

Returns :


gnutls_openpgp_crt_get_subkey_creation_time ()

time_t              gnutls_openpgp_crt_get_subkey_creation_time
                                                        (gnutls_openpgp_crt_t key,
                                                         unsigned int idx);

key :

idx :

Returns :


gnutls_openpgp_crt_get_subkey_expiration_time ()

time_t              gnutls_openpgp_crt_get_subkey_expiration_time
                                                        (gnutls_openpgp_crt_t key,
                                                         unsigned int idx);

key :

idx :

Returns :


gnutls_openpgp_crt_get_subkey_id ()

int                 gnutls_openpgp_crt_get_subkey_id    (gnutls_openpgp_crt_t key,
                                                         unsigned int idx,
                                                         gnutls_openpgp_keyid_t keyid);

key :

idx :

keyid :

Returns :


gnutls_openpgp_crt_get_subkey_usage ()

int                 gnutls_openpgp_crt_get_subkey_usage (gnutls_openpgp_crt_t key,
                                                         unsigned int idx,
                                                         unsigned int *key_usage);

This function will return certificate's key usage, by checking the key algorithm. The key usage value will ORed values of the: GNUTLS_KEY_DIGITAL_SIGNATURE, GNUTLS_KEY_KEY_ENCIPHERMENT.

A negative value may be returned in case of parsing error.

key :

idx :

key_usage :

Returns :


gnutls_openpgp_crt_get_subkey_pk_dsa_raw ()

int                 gnutls_openpgp_crt_get_subkey_pk_dsa_raw
                                                        (gnutls_openpgp_crt_t crt,
                                                         unsigned int idx,
                                                         gnutls_datum_t *p,
                                                         gnutls_datum_t *q,
                                                         gnutls_datum_t *g,
                                                         gnutls_datum_t *y);

This function will export the DSA public key's parameters found in the given certificate. The new parameters will be allocated using gnutls_malloc() and will be stored in the appropriate datum.

crt :

idx :

p :

q :

g :

y :

Returns :


gnutls_openpgp_crt_get_subkey_pk_rsa_raw ()

int                 gnutls_openpgp_crt_get_subkey_pk_rsa_raw
                                                        (gnutls_openpgp_crt_t crt,
                                                         unsigned int idx,
                                                         gnutls_datum_t *m,
                                                         gnutls_datum_t *e);

This function will export the RSA public key's parameters found in the given structure. The new parameters will be allocated using gnutls_malloc() and will be stored in the appropriate datum.

crt :

idx :

m :

e :

Returns :


gnutls_openpgp_crt_get_pk_dsa_raw ()

int                 gnutls_openpgp_crt_get_pk_dsa_raw   (gnutls_openpgp_crt_t crt,
                                                         gnutls_datum_t *p,
                                                         gnutls_datum_t *q,
                                                         gnutls_datum_t *g,
                                                         gnutls_datum_t *y);

This function will export the DSA public key's parameters found in the given certificate. The new parameters will be allocated using gnutls_malloc() and will be stored in the appropriate datum.

crt :

p :

q :

g :

y :

Returns :


gnutls_openpgp_crt_get_pk_rsa_raw ()

int                 gnutls_openpgp_crt_get_pk_rsa_raw   (gnutls_openpgp_crt_t crt,
                                                         gnutls_datum_t *m,
                                                         gnutls_datum_t *e);

This function will export the RSA public key's parameters found in the given structure. The new parameters will be allocated using gnutls_malloc() and will be stored in the appropriate datum.

crt :

m :

e :

Returns :


gnutls_openpgp_crt_get_preferred_key_id ()

int                 gnutls_openpgp_crt_get_preferred_key_id
                                                        (gnutls_openpgp_crt_t key,
                                                         gnutls_openpgp_keyid_t keyid);

key :

keyid :

Returns :


gnutls_openpgp_crt_set_preferred_key_id ()

int                 gnutls_openpgp_crt_set_preferred_key_id
                                                        (gnutls_openpgp_crt_t key,
                                                         const gnutls_openpgp_keyid_t keyid);

This allows setting a preferred key id for the given certificate. This key will be used by functions that involve key handling.

key :

keyid :

Returns :


gnutls_openpgp_privkey_init ()

int                 gnutls_openpgp_privkey_init         (gnutls_openpgp_privkey_t *key);

This function will initialize an OpenPGP key structure.

key :

Returns :


gnutls_openpgp_privkey_deinit ()

void                gnutls_openpgp_privkey_deinit       (gnutls_openpgp_privkey_t key);

This function will deinitialize a key structure.

key :


gnutls_openpgp_privkey_get_pk_algorithm ()

gnutls_pk_algorithm_t gnutls_openpgp_privkey_get_pk_algorithm
                                                        (gnutls_openpgp_privkey_t key,
                                                         unsigned int *bits);

This function will return the public key algorithm of an OpenPGP certificate.

If bits is non null, it should have enough size to hold the parameters size in bits. For RSA the bits returned is the modulus. For DSA the bits returned are of the public exponent.

key :

bits :

Returns :


gnutls_openpgp_privkey_import ()

int                 gnutls_openpgp_privkey_import       (gnutls_openpgp_privkey_t key,
                                                         const gnutls_datum_t *data,
                                                         gnutls_openpgp_crt_fmt_t format,
                                                         const char *pass,
                                                         unsigned int flags);

This function will convert the given RAW or Base64 encoded key to the native gnutls_openpgp_privkey_t format. The output will be stored in 'key'.

key :

data :

format :

pass :

flags :

Returns :


gnutls_openpgp_privkey_sign_hash ()

int                 gnutls_openpgp_privkey_sign_hash    (gnutls_openpgp_privkey_t key,
                                                         const gnutls_datum_t *hash,
                                                         gnutls_datum_t *signature);

This function will sign the given hash using the private key. You should use gnutls_openpgp_privkey_set_subkey() before calling this function to set the subkey to use.

key :

hash :

signature :

Returns :


gnutls_openpgp_privkey_get_fingerprint ()

int                 gnutls_openpgp_privkey_get_fingerprint
                                                        (gnutls_openpgp_privkey_t key,
                                                         void *fpr,
                                                         size_t *fprlen);

key :

fpr :

fprlen :

Returns :


gnutls_openpgp_privkey_get_key_id ()

int                 gnutls_openpgp_privkey_get_key_id   (gnutls_openpgp_privkey_t key,
                                                         gnutls_openpgp_keyid_t keyid);

key :

keyid :

Returns :


gnutls_openpgp_privkey_get_subkey_count ()

int                 gnutls_openpgp_privkey_get_subkey_count
                                                        (gnutls_openpgp_privkey_t key);

This function will return the number of subkeys present in the given OpenPGP certificate.

key :

Returns :


gnutls_openpgp_privkey_get_subkey_idx ()

int                 gnutls_openpgp_privkey_get_subkey_idx
                                                        (gnutls_openpgp_privkey_t key,
                                                         const gnutls_openpgp_keyid_t keyid);

key :

keyid :

Returns :


gnutls_openpgp_privkey_get_subkey_revoked_status ()

int                 gnutls_openpgp_privkey_get_subkey_revoked_status
                                                        (gnutls_openpgp_privkey_t key,
                                                         unsigned int idx);

key :

idx :

Returns :


gnutls_openpgp_privkey_get_revoked_status ()

int                 gnutls_openpgp_privkey_get_revoked_status
                                                        (gnutls_openpgp_privkey_t key);

key :

Returns :


gnutls_openpgp_privkey_get_subkey_pk_algorithm ()

gnutls_pk_algorithm_t gnutls_openpgp_privkey_get_subkey_pk_algorithm
                                                        (gnutls_openpgp_privkey_t key,
                                                         unsigned int idx,
                                                         unsigned int *bits);

This function will return the public key algorithm of a subkey of an OpenPGP certificate.

If bits is non null, it should have enough size to hold the parameters size in bits. For RSA the bits returned is the modulus. For DSA the bits returned are of the public exponent.

key :

idx :

bits :

Returns :


gnutls_openpgp_privkey_get_subkey_expiration_time ()

time_t              gnutls_openpgp_privkey_get_subkey_expiration_time
                                                        (gnutls_openpgp_privkey_t key,
                                                         unsigned int idx);

key :

idx :

Returns :


gnutls_openpgp_privkey_get_subkey_id ()

int                 gnutls_openpgp_privkey_get_subkey_id
                                                        (gnutls_openpgp_privkey_t key,
                                                         unsigned int idx,
                                                         gnutls_openpgp_keyid_t keyid);

key :

idx :

keyid :

Returns :


gnutls_openpgp_privkey_get_subkey_creation_time ()

time_t              gnutls_openpgp_privkey_get_subkey_creation_time
                                                        (gnutls_openpgp_privkey_t key,
                                                         unsigned int idx);

key :

idx :

Returns :


gnutls_openpgp_privkey_export_subkey_dsa_raw ()

int                 gnutls_openpgp_privkey_export_subkey_dsa_raw
                                                        (gnutls_openpgp_privkey_t crt,
                                                         unsigned int idx,
                                                         gnutls_datum_t *p,
                                                         gnutls_datum_t *q,
                                                         gnutls_datum_t *g,
                                                         gnutls_datum_t *y,
                                                         gnutls_datum_t *x);

This function will export the DSA private key's parameters found in the given certificate. The new parameters will be allocated using gnutls_malloc() and will be stored in the appropriate datum.

crt :

idx :

p :

q :

g :

y :

x :

Returns :


gnutls_openpgp_privkey_export_subkey_rsa_raw ()

int                 gnutls_openpgp_privkey_export_subkey_rsa_raw
                                                        (gnutls_openpgp_privkey_t crt,
                                                         unsigned int idx,
                                                         gnutls_datum_t *m,
                                                         gnutls_datum_t *e,
                                                         gnutls_datum_t *d,
                                                         gnutls_datum_t *p,
                                                         gnutls_datum_t *q,
                                                         gnutls_datum_t *u);

This function will export the RSA private key's parameters found in the given structure. The new parameters will be allocated using gnutls_malloc() and will be stored in the appropriate datum.

crt :

idx :

m :

e :

d :

p :

q :

u :

Returns :


gnutls_openpgp_privkey_export_dsa_raw ()

int                 gnutls_openpgp_privkey_export_dsa_raw
                                                        (gnutls_openpgp_privkey_t crt,
                                                         gnutls_datum_t *p,
                                                         gnutls_datum_t *q,
                                                         gnutls_datum_t *g,
                                                         gnutls_datum_t *y,
                                                         gnutls_datum_t *x);

This function will export the DSA private key's parameters found in the given certificate. The new parameters will be allocated using gnutls_malloc() and will be stored in the appropriate datum.

crt :

p :

q :

g :

y :

x :

Returns :


gnutls_openpgp_privkey_export_rsa_raw ()

int                 gnutls_openpgp_privkey_export_rsa_raw
                                                        (gnutls_openpgp_privkey_t crt,
                                                         gnutls_datum_t *m,
                                                         gnutls_datum_t *e,
                                                         gnutls_datum_t *d,
                                                         gnutls_datum_t *p,
                                                         gnutls_datum_t *q,
                                                         gnutls_datum_t *u);

This function will export the RSA private key's parameters found in the given structure. The new parameters will be allocated using gnutls_malloc() and will be stored in the appropriate datum.

crt :

m :

e :

d :

p :

q :

u :

Returns :


gnutls_openpgp_privkey_export ()

int                 gnutls_openpgp_privkey_export       (gnutls_openpgp_privkey_t key,
                                                         gnutls_openpgp_crt_fmt_t format,
                                                         const char *password,
                                                         unsigned int flags,
                                                         void *output_data,
                                                         size_t *output_data_size);

This function will convert the given key to RAW or Base64 format. If the buffer provided is not long enough to hold the output, then GNUTLS_E_SHORT_MEMORY_BUFFER will be returned.

key :

format :

password :

flags :

output_data :

output_data_size :

Returns :


gnutls_openpgp_privkey_set_preferred_key_id ()

int                 gnutls_openpgp_privkey_set_preferred_key_id
                                                        (gnutls_openpgp_privkey_t key,
                                                         const gnutls_openpgp_keyid_t keyid);

This allows setting a preferred key id for the given certificate. This key will be used by functions that involve key handling.

key :

keyid :

Returns :


gnutls_openpgp_privkey_get_preferred_key_id ()

int                 gnutls_openpgp_privkey_get_preferred_key_id
                                                        (gnutls_openpgp_privkey_t key,
                                                         gnutls_openpgp_keyid_t keyid);

key :

keyid :

Returns :


gnutls_openpgp_crt_get_auth_subkey ()

int                 gnutls_openpgp_crt_get_auth_subkey  (gnutls_openpgp_crt_t crt,
                                                         gnutls_openpgp_keyid_t keyid);

Returns the 64-bit keyID of the first valid OpenPGP subkey marked for authentication.

crt :

keyid :

Returns :


gnutls_openpgp_keyring_init ()

int                 gnutls_openpgp_keyring_init         (gnutls_openpgp_keyring_t *keyring);

This function will initialize an keyring structure.

keyring :

Returns :


gnutls_openpgp_keyring_deinit ()

void                gnutls_openpgp_keyring_deinit       (gnutls_openpgp_keyring_t keyring);

This function will deinitialize a keyring structure.

keyring :


gnutls_openpgp_keyring_import ()

int                 gnutls_openpgp_keyring_import       (gnutls_openpgp_keyring_t keyring,
                                                         const gnutls_datum_t *data,
                                                         gnutls_openpgp_crt_fmt_t format);

This function will convert the given RAW or Base64 encoded keyring to the native gnutls_openpgp_keyring_t format. The output will be stored in 'keyring'.

keyring :

data :

format :

Returns :


gnutls_openpgp_keyring_check_id ()

int                 gnutls_openpgp_keyring_check_id     (gnutls_openpgp_keyring_t ring,
                                                         const gnutls_openpgp_keyid_t keyid,
                                                         unsigned int flags);

Check if a given key ID exists in the keyring.

ring :

keyid :

flags :

Returns :


gnutls_openpgp_crt_verify_ring ()

int                 gnutls_openpgp_crt_verify_ring      (gnutls_openpgp_crt_t key,
                                                         gnutls_openpgp_keyring_t keyring,
                                                         unsigned int flags,
                                                         unsigned int *verify);

Verify all signatures in the key, using the given set of keys (keyring).

The key verification output will be put in verify and will be one or more of the gnutls_certificate_status_t enumerated elements bitwise or'd.

GNUTLS_CERT_INVALID: A signature on the key is invalid.

GNUTLS_CERT_REVOKED: The key has been revoked.

Note that this function does not verify using any "web of trust". You may use GnuPG for that purpose, or any other external PGP application.

key :

keyring :

flags :

verify :

Returns :


gnutls_openpgp_crt_verify_self ()

int                 gnutls_openpgp_crt_verify_self      (gnutls_openpgp_crt_t key,
                                                         unsigned int flags,
                                                         unsigned int *verify);

Verifies the self signature in the key. The key verification output will be put in verify and will be one or more of the gnutls_certificate_status_t enumerated elements bitwise or'd.

GNUTLS_CERT_INVALID: The self signature on the key is invalid.

key :

flags :

verify :

Returns :


gnutls_openpgp_keyring_get_crt ()

int                 gnutls_openpgp_keyring_get_crt      (gnutls_openpgp_keyring_t ring,
                                                         unsigned int idx,
                                                         gnutls_openpgp_crt_t *cert);

This function will extract an OpenPGP certificate from the given keyring. If the index given is out of range GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE will be returned. The returned structure needs to be deinited.

ring :

idx :

cert :

Returns :


gnutls_openpgp_keyring_get_crt_count ()

int                 gnutls_openpgp_keyring_get_crt_count
                                                        (gnutls_openpgp_keyring_t ring);

This function will return the number of OpenPGP certificates present in the given keyring.

ring :

Returns :


gnutls_openpgp_recv_key_func ()

int                 (*gnutls_openpgp_recv_key_func)     (gnutls_session_t session,
                                                         unsigned char *keyfpr,
                                                         unsigned int keyfpr_length,
                                                         gnutls_datum_t *key);

A callback of this type is used to retrieve OpenPGP keys. Only useful on the server, and will only be used if the peer send a key fingerprint instead of a full key. See also gnutls_openpgp_set_recv_key_function().

session :

keyfpr :

keyfpr_length :

key :

Returns :


gnutls_openpgp_set_recv_key_function ()

void                gnutls_openpgp_set_recv_key_function
                                                        (gnutls_session_t session,
                                                         gnutls_openpgp_recv_key_funcfunc );

This funtion will set a key retrieval function for OpenPGP keys. This callback is only useful in server side, and will be used if the peer sent a key fingerprint instead of a full key.

session :

Param2 :


gnutls_certificate_set_openpgp_key ()

int                 gnutls_certificate_set_openpgp_key  (gnutls_certificate_credentials_tres ,
                                                         gnutls_openpgp_crt_t key,
                                                         gnutls_openpgp_privkey_t pkey);

This function sets a certificate/private key pair in the gnutls_certificate_credentials_t structure. This function may be called more than once (in case multiple keys/certificates exist for the server).

With this function the subkeys of the certificate are not used.

Param1 :

key :

pkey :

Returns :


gnutls_certificate_set_openpgp_key_file ()

int                 gnutls_certificate_set_openpgp_key_file
                                                        (gnutls_certificate_credentials_tres ,
                                                         const char *CERTFILE,
                                                         const char *KEYFILE,
                                                         gnutls_openpgp_crt_fmt_t );

This funtion is used to load OpenPGP keys into the GnuTLS credentials structure. The files should only contain one key which is not encrypted.

Param1 :

CERTFILE :

KEYFILE :

Param4 :

Returns :


gnutls_certificate_set_openpgp_key_mem ()

int                 gnutls_certificate_set_openpgp_key_mem
                                                        (gnutls_certificate_credentials_tres ,
                                                         const gnutls_datum_t *CERT,
                                                         const gnutls_datum_t *KEY,
                                                         gnutls_openpgp_crt_fmt_t );

This funtion is used to load OpenPGP keys into the GnuTLS credential structure. The files should contain non encrypted keys.

Param1 :

CERT :

KEY :

Param4 :

Returns :


gnutls_certificate_set_openpgp_key_file2 ()

int                 gnutls_certificate_set_openpgp_key_file2
                                                        (gnutls_certificate_credentials_tres ,
                                                         const char *CERTFILE,
                                                         const char *KEYFILE,
                                                         const char *keyid,
                                                         gnutls_openpgp_crt_fmt_t );

This funtion is used to load OpenPGP keys into the GnuTLS credential structure. The files should contain non encrypted keys.

The special keyword "auto" is also accepted as &subkey_id. In that case the gnutls_openpgp_crt_get_auth_subkey() will be used to retrieve the subkey.

Param1 :

CERTFILE :

KEYFILE :

keyid :

Param5 :

Returns :


gnutls_certificate_set_openpgp_key_mem2 ()

int                 gnutls_certificate_set_openpgp_key_mem2
                                                        (gnutls_certificate_credentials_tres ,
                                                         const gnutls_datum_t *CERT,
                                                         const gnutls_datum_t *KEY,
                                                         const char *keyid,
                                                         gnutls_openpgp_crt_fmt_t );

This funtion is used to load OpenPGP keys into the GnuTLS credentials structure. The files should only contain one key which is not encrypted.

The special keyword "auto" is also accepted as &subkey_id. In that case the gnutls_openpgp_crt_get_auth_subkey() will be used to retrieve the subkey.

Param1 :

CERT :

KEY :

keyid :

Param5 :

Returns :


gnutls_certificate_set_openpgp_keyring_mem ()

int                 gnutls_certificate_set_openpgp_keyring_mem
                                                        (gnutls_certificate_credentials_t c,
                                                         unsigned char *data,
                                                         size_t dlen,
                                                         gnutls_openpgp_crt_fmt_t );

The function is used to set keyrings that will be used internally by various OpenPGP functions. For example to find a key when it is needed for an operations. The keyring will also be used at the verification functions.

c :

data :

dlen :

Param4 :

Returns :


gnutls_certificate_set_openpgp_keyring_file ()

int                 gnutls_certificate_set_openpgp_keyring_file
                                                        (gnutls_certificate_credentials_t c,
                                                         const char *file,
                                                         gnutls_openpgp_crt_fmt_t );

The function is used to set keyrings that will be used internally by various OpenPGP functions. For example to find a key when it is needed for an operations. The keyring will also be used at the verification functions.

c :

file :

Param3 :

Returns :