openpgp

openpgp

Synopsis




enum        gnutls_openpgp_key_fmt_t;
typedef     gnutls_openpgp_keyring_t;
typedef     gnutls_openpgp_trustdb_t;
int         gnutls_openpgp_key_get_name     (gnutls_openpgp_key_t key,
                                             int idx,
                                             char *buf,
                                             size_t *sizeof_buf);
int         gnutls_openpgp_key_get_fingerprint
                                            (gnutls_openpgp_key_t key,
                                             void *fpr,
                                             size_t *fprlen);
int         gnutls_openpgp_key_get_pk_algorithm
                                            (gnutls_openpgp_key_t key,
                                             unsigned int *bits);
int         gnutls_openpgp_key_get_version  (gnutls_openpgp_key_t key);
time_t      gnutls_openpgp_key_get_creation_time
                                            (gnutls_openpgp_key_t key);
time_t      gnutls_openpgp_key_get_expiration_time
                                            (gnutls_openpgp_key_t key);
int         gnutls_openpgp_key_get_id       (gnutls_openpgp_key_t key,
                                             unsigned char keyid[8]);
int         gnutls_openpgp_key_init         (gnutls_openpgp_key *key);
void        gnutls_openpgp_key_deinit       (gnutls_openpgp_key_t key);
int         gnutls_openpgp_key_import       (gnutls_openpgp_key_t key,
                                             const gnutls_datum_t *data,
                                             gnutls_openpgp_key_fmt format);
int         gnutls_openpgp_key_export       (gnutls_openpgp_key_t key,
                                             gnutls_openpgp_key_fmt_t format,
                                             void *output_data,
                                             size_t *output_data_size);
void        gnutls_openpgp_keyring_deinit   (gnutls_openpgp_keyring_t keyring);
int         gnutls_openpgp_keyring_init     (gnutls_openpgp_keyring *keyring);
int         gnutls_openpgp_keyring_import   (gnutls_openpgp_keyring_t keyring,
                                             const gnutls_datum_t *data,
                                             gnutls_openpgp_key_fmt format);
int         gnutls_openpgp_keyring_check_id (gnutls_openpgp_keyring_t ring,
                                             unsigned char keyid[8],
                                             unsigned int flags);
void        gnutls_openpgp_trustdb_deinit   (gnutls_openpgp_trustdb_t trustdb);
int         gnutls_openpgp_trustdb_init     (gnutls_openpgp_trustdb *trustdb);
int         gnutls_openpgp_trustdb_import_file
                                            (gnutls_openpgp_trustdb_t trustdb,
                                             const char *file);
int         gnutls_openpgp_key_verify_ring  (gnutls_openpgp_key_t key,
                                             gnutls_openpgp_keyring_t keyring,
                                             unsigned int flags,
                                             unsigned int *verify);
int         gnutls_openpgp_key_verify_trustdb
                                            (gnutls_openpgp_key_t key,
                                             gnutls_openpgp_trustdb_t trustdb,
                                             unsigned int flags,
                                             unsigned int *verify);
int         gnutls_openpgp_key_verify_self  (gnutls_openpgp_key_t key,
                                             unsigned int flags,
                                             unsigned int *verify);
void        gnutls_openpgp_privkey_deinit   (gnutls_openpgp_privkey_t key);

Description

Details

enum gnutls_openpgp_key_fmt_t

typedef enum gnutls_openpgp_key_fmt_t
{
  GNUTLS_OPENPGP_FMT_RAW, GNUTLS_OPENPGP_FMT_BASE64
} gnutls_openpgp_key_fmt_t;


gnutls_openpgp_keyring_t


gnutls_openpgp_trustdb_t


gnutls_openpgp_key_get_name ()

int         gnutls_openpgp_key_get_name     (gnutls_openpgp_key_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_key_get_fingerprint ()

int         gnutls_openpgp_key_get_fingerprint
                                            (gnutls_openpgp_key_t key,
                                             void *fpr,
                                             size_t *fprlen);

key :
fpr :
fprlen :
Returns :

gnutls_openpgp_key_get_pk_algorithm ()

int         gnutls_openpgp_key_get_pk_algorithm
                                            (gnutls_openpgp_key_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_key_get_version ()

int         gnutls_openpgp_key_get_version  (gnutls_openpgp_key_t key);

Extract the version of the OpenPGP key.

key :
Returns :

gnutls_openpgp_key_get_creation_time ()

time_t      gnutls_openpgp_key_get_creation_time
                                            (gnutls_openpgp_key_t key);

key :
Returns :

gnutls_openpgp_key_get_expiration_time ()

time_t      gnutls_openpgp_key_get_expiration_time
                                            (gnutls_openpgp_key_t key);

key :
Returns :

gnutls_openpgp_key_get_id ()

int         gnutls_openpgp_key_get_id       (gnutls_openpgp_key_t key,
                                             unsigned char keyid[8]);

key :
keyid :
Returns :

gnutls_openpgp_key_init ()

int         gnutls_openpgp_key_init         (gnutls_openpgp_key *key);

This function will initialize an OpenPGP key structure.

key :
Returns :

gnutls_openpgp_key_deinit ()

void        gnutls_openpgp_key_deinit       (gnutls_openpgp_key_t key);

This function will deinitialize a key structure.

key :

gnutls_openpgp_key_import ()

int         gnutls_openpgp_key_import       (gnutls_openpgp_key_t key,
                                             const gnutls_datum_t *data,
                                             gnutls_openpgp_key_fmt format);

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

key :
data :
format :
Returns :

gnutls_openpgp_key_export ()

int         gnutls_openpgp_key_export       (gnutls_openpgp_key_t key,
                                             gnutls_openpgp_key_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_keyring_deinit ()

void        gnutls_openpgp_keyring_deinit   (gnutls_openpgp_keyring_t keyring);

This function will deinitialize a CRL structure.

keyring :

gnutls_openpgp_keyring_init ()

int         gnutls_openpgp_keyring_init     (gnutls_openpgp_keyring *keyring);

This function will initialize an OpenPGP keyring structure.

keyring :
Returns :

gnutls_openpgp_keyring_import ()

int         gnutls_openpgp_keyring_import   (gnutls_openpgp_keyring_t keyring,
                                             const gnutls_datum_t *data,
                                             gnutls_openpgp_key_fmt 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,
                                             unsigned char keyid[8],
                                             unsigned int flags);

Check if a given key ID exists in the keyring.

ring :
keyid :
flags :
Returns :

gnutls_openpgp_trustdb_deinit ()

void        gnutls_openpgp_trustdb_deinit   (gnutls_openpgp_trustdb_t trustdb);

This function will deinitialize a CRL structure.

trustdb :

gnutls_openpgp_trustdb_init ()

int         gnutls_openpgp_trustdb_init     (gnutls_openpgp_trustdb *trustdb);

This function will initialize an OpenPGP trustdb structure.

trustdb :
Returns :

gnutls_openpgp_trustdb_import_file ()

int         gnutls_openpgp_trustdb_import_file
                                            (gnutls_openpgp_trustdb_t trustdb,
                                             const char *file);

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

trustdb :
file :
Returns :

gnutls_openpgp_key_verify_ring ()

int         gnutls_openpgp_key_verify_ring  (gnutls_openpgp_key_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_key_verify_trustdb ()

int         gnutls_openpgp_key_verify_trustdb
                                            (gnutls_openpgp_key_t key,
                                             gnutls_openpgp_trustdb_t trustdb,
                                             unsigned int flags,
                                             unsigned int *verify);

Checks if the key is revoked or disabled, in the trustdb. The 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 :
trustdb :
flags :
verify :
Returns :

gnutls_openpgp_key_verify_self ()

int         gnutls_openpgp_key_verify_self  (gnutls_openpgp_key_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_privkey_deinit ()

void        gnutls_openpgp_privkey_deinit   (gnutls_openpgp_privkey_t key);

This function will deinitialize a key structure.

key :