Next: Abstract private keys, Up: Abstract key types [Contents][Index]
An abstract gnutls_pubkey_t can be initialized
using the functions below. It can be imported through
an existing structure like gnutls_x509_crt_t,
or through an ASN.1 encoding of the X.509 SubjectPublicKeyInfo
sequence.
key: The public key
crt: The certificate to be imported
flags: should be zero
This function will import the given public key to the abstract
gnutls_pubkey_t structure.
Returns: On success, GNUTLS_E_SUCCESS (0) is returned, otherwise a
negative error value.
Since: 2.12.0
gnutls_pubkey_import_openpgpgnutls_pubkey_import_pkcs11gnutls_pubkey_import_pkcs11_urlgnutls_pubkey_import_privkeygnutls_pubkey_importkey: Holds the certificate
format: the format of output params. One of PEM or DER.
output_data: will contain a certificate PEM or DER encoded
output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters)
This function will export the public key to DER or PEM format. The contents of the exported data is the SubjectPublicKeyInfo X.509 structure.
If the buffer provided is not long enough to hold the output, then
*output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will
be returned.
If the structure is PEM encoded, it will have a header of "BEGIN CERTIFICATE".
Returns: In case of failure a negative error code will be returned, and 0 on success.
Since: 2.12.0
Additional functions are available that will return information over a public key.
gnutls_pubkey_get_pk_algorithmgnutls_pubkey_get_preferred_hash_algorithmgnutls_pubkey_get_key_idNext: Abstract private keys, Up: Abstract key types [Contents][Index]