5 @subheading gnutls_certificate_set_openpgp_key_file2
6 @anchor{gnutls_certificate_set_openpgp_key_file2}
7 @deftypefun {int} {gnutls_certificate_set_openpgp_key_file2} (gnutls_certificate_credentials_t @var{res}, const char * @var{certfile}, const char * @var{keyfile}, const char * @var{subkey_id}, gnutls_openpgp_crt_fmt_t @var{format})
8 @var{res}: the destination context to save the data.
10 @var{certfile}: the file that contains the public key.
12 @var{keyfile}: the file that contains the secret key.
14 @var{subkey_id}: a hex encoded subkey id
16 @var{format}: the format of the keys
18 This funtion is used to load OpenPGP keys into the GnuTLS credential
19 structure. The file should contain at least one valid non encrypted subkey.
21 The special keyword "auto" is also accepted as @code{subkey_id}. In that
22 case the @code{gnutls_openpgp_crt_get_auth_subkey()} will be used to
25 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS} is returned, otherwise a
31 @subheading gnutls_certificate_set_openpgp_key_file
32 @anchor{gnutls_certificate_set_openpgp_key_file}
33 @deftypefun {int} {gnutls_certificate_set_openpgp_key_file} (gnutls_certificate_credentials_t @var{res}, const char * @var{certfile}, const char * @var{keyfile}, gnutls_openpgp_crt_fmt_t @var{format})
34 @var{res}: the destination context to save the data.
36 @var{certfile}: the file that contains the public key.
38 @var{keyfile}: the file that contains the secret key.
40 @var{format}: the format of the keys
42 This funtion is used to load OpenPGP keys into the GnuTLS
43 credentials structure. The file should contain at least one valid non encrypted subkey.
45 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS} is returned, otherwise a
49 @subheading gnutls_certificate_set_openpgp_key_mem2
50 @anchor{gnutls_certificate_set_openpgp_key_mem2}
51 @deftypefun {int} {gnutls_certificate_set_openpgp_key_mem2} (gnutls_certificate_credentials_t @var{res}, const gnutls_datum_t * @var{cert}, const gnutls_datum_t * @var{key}, const char * @var{subkey_id}, gnutls_openpgp_crt_fmt_t @var{format})
52 @var{res}: the destination context to save the data.
54 @var{cert}: the datum that contains the public key.
56 @var{key}: the datum that contains the secret key.
58 @var{subkey_id}: a hex encoded subkey id
60 @var{format}: the format of the keys
62 This funtion is used to load OpenPGP keys into the GnuTLS
63 credentials structure. The datum should contain at least one valid non encrypted subkey.
65 The special keyword "auto" is also accepted as @code{subkey_id}. In that
66 case the @code{gnutls_openpgp_crt_get_auth_subkey()} will be used to
69 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS} is returned, otherwise a
75 @subheading gnutls_certificate_set_openpgp_key_mem
76 @anchor{gnutls_certificate_set_openpgp_key_mem}
77 @deftypefun {int} {gnutls_certificate_set_openpgp_key_mem} (gnutls_certificate_credentials_t @var{res}, const gnutls_datum_t * @var{cert}, const gnutls_datum_t * @var{key}, gnutls_openpgp_crt_fmt_t @var{format})
78 @var{res}: the destination context to save the data.
80 @var{cert}: the datum that contains the public key.
82 @var{key}: the datum that contains the secret key.
84 @var{format}: the format of the keys
86 This funtion is used to load OpenPGP keys into the GnuTLS credential
87 structure. The datum should contain at least one valid non encrypted subkey.
89 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS} is returned, otherwise a
93 @subheading gnutls_certificate_set_openpgp_keyring_file
94 @anchor{gnutls_certificate_set_openpgp_keyring_file}
95 @deftypefun {int} {gnutls_certificate_set_openpgp_keyring_file} (gnutls_certificate_credentials_t @var{c}, const char * @var{file}, gnutls_openpgp_crt_fmt_t @var{format})
96 @var{c}: A certificate credentials structure
98 @var{file}: filename of the keyring.
100 @var{format}: format of keyring.
102 The function is used to set keyrings that will be used internally
103 by various OpenPGP functions. For example to find a key when it
104 is needed for an operations. The keyring will also be used at the
105 verification functions.
107 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS} is returned, otherwise a
108 negative error value.
111 @subheading gnutls_certificate_set_openpgp_keyring_mem
112 @anchor{gnutls_certificate_set_openpgp_keyring_mem}
113 @deftypefun {int} {gnutls_certificate_set_openpgp_keyring_mem} (gnutls_certificate_credentials_t @var{c}, const opaque * @var{data}, size_t @var{dlen}, gnutls_openpgp_crt_fmt_t @var{format})
114 @var{c}: A certificate credentials structure
116 @var{data}: buffer with keyring data.
118 @var{dlen}: length of data buffer.
120 @var{format}: the format of the keyring
122 The function is used to set keyrings that will be used internally
123 by various OpenPGP functions. For example to find a key when it
124 is needed for an operations. The keyring will also be used at the
125 verification functions.
127 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS} is returned, otherwise a
128 negative error value.
131 @subheading gnutls_certificate_set_openpgp_key
132 @anchor{gnutls_certificate_set_openpgp_key}
133 @deftypefun {int} {gnutls_certificate_set_openpgp_key} (gnutls_certificate_credentials_t @var{res}, gnutls_openpgp_crt_t @var{crt}, gnutls_openpgp_privkey_t @var{pkey})
134 @var{res}: is a @code{gnutls_certificate_credentials_t} structure.
136 @var{pkey}: is an openpgp private key
138 This function sets a certificate/private key pair in the
139 gnutls_certificate_credentials_t structure. This function may be
140 called more than once (in case multiple keys/certificates exist
143 Note that this function requires that the preferred key ids have
144 been set and be used. See @code{gnutls_openpgp_crt_set_preferred_key_id()}.
145 Otherwise the master key will be used.
147 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS} (zero) is returned,
148 otherwise an error code is returned.
151 @subheading gnutls_openpgp_crt_check_hostname
152 @anchor{gnutls_openpgp_crt_check_hostname}
153 @deftypefun {int} {gnutls_openpgp_crt_check_hostname} (gnutls_openpgp_crt_t @var{key}, const char * @var{hostname})
154 @var{key}: should contain a @code{gnutls_openpgp_crt_t} structure
156 @var{hostname}: A null terminated string that contains a DNS name
158 This function will check if the given key's owner matches the
159 given hostname. This is a basic implementation of the matching
160 described in RFC2818 (HTTPS), which takes into account wildcards.
162 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, or an error code.
165 @subheading gnutls_openpgp_crt_deinit
166 @anchor{gnutls_openpgp_crt_deinit}
167 @deftypefun {void} {gnutls_openpgp_crt_deinit} (gnutls_openpgp_crt_t @var{key})
168 @var{key}: The structure to be initialized
170 This function will deinitialize a key structure.
173 @subheading gnutls_openpgp_crt_export
174 @anchor{gnutls_openpgp_crt_export}
175 @deftypefun {int} {gnutls_openpgp_crt_export} (gnutls_openpgp_crt_t @var{key}, gnutls_openpgp_crt_fmt_t @var{format}, void * @var{output_data}, size_t * @var{output_data_size})
176 @var{key}: Holds the key.
178 @var{format}: One of gnutls_openpgp_crt_fmt_t elements.
180 @var{output_data}: will contain the key base64 encoded or raw
182 @var{output_data_size}: holds the size of output_data (and will
183 be replaced by the actual size of parameters)
185 This function will convert the given key to RAW or Base64 format.
186 If the buffer provided is not long enough to hold the output, then
187 @code{GNUTLS_E_SHORT_MEMORY_BUFFER} will be returned.
189 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, or an error code.
192 @subheading gnutls_openpgp_crt_get_auth_subkey
193 @anchor{gnutls_openpgp_crt_get_auth_subkey}
194 @deftypefun {int} {gnutls_openpgp_crt_get_auth_subkey} (gnutls_openpgp_crt_t @var{crt}, gnutls_openpgp_keyid_t @var{keyid}, unsigned int @var{flag})
195 @var{crt}: the structure that contains the OpenPGP public key.
197 @var{keyid}: the struct to save the keyid.
199 @var{flag}: Non zero indicates that a valid subkey is always returned.
201 Returns the 64-bit keyID of the first valid OpenPGP subkey marked
202 for authentication. If flag is non zero and no authentication
203 subkey exists, then a valid subkey will be returned even if it is
204 not marked for authentication.
205 Returns the 64-bit keyID of the first valid OpenPGP subkey marked
206 for authentication. If flag is non zero and no authentication
207 subkey exists, then a valid subkey will be returned even if it is
208 not marked for authentication.
210 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, or an error code.
213 @subheading gnutls_openpgp_crt_get_creation_time
214 @anchor{gnutls_openpgp_crt_get_creation_time}
215 @deftypefun {time_t} {gnutls_openpgp_crt_get_creation_time} (gnutls_openpgp_crt_t @var{key})
216 @var{key}: the structure that contains the OpenPGP public key.
218 Get key creation time.
220 @strong{Returns:} the timestamp when the OpenPGP key was created.
223 @subheading gnutls_openpgp_crt_get_expiration_time
224 @anchor{gnutls_openpgp_crt_get_expiration_time}
225 @deftypefun {time_t} {gnutls_openpgp_crt_get_expiration_time} (gnutls_openpgp_crt_t @var{key})
226 @var{key}: the structure that contains the OpenPGP public key.
228 Get key expiration time. A value of '0' means that the key doesn't
231 @strong{Returns:} the time when the OpenPGP key expires.
234 @subheading gnutls_openpgp_crt_get_fingerprint
235 @anchor{gnutls_openpgp_crt_get_fingerprint}
236 @deftypefun {int} {gnutls_openpgp_crt_get_fingerprint} (gnutls_openpgp_crt_t @var{key}, void * @var{fpr}, size_t * @var{fprlen})
237 @var{key}: the raw data that contains the OpenPGP public key.
239 @var{fpr}: the buffer to save the fingerprint, must hold at least 20 bytes.
241 @var{fprlen}: the integer to save the length of the fingerprint.
243 Get key fingerprint. Depending on the algorithm, the fingerprint
244 can be 16 or 20 bytes.
246 @strong{Returns:} On success, 0 is returned. Otherwise, an error code.
249 @subheading gnutls_openpgp_crt_get_key_id
250 @anchor{gnutls_openpgp_crt_get_key_id}
251 @deftypefun {int} {gnutls_openpgp_crt_get_key_id} (gnutls_openpgp_crt_t @var{key}, gnutls_openpgp_keyid_t @var{keyid})
252 @var{key}: the structure that contains the OpenPGP public key.
254 @var{keyid}: the buffer to save the keyid.
258 @strong{Returns:} the 64-bit keyID of the OpenPGP key.
260 @strong{Since:} 2.4.0
263 @subheading gnutls_openpgp_crt_get_key_usage
264 @anchor{gnutls_openpgp_crt_get_key_usage}
265 @deftypefun {int} {gnutls_openpgp_crt_get_key_usage} (gnutls_openpgp_crt_t @var{key}, unsigned int * @var{key_usage})
266 @var{key}: should contain a gnutls_openpgp_crt_t structure
268 @var{key_usage}: where the key usage bits will be stored
270 This function will return certificate's key usage, by checking the
271 key algorithm. The key usage value will ORed values of the:
272 @code{GNUTLS_KEY_DIGITAL_SIGNATURE}, @code{GNUTLS_KEY_KEY_ENCIPHERMENT}.
274 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, or an error code.
277 @subheading gnutls_openpgp_crt_get_name
278 @anchor{gnutls_openpgp_crt_get_name}
279 @deftypefun {int} {gnutls_openpgp_crt_get_name} (gnutls_openpgp_crt_t @var{key}, int @var{idx}, char * @var{buf}, size_t * @var{sizeof_buf})
280 @var{key}: the structure that contains the OpenPGP public key.
282 @var{idx}: the index of the ID to extract
284 @var{buf}: a pointer to a structure to hold the name, may be @code{NULL}
285 to only get the @code{sizeof_buf}.
287 @var{sizeof_buf}: holds the maximum size of @code{buf}, on return hold the
288 actual/required size of @code{buf}.
290 Extracts the userID from the parsed OpenPGP key.
292 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, and if the index of the ID
293 does not exist @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}, or an
297 @subheading gnutls_openpgp_crt_get_pk_algorithm
298 @anchor{gnutls_openpgp_crt_get_pk_algorithm}
299 @deftypefun {gnutls_pk_algorithm_t} {gnutls_openpgp_crt_get_pk_algorithm} (gnutls_openpgp_crt_t @var{key}, unsigned int * @var{bits})
300 @var{key}: is an OpenPGP key
302 @var{bits}: if bits is non null it will hold the size of the parameters' in bits
304 This function will return the public key algorithm of an OpenPGP
307 If bits is non null, it should have enough size to hold the parameters
308 size in bits. For RSA the bits returned is the modulus.
309 For DSA the bits returned are of the public exponent.
311 @strong{Returns:} a member of the @code{gnutls_pk_algorithm_t} enumeration on
312 success, or GNUTLS_PK_UNKNOWN on error.
315 @subheading gnutls_openpgp_crt_get_pk_dsa_raw
316 @anchor{gnutls_openpgp_crt_get_pk_dsa_raw}
317 @deftypefun {int} {gnutls_openpgp_crt_get_pk_dsa_raw} (gnutls_openpgp_crt_t @var{crt}, gnutls_datum_t * @var{p}, gnutls_datum_t * @var{q}, gnutls_datum_t * @var{g}, gnutls_datum_t * @var{y})
318 @var{crt}: Holds the certificate
320 @var{p}: will hold the p
322 @var{q}: will hold the q
324 @var{g}: will hold the g
326 @var{y}: will hold the y
328 This function will export the DSA public key's parameters found in
329 the given certificate. The new parameters will be allocated using
330 @code{gnutls_malloc()} and will be stored in the appropriate datum.
332 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, otherwise an error.
334 @strong{Since:} 2.4.0
337 @subheading gnutls_openpgp_crt_get_pk_rsa_raw
338 @anchor{gnutls_openpgp_crt_get_pk_rsa_raw}
339 @deftypefun {int} {gnutls_openpgp_crt_get_pk_rsa_raw} (gnutls_openpgp_crt_t @var{crt}, gnutls_datum_t * @var{m}, gnutls_datum_t * @var{e})
340 @var{crt}: Holds the certificate
342 @var{m}: will hold the modulus
344 @var{e}: will hold the public exponent
346 This function will export the RSA public key's parameters found in
347 the given structure. The new parameters will be allocated using
348 @code{gnutls_malloc()} and will be stored in the appropriate datum.
350 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, otherwise an error.
352 @strong{Since:} 2.4.0
355 @subheading gnutls_openpgp_crt_get_preferred_key_id
356 @anchor{gnutls_openpgp_crt_get_preferred_key_id}
357 @deftypefun {int} {gnutls_openpgp_crt_get_preferred_key_id} (gnutls_openpgp_crt_t @var{key}, gnutls_openpgp_keyid_t @var{keyid})
358 @var{key}: the structure that contains the OpenPGP public key.
360 @var{keyid}: the struct to save the keyid.
362 Get preferred key id. If it hasn't been set it returns
363 @code{GNUTLS_E_INVALID_REQUEST}.
365 @strong{Returns:} the 64-bit preferred keyID of the OpenPGP key.
368 @subheading gnutls_openpgp_crt_get_revoked_status
369 @anchor{gnutls_openpgp_crt_get_revoked_status}
370 @deftypefun {int} {gnutls_openpgp_crt_get_revoked_status} (gnutls_openpgp_crt_t @var{key})
371 @var{key}: the structure that contains the OpenPGP public key.
373 Get revocation status of key.
375 @strong{Returns:} true (1) if the key has been revoked, or false (0) if it
378 @strong{Since:} 2.4.0
381 @subheading gnutls_openpgp_crt_get_subkey_count
382 @anchor{gnutls_openpgp_crt_get_subkey_count}
383 @deftypefun {int} {gnutls_openpgp_crt_get_subkey_count} (gnutls_openpgp_crt_t @var{key})
384 @var{key}: is an OpenPGP key
386 This function will return the number of subkeys present in the
387 given OpenPGP certificate.
389 @strong{Returns:} the number of subkeys, or a negative value on error.
391 @strong{Since:} 2.4.0
394 @subheading gnutls_openpgp_crt_get_subkey_creation_time
395 @anchor{gnutls_openpgp_crt_get_subkey_creation_time}
396 @deftypefun {time_t} {gnutls_openpgp_crt_get_subkey_creation_time} (gnutls_openpgp_crt_t @var{key}, unsigned int @var{idx})
397 @var{key}: the structure that contains the OpenPGP public key.
399 @var{idx}: the subkey index
401 Get subkey creation time.
403 @strong{Returns:} the timestamp when the OpenPGP sub-key was created.
405 @strong{Since:} 2.4.0
408 @subheading gnutls_openpgp_crt_get_subkey_expiration_time
409 @anchor{gnutls_openpgp_crt_get_subkey_expiration_time}
410 @deftypefun {time_t} {gnutls_openpgp_crt_get_subkey_expiration_time} (gnutls_openpgp_crt_t @var{key}, unsigned int @var{idx})
411 @var{key}: the structure that contains the OpenPGP public key.
413 @var{idx}: the subkey index
415 Get subkey expiration time. A value of '0' means that the key
416 doesn't expire at all.
418 @strong{Returns:} the time when the OpenPGP key expires.
420 @strong{Since:} 2.4.0
423 @subheading gnutls_openpgp_crt_get_subkey_fingerprint
424 @anchor{gnutls_openpgp_crt_get_subkey_fingerprint}
425 @deftypefun {int} {gnutls_openpgp_crt_get_subkey_fingerprint} (gnutls_openpgp_crt_t @var{key}, unsigned int @var{idx}, void * @var{fpr}, size_t * @var{fprlen})
426 @var{key}: the raw data that contains the OpenPGP public key.
428 @var{idx}: the subkey index
430 @var{fpr}: the buffer to save the fingerprint, must hold at least 20 bytes.
432 @var{fprlen}: the integer to save the length of the fingerprint.
434 Get key fingerprint of a subkey. Depending on the algorithm, the
435 fingerprint can be 16 or 20 bytes.
437 @strong{Returns:} On success, 0 is returned. Otherwise, an error code.
439 @strong{Since:} 2.4.0
442 @subheading gnutls_openpgp_crt_get_subkey_idx
443 @anchor{gnutls_openpgp_crt_get_subkey_idx}
444 @deftypefun {int} {gnutls_openpgp_crt_get_subkey_idx} (gnutls_openpgp_crt_t @var{key}, const gnutls_openpgp_keyid_t @var{keyid})
445 @var{key}: the structure that contains the OpenPGP public key.
447 @var{keyid}: the keyid.
451 @strong{Returns:} the index of the subkey or a negative error value.
453 @strong{Since:} 2.4.0
456 @subheading gnutls_openpgp_crt_get_subkey_id
457 @anchor{gnutls_openpgp_crt_get_subkey_id}
458 @deftypefun {int} {gnutls_openpgp_crt_get_subkey_id} (gnutls_openpgp_crt_t @var{key}, unsigned int @var{idx}, gnutls_openpgp_keyid_t @var{keyid})
459 @var{key}: the structure that contains the OpenPGP public key.
461 @var{idx}: the subkey index
463 @var{keyid}: the buffer to save the keyid.
465 Get the subkey's key-id.
467 @strong{Returns:} the 64-bit keyID of the OpenPGP key.
470 @subheading gnutls_openpgp_crt_get_subkey_pk_algorithm
471 @anchor{gnutls_openpgp_crt_get_subkey_pk_algorithm}
472 @deftypefun {gnutls_pk_algorithm_t} {gnutls_openpgp_crt_get_subkey_pk_algorithm} (gnutls_openpgp_crt_t @var{key}, unsigned int @var{idx}, unsigned int * @var{bits})
473 @var{key}: is an OpenPGP key
475 @var{idx}: is the subkey index
477 @var{bits}: if bits is non null it will hold the size of the parameters' in bits
479 This function will return the public key algorithm of a subkey of an OpenPGP
482 If bits is non null, it should have enough size to hold the
483 parameters size in bits. For RSA the bits returned is the modulus.
484 For DSA the bits returned are of the public exponent.
486 @strong{Returns:} a member of the @code{gnutls_pk_algorithm_t} enumeration on
487 success, or GNUTLS_PK_UNKNOWN on error.
489 @strong{Since:} 2.4.0
492 @subheading gnutls_openpgp_crt_get_subkey_pk_dsa_raw
493 @anchor{gnutls_openpgp_crt_get_subkey_pk_dsa_raw}
494 @deftypefun {int} {gnutls_openpgp_crt_get_subkey_pk_dsa_raw} (gnutls_openpgp_crt_t @var{crt}, unsigned int @var{idx}, gnutls_datum_t * @var{p}, gnutls_datum_t * @var{q}, gnutls_datum_t * @var{g}, gnutls_datum_t * @var{y})
495 @var{crt}: Holds the certificate
497 @var{idx}: Is the subkey index
499 @var{p}: will hold the p
501 @var{q}: will hold the q
503 @var{g}: will hold the g
505 @var{y}: will hold the y
507 This function will export the DSA public key's parameters found in
508 the given certificate. The new parameters will be allocated using
509 @code{gnutls_malloc()} and will be stored in the appropriate datum.
511 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, otherwise an error.
513 @strong{Since:} 2.4.0
516 @subheading gnutls_openpgp_crt_get_subkey_pk_rsa_raw
517 @anchor{gnutls_openpgp_crt_get_subkey_pk_rsa_raw}
518 @deftypefun {int} {gnutls_openpgp_crt_get_subkey_pk_rsa_raw} (gnutls_openpgp_crt_t @var{crt}, unsigned int @var{idx}, gnutls_datum_t * @var{m}, gnutls_datum_t * @var{e})
519 @var{crt}: Holds the certificate
521 @var{idx}: Is the subkey index
523 @var{m}: will hold the modulus
525 @var{e}: will hold the public exponent
527 This function will export the RSA public key's parameters found in
528 the given structure. The new parameters will be allocated using
529 @code{gnutls_malloc()} and will be stored in the appropriate datum.
531 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, otherwise an error.
533 @strong{Since:} 2.4.0
536 @subheading gnutls_openpgp_crt_get_subkey_revoked_status
537 @anchor{gnutls_openpgp_crt_get_subkey_revoked_status}
538 @deftypefun {int} {gnutls_openpgp_crt_get_subkey_revoked_status} (gnutls_openpgp_crt_t @var{key}, unsigned int @var{idx})
539 @var{key}: the structure that contains the OpenPGP public key.
541 @var{idx}: is the subkey index
543 Get subkey revocation status. A negative value indicates an error.
545 @strong{Returns:} true (1) if the key has been revoked, or false (0) if it
548 @strong{Since:} 2.4.0
551 @subheading gnutls_openpgp_crt_get_subkey_usage
552 @anchor{gnutls_openpgp_crt_get_subkey_usage}
553 @deftypefun {int} {gnutls_openpgp_crt_get_subkey_usage} (gnutls_openpgp_crt_t @var{key}, unsigned int @var{idx}, unsigned int * @var{key_usage})
554 @var{key}: should contain a gnutls_openpgp_crt_t structure
556 @var{idx}: the subkey index
558 @var{key_usage}: where the key usage bits will be stored
560 This function will return certificate's key usage, by checking the
561 key algorithm. The key usage value will ORed values of
562 @code{GNUTLS_KEY_DIGITAL_SIGNATURE} or @code{GNUTLS_KEY_KEY_ENCIPHERMENT}.
564 A negative value may be returned in case of parsing error.
566 @strong{Returns:} key usage value.
568 @strong{Since:} 2.4.0
571 @subheading gnutls_openpgp_crt_get_version
572 @anchor{gnutls_openpgp_crt_get_version}
573 @deftypefun {int} {gnutls_openpgp_crt_get_version} (gnutls_openpgp_crt_t @var{key})
574 @var{key}: the structure that contains the OpenPGP public key.
576 Extract the version of the OpenPGP key.
578 @strong{Returns:} the version number is returned, or a negative value on errors.
581 @subheading gnutls_openpgp_crt_import
582 @anchor{gnutls_openpgp_crt_import}
583 @deftypefun {int} {gnutls_openpgp_crt_import} (gnutls_openpgp_crt_t @var{key}, const gnutls_datum_t * @var{data}, gnutls_openpgp_crt_fmt_t @var{format})
584 @var{key}: The structure to store the parsed key.
586 @var{data}: The RAW or BASE64 encoded key.
588 @var{format}: One of gnutls_openpgp_crt_fmt_t elements.
590 This function will convert the given RAW or Base64 encoded key to
591 the native @code{gnutls_openpgp_crt_t} format. The output will be stored
594 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, or an error code.
597 @subheading gnutls_openpgp_crt_init
598 @anchor{gnutls_openpgp_crt_init}
599 @deftypefun {int} {gnutls_openpgp_crt_init} (gnutls_openpgp_crt_t * @var{key})
600 @var{key}: The structure to be initialized
602 This function will initialize an OpenPGP key structure.
604 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, or an error code.
607 @subheading gnutls_openpgp_crt_print
608 @anchor{gnutls_openpgp_crt_print}
609 @deftypefun {int} {gnutls_openpgp_crt_print} (gnutls_openpgp_crt_t @var{cert}, gnutls_certificate_print_formats_t @var{format}, gnutls_datum_t * @var{out})
610 @var{cert}: The structure to be printed
612 @var{format}: Indicate the format to use
614 @var{out}: Newly allocated datum with zero terminated string.
616 This function will pretty print an OpenPGP certificate, suitable
617 for display to a human.
619 The format should be zero for future compatibility.
621 The output @code{out} needs to be deallocate using @code{gnutls_free()}.
623 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, or an error code.
626 @subheading gnutls_openpgp_crt_set_preferred_key_id
627 @anchor{gnutls_openpgp_crt_set_preferred_key_id}
628 @deftypefun {int} {gnutls_openpgp_crt_set_preferred_key_id} (gnutls_openpgp_crt_t @var{key}, const gnutls_openpgp_keyid_t @var{keyid})
629 @var{key}: the structure that contains the OpenPGP public key.
631 @var{keyid}: the selected keyid
633 This allows setting a preferred key id for the given certificate.
634 This key will be used by functions that involve key handling.
636 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS} (zero) is returned,
637 otherwise an error code is returned.
640 @subheading gnutls_openpgp_crt_verify_ring
641 @anchor{gnutls_openpgp_crt_verify_ring}
642 @deftypefun {int} {gnutls_openpgp_crt_verify_ring} (gnutls_openpgp_crt_t @var{key}, gnutls_openpgp_keyring_t @var{keyring}, unsigned int @var{flags}, unsigned int * @var{verify})
643 @var{key}: the structure that holds the key.
645 @var{keyring}: holds the keyring to check against
647 @var{flags}: unused (should be 0)
649 @var{verify}: will hold the certificate verification output.
651 Verify all signatures in the key, using the given set of keys
654 The key verification output will be put in @code{verify} and will be one
655 or more of the @code{gnutls_certificate_status_t} enumerated elements
658 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, or an error code.
661 @subheading gnutls_openpgp_crt_verify_self
662 @anchor{gnutls_openpgp_crt_verify_self}
663 @deftypefun {int} {gnutls_openpgp_crt_verify_self} (gnutls_openpgp_crt_t @var{key}, unsigned int @var{flags}, unsigned int * @var{verify})
664 @var{key}: the structure that holds the key.
666 @var{flags}: unused (should be 0)
668 @var{verify}: will hold the key verification output.
670 Verifies the self signature in the key. The key verification
671 output will be put in @code{verify} and will be one or more of the
672 gnutls_certificate_status_t enumerated elements bitwise or'd.
674 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, or an error code.
677 @subheading gnutls_openpgp_keyring_check_id
678 @anchor{gnutls_openpgp_keyring_check_id}
679 @deftypefun {int} {gnutls_openpgp_keyring_check_id} (gnutls_openpgp_keyring_t @var{ring}, const gnutls_openpgp_keyid_t @var{keyid}, unsigned int @var{flags})
680 @var{ring}: holds the keyring to check against
682 @var{keyid}: will hold the keyid to check for.
684 @var{flags}: unused (should be 0)
686 Check if a given key ID exists in the keyring.
688 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success (if keyid exists) and a
689 negative error code on failure.
692 @subheading gnutls_openpgp_keyring_deinit
693 @anchor{gnutls_openpgp_keyring_deinit}
694 @deftypefun {void} {gnutls_openpgp_keyring_deinit} (gnutls_openpgp_keyring_t @var{keyring})
695 @var{keyring}: The structure to be initialized
697 This function will deinitialize a keyring structure.
700 @subheading gnutls_openpgp_keyring_get_crt_count
701 @anchor{gnutls_openpgp_keyring_get_crt_count}
702 @deftypefun {int} {gnutls_openpgp_keyring_get_crt_count} (gnutls_openpgp_keyring_t @var{ring})
703 @var{ring}: is an OpenPGP key ring
705 This function will return the number of OpenPGP certificates
706 present in the given keyring.
708 @strong{Returns:} the number of subkeys, or a negative value on error.
711 @subheading gnutls_openpgp_keyring_get_crt
712 @anchor{gnutls_openpgp_keyring_get_crt}
713 @deftypefun {int} {gnutls_openpgp_keyring_get_crt} (gnutls_openpgp_keyring_t @var{ring}, unsigned int @var{idx}, gnutls_openpgp_crt_t * @var{cert})
714 @var{ring}: Holds the keyring.
716 @var{idx}: the index of the certificate to export
718 @var{cert}: An uninitialized @code{gnutls_openpgp_crt_t} structure
720 This function will extract an OpenPGP certificate from the given
721 keyring. If the index given is out of range
722 @code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE} will be returned. The
723 returned structure needs to be deinited.
725 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, or an error code.
728 @subheading gnutls_openpgp_keyring_import
729 @anchor{gnutls_openpgp_keyring_import}
730 @deftypefun {int} {gnutls_openpgp_keyring_import} (gnutls_openpgp_keyring_t @var{keyring}, const gnutls_datum_t * @var{data}, gnutls_openpgp_crt_fmt_t @var{format})
731 @var{keyring}: The structure to store the parsed key.
733 @var{data}: The RAW or BASE64 encoded keyring.
735 @var{format}: One of @code{gnutls_openpgp_keyring_fmt} elements.
737 This function will convert the given RAW or Base64 encoded keyring
738 to the native @code{gnutls_openpgp_keyring_t} format. The output will be
741 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, or an error code.
743 @subheading gnutls_openpgp_keyring_init
744 @anchor{gnutls_openpgp_keyring_init}
745 @deftypefun {int} {gnutls_openpgp_keyring_init} (gnutls_openpgp_keyring_t * @var{keyring})
746 @var{keyring}: The structure to be initialized
748 This function will initialize an keyring structure.
750 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, or an error code.
753 @subheading gnutls_openpgp_privkey_deinit
754 @anchor{gnutls_openpgp_privkey_deinit}
755 @deftypefun {void} {gnutls_openpgp_privkey_deinit} (gnutls_openpgp_privkey_t @var{key})
756 @var{key}: The structure to be initialized
758 This function will deinitialize a key structure.
761 @subheading gnutls_openpgp_privkey_export_dsa_raw
762 @anchor{gnutls_openpgp_privkey_export_dsa_raw}
763 @deftypefun {int} {gnutls_openpgp_privkey_export_dsa_raw} (gnutls_openpgp_privkey_t @var{pkey}, gnutls_datum_t * @var{p}, gnutls_datum_t * @var{q}, gnutls_datum_t * @var{g}, gnutls_datum_t * @var{y}, gnutls_datum_t * @var{x})
764 @var{pkey}: Holds the certificate
766 @var{p}: will hold the p
768 @var{q}: will hold the q
770 @var{g}: will hold the g
772 @var{y}: will hold the y
774 @var{x}: will hold the x
776 This function will export the DSA private key's parameters found in
777 the given certificate. The new parameters will be allocated using
778 @code{gnutls_malloc()} and will be stored in the appropriate datum.
780 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, otherwise an error.
782 @strong{Since:} 2.4.0
785 @subheading gnutls_openpgp_privkey_export_rsa_raw
786 @anchor{gnutls_openpgp_privkey_export_rsa_raw}
787 @deftypefun {int} {gnutls_openpgp_privkey_export_rsa_raw} (gnutls_openpgp_privkey_t @var{pkey}, gnutls_datum_t * @var{m}, gnutls_datum_t * @var{e}, gnutls_datum_t * @var{d}, gnutls_datum_t * @var{p}, gnutls_datum_t * @var{q}, gnutls_datum_t * @var{u})
788 @var{pkey}: Holds the certificate
790 @var{m}: will hold the modulus
792 @var{e}: will hold the public exponent
794 @var{d}: will hold the private exponent
796 @var{p}: will hold the first prime (p)
798 @var{q}: will hold the second prime (q)
800 @var{u}: will hold the coefficient
802 This function will export the RSA private key's parameters found in
803 the given structure. The new parameters will be allocated using
804 @code{gnutls_malloc()} and will be stored in the appropriate datum.
806 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, otherwise an error.
808 @strong{Since:} 2.4.0
811 @subheading gnutls_openpgp_privkey_export_subkey_dsa_raw
812 @anchor{gnutls_openpgp_privkey_export_subkey_dsa_raw}
813 @deftypefun {int} {gnutls_openpgp_privkey_export_subkey_dsa_raw} (gnutls_openpgp_privkey_t @var{pkey}, unsigned int @var{idx}, gnutls_datum_t * @var{p}, gnutls_datum_t * @var{q}, gnutls_datum_t * @var{g}, gnutls_datum_t * @var{y}, gnutls_datum_t * @var{x})
814 @var{pkey}: Holds the certificate
816 @var{idx}: Is the subkey index
818 @var{p}: will hold the p
820 @var{q}: will hold the q
822 @var{g}: will hold the g
824 @var{y}: will hold the y
826 @var{x}: will hold the x
828 This function will export the DSA private key's parameters found
829 in the given certificate. The new parameters will be allocated
830 using @code{gnutls_malloc()} and will be stored in the appropriate datum.
832 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, otherwise an error.
834 @strong{Since:} 2.4.0
837 @subheading gnutls_openpgp_privkey_export_subkey_rsa_raw
838 @anchor{gnutls_openpgp_privkey_export_subkey_rsa_raw}
839 @deftypefun {int} {gnutls_openpgp_privkey_export_subkey_rsa_raw} (gnutls_openpgp_privkey_t @var{pkey}, unsigned int @var{idx}, gnutls_datum_t * @var{m}, gnutls_datum_t * @var{e}, gnutls_datum_t * @var{d}, gnutls_datum_t * @var{p}, gnutls_datum_t * @var{q}, gnutls_datum_t * @var{u})
840 @var{pkey}: Holds the certificate
842 @var{idx}: Is the subkey index
844 @var{m}: will hold the modulus
846 @var{e}: will hold the public exponent
848 @var{d}: will hold the private exponent
850 @var{p}: will hold the first prime (p)
852 @var{q}: will hold the second prime (q)
854 @var{u}: will hold the coefficient
856 This function will export the RSA private key's parameters found in
857 the given structure. The new parameters will be allocated using
858 @code{gnutls_malloc()} and will be stored in the appropriate datum.
860 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, otherwise an error.
862 @strong{Since:} 2.4.0
865 @subheading gnutls_openpgp_privkey_export
866 @anchor{gnutls_openpgp_privkey_export}
867 @deftypefun {int} {gnutls_openpgp_privkey_export} (gnutls_openpgp_privkey_t @var{key}, gnutls_openpgp_crt_fmt_t @var{format}, const char * @var{password}, unsigned int @var{flags}, void * @var{output_data}, size_t * @var{output_data_size})
868 @var{key}: Holds the key.
870 @var{format}: One of gnutls_openpgp_crt_fmt_t elements.
872 @var{password}: the password that will be used to encrypt the key. (unused for now)
874 @var{flags}: zero for future compatibility
876 @var{output_data}: will contain the key base64 encoded or raw
878 @var{output_data_size}: holds the size of output_data (and will be
879 replaced by the actual size of parameters)
881 This function will convert the given key to RAW or Base64 format.
882 If the buffer provided is not long enough to hold the output, then
883 GNUTLS_E_SHORT_MEMORY_BUFFER will be returned.
885 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, or an error code.
887 @strong{Since:} 2.4.0
890 @subheading gnutls_openpgp_privkey_get_fingerprint
891 @anchor{gnutls_openpgp_privkey_get_fingerprint}
892 @deftypefun {int} {gnutls_openpgp_privkey_get_fingerprint} (gnutls_openpgp_privkey_t @var{key}, void * @var{fpr}, size_t * @var{fprlen})
893 @var{key}: the raw data that contains the OpenPGP secret key.
895 @var{fpr}: the buffer to save the fingerprint, must hold at least 20 bytes.
897 @var{fprlen}: the integer to save the length of the fingerprint.
899 Get the fingerprint of the OpenPGP key. Depends on the
900 algorithm, the fingerprint can be 16 or 20 bytes.
902 @strong{Returns:} On success, 0 is returned, or an error code.
904 @strong{Since:} 2.4.0
907 @subheading gnutls_openpgp_privkey_get_key_id
908 @anchor{gnutls_openpgp_privkey_get_key_id}
909 @deftypefun {int} {gnutls_openpgp_privkey_get_key_id} (gnutls_openpgp_privkey_t @var{key}, gnutls_openpgp_keyid_t @var{keyid})
910 @var{key}: the structure that contains the OpenPGP secret key.
912 @var{keyid}: the buffer to save the keyid.
916 @strong{Returns:} the 64-bit keyID of the OpenPGP key.
918 @strong{Since:} 2.4.0
921 @subheading gnutls_openpgp_privkey_get_pk_algorithm
922 @anchor{gnutls_openpgp_privkey_get_pk_algorithm}
923 @deftypefun {gnutls_pk_algorithm_t} {gnutls_openpgp_privkey_get_pk_algorithm} (gnutls_openpgp_privkey_t @var{key}, unsigned int * @var{bits})
924 @var{key}: is an OpenPGP key
926 @var{bits}: if bits is non null it will hold the size of the parameters' in bits
928 This function will return the public key algorithm of an OpenPGP
931 If bits is non null, it should have enough size to hold the parameters
932 size in bits. For RSA the bits returned is the modulus.
933 For DSA the bits returned are of the public exponent.
935 @strong{Returns:} a member of the @code{gnutls_pk_algorithm_t} enumeration on
936 success, or a negative value on error.
938 @strong{Since:} 2.4.0
941 @subheading gnutls_openpgp_privkey_get_preferred_key_id
942 @anchor{gnutls_openpgp_privkey_get_preferred_key_id}
943 @deftypefun {int} {gnutls_openpgp_privkey_get_preferred_key_id} (gnutls_openpgp_privkey_t @var{key}, gnutls_openpgp_keyid_t @var{keyid})
944 @var{key}: the structure that contains the OpenPGP public key.
946 @var{keyid}: the struct to save the keyid.
948 Get the preferred key-id for the key.
950 @strong{Returns:} the 64-bit preferred keyID of the OpenPGP key, or if it
951 hasn't been set it returns @code{GNUTLS_E_INVALID_REQUEST}.
954 @subheading gnutls_openpgp_privkey_get_revoked_status
955 @anchor{gnutls_openpgp_privkey_get_revoked_status}
956 @deftypefun {int} {gnutls_openpgp_privkey_get_revoked_status} (gnutls_openpgp_privkey_t @var{key})
957 @var{key}: the structure that contains the OpenPGP private key.
959 Get revocation status of key.
961 @strong{Returns:} true (1) if the key has been revoked, or false (0) if it
962 has not, or a negative value indicates an error.
964 @strong{Since:} 2.4.0
967 @subheading gnutls_openpgp_privkey_get_subkey_count
968 @anchor{gnutls_openpgp_privkey_get_subkey_count}
969 @deftypefun {int} {gnutls_openpgp_privkey_get_subkey_count} (gnutls_openpgp_privkey_t @var{key})
970 @var{key}: is an OpenPGP key
972 This function will return the number of subkeys present in the
973 given OpenPGP certificate.
975 @strong{Returns:} the number of subkeys, or a negative value on error.
977 @strong{Since:} 2.4.0
980 @subheading gnutls_openpgp_privkey_get_subkey_creation_time
981 @anchor{gnutls_openpgp_privkey_get_subkey_creation_time}
982 @deftypefun {time_t} {gnutls_openpgp_privkey_get_subkey_creation_time} (gnutls_openpgp_privkey_t @var{key}, unsigned int @var{idx})
983 @var{key}: the structure that contains the OpenPGP private key.
985 @var{idx}: the subkey index
987 Get subkey creation time.
989 @strong{Returns:} the timestamp when the OpenPGP key was created.
991 @strong{Since:} 2.4.0
994 @subheading gnutls_openpgp_privkey_get_subkey_expiration_time
995 @anchor{gnutls_openpgp_privkey_get_subkey_expiration_time}
996 @deftypefun {time_t} {gnutls_openpgp_privkey_get_subkey_expiration_time} (gnutls_openpgp_privkey_t @var{key}, unsigned int @var{idx})
997 @var{key}: the structure that contains the OpenPGP private key.
999 @var{idx}: the subkey index
1001 Get subkey expiration time. A value of '0' means that the key
1002 doesn't expire at all.
1004 @strong{Returns:} the time when the OpenPGP key expires.
1006 @strong{Since:} 2.4.0
1009 @subheading gnutls_openpgp_privkey_get_subkey_fingerprint
1010 @anchor{gnutls_openpgp_privkey_get_subkey_fingerprint}
1011 @deftypefun {int} {gnutls_openpgp_privkey_get_subkey_fingerprint} (gnutls_openpgp_privkey_t @var{key}, unsigned int @var{idx}, void * @var{fpr}, size_t * @var{fprlen})
1012 @var{key}: the raw data that contains the OpenPGP secret key.
1014 @var{idx}: the subkey index
1016 @var{fpr}: the buffer to save the fingerprint, must hold at least 20 bytes.
1018 @var{fprlen}: the integer to save the length of the fingerprint.
1020 Get the fingerprint of an OpenPGP subkey. Depends on the
1021 algorithm, the fingerprint can be 16 or 20 bytes.
1023 @strong{Returns:} On success, 0 is returned, or an error code.
1025 @strong{Since:} 2.4.0
1028 @subheading gnutls_openpgp_privkey_get_subkey_idx
1029 @anchor{gnutls_openpgp_privkey_get_subkey_idx}
1030 @deftypefun {int} {gnutls_openpgp_privkey_get_subkey_idx} (gnutls_openpgp_privkey_t @var{key}, const gnutls_openpgp_keyid_t @var{keyid})
1031 @var{key}: the structure that contains the OpenPGP private key.
1033 @var{keyid}: the keyid.
1035 Get index of subkey.
1037 @strong{Returns:} the index of the subkey or a negative error value.
1039 @strong{Since:} 2.4.0
1042 @subheading gnutls_openpgp_privkey_get_subkey_id
1043 @anchor{gnutls_openpgp_privkey_get_subkey_id}
1044 @deftypefun {int} {gnutls_openpgp_privkey_get_subkey_id} (gnutls_openpgp_privkey_t @var{key}, unsigned int @var{idx}, gnutls_openpgp_keyid_t @var{keyid})
1045 @var{key}: the structure that contains the OpenPGP secret key.
1047 @var{idx}: the subkey index
1049 @var{keyid}: the buffer to save the keyid.
1051 Get the key-id for the subkey.
1053 @strong{Returns:} the 64-bit keyID of the OpenPGP key.
1055 @strong{Since:} 2.4.0
1058 @subheading gnutls_openpgp_privkey_get_subkey_pk_algorithm
1059 @anchor{gnutls_openpgp_privkey_get_subkey_pk_algorithm}
1060 @deftypefun {gnutls_pk_algorithm_t} {gnutls_openpgp_privkey_get_subkey_pk_algorithm} (gnutls_openpgp_privkey_t @var{key}, unsigned int @var{idx}, unsigned int * @var{bits})
1061 @var{key}: is an OpenPGP key
1063 @var{idx}: is the subkey index
1065 @var{bits}: if bits is non null it will hold the size of the parameters' in bits
1067 This function will return the public key algorithm of a subkey of an OpenPGP
1070 If bits is non null, it should have enough size to hold the parameters
1071 size in bits. For RSA the bits returned is the modulus.
1072 For DSA the bits returned are of the public exponent.
1074 @strong{Returns:} a member of the @code{gnutls_pk_algorithm_t} enumeration on
1075 success, or a negative value on error.
1077 @strong{Since:} 2.4.0
1080 @subheading gnutls_openpgp_privkey_get_subkey_revoked_status
1081 @anchor{gnutls_openpgp_privkey_get_subkey_revoked_status}
1082 @deftypefun {int} {gnutls_openpgp_privkey_get_subkey_revoked_status} (gnutls_openpgp_privkey_t @var{key}, unsigned int @var{idx})
1083 @var{key}: the structure that contains the OpenPGP private key.
1085 @var{idx}: is the subkey index
1087 Get revocation status of key.
1089 @strong{Returns:} true (1) if the key has been revoked, or false (0) if it
1090 has not, or a negative value indicates an error.
1092 @strong{Since:} 2.4.0
1095 @subheading gnutls_openpgp_privkey_import
1096 @anchor{gnutls_openpgp_privkey_import}
1097 @deftypefun {int} {gnutls_openpgp_privkey_import} (gnutls_openpgp_privkey_t @var{key}, const gnutls_datum_t * @var{data}, gnutls_openpgp_crt_fmt_t @var{format}, const char * @var{password}, unsigned int @var{flags})
1098 @var{key}: The structure to store the parsed key.
1100 @var{data}: The RAW or BASE64 encoded key.
1102 @var{format}: One of @code{gnutls_openpgp_crt_fmt_t} elements.
1104 @var{password}: not used for now
1106 @var{flags}: should be zero
1108 This function will convert the given RAW or Base64 encoded key to
1109 the native gnutls_openpgp_privkey_t format. The output will be
1112 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, or an error code.
1115 @subheading gnutls_openpgp_privkey_init
1116 @anchor{gnutls_openpgp_privkey_init}
1117 @deftypefun {int} {gnutls_openpgp_privkey_init} (gnutls_openpgp_privkey_t * @var{key})
1118 @var{key}: The structure to be initialized
1120 This function will initialize an OpenPGP key structure.
1122 @strong{Returns:} @code{GNUTLS_E_SUCCESS} on success, or an error code.
1125 @subheading gnutls_openpgp_privkey_sec_param
1126 @anchor{gnutls_openpgp_privkey_sec_param}
1127 @deftypefun {gnutls_sec_param_t} {gnutls_openpgp_privkey_sec_param} (gnutls_openpgp_privkey_t @var{key})
1128 @var{key}: a key structure
1130 This function will return the security parameter appropriate with
1133 @strong{Returns:} On success, a valid security parameter is returned otherwise
1134 @code{GNUTLS_SEC_PARAM_UNKNOWN} is returned.
1137 @subheading gnutls_openpgp_privkey_set_preferred_key_id
1138 @anchor{gnutls_openpgp_privkey_set_preferred_key_id}
1139 @deftypefun {int} {gnutls_openpgp_privkey_set_preferred_key_id} (gnutls_openpgp_privkey_t @var{key}, const gnutls_openpgp_keyid_t @var{keyid})
1140 @var{key}: the structure that contains the OpenPGP public key.
1142 @var{keyid}: the selected keyid
1144 This allows setting a preferred key id for the given certificate.
1145 This key will be used by functions that involve key handling.
1147 @strong{Returns:} On success, 0 is returned, or an error code.
1150 @subheading gnutls_openpgp_privkey_sign_hash
1151 @anchor{gnutls_openpgp_privkey_sign_hash}
1152 @deftypefun {int} {gnutls_openpgp_privkey_sign_hash} (gnutls_openpgp_privkey_t @var{key}, const gnutls_datum_t * @var{hash}, gnutls_datum_t * @var{signature})
1153 @var{key}: Holds the key
1155 @var{hash}: holds the data to be signed
1157 @var{signature}: will contain newly allocated signature
1159 This function will sign the given hash using the private key. You
1160 should use @code{gnutls_openpgp_privkey_set_preferred_key_id()} before
1161 calling this function to set the subkey to use.
1163 @strong{Returns:} On success, @code{GNUTLS_E_SUCCESS} is returned, otherwise a
1164 negative error value.
1166 @strong{Deprecated:} Use @code{gnutls_privkey_sign_hash()} instead.
1169 @subheading gnutls_openpgp_set_recv_key_function
1170 @anchor{gnutls_openpgp_set_recv_key_function}
1171 @deftypefun {void} {gnutls_openpgp_set_recv_key_function} (gnutls_session_t @var{session}, gnutls_openpgp_recv_key_func @var{func})
1172 @var{session}: a TLS session
1174 @var{func}: the callback
1176 This funtion will set a key retrieval function for OpenPGP keys. This
1177 callback is only useful in server side, and will be used if the peer
1178 sent a key fingerprint instead of a full key.