Blame doc/pkcs11-api.texi

Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_add_provider
Packit 549fdc
@anchor{gnutls_pkcs11_add_provider}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_add_provider} (const char * @var{name}, const char * @var{params})
Packit 549fdc
@var{name}: The filename of the module
Packit 549fdc
Packit 549fdc
@var{params}: should be NULL or a known string (see description)
Packit 549fdc
Packit 549fdc
This function will load and add a PKCS 11 module to the module
Packit 549fdc
list used in gnutls. After this function is called the module will
Packit 549fdc
be used for PKCS 11 operations.
Packit 549fdc
Packit 549fdc
When loading a module to be used for certificate verification,
Packit 549fdc
use the string 'trusted' as  @code{params} .
Packit 549fdc
Packit 549fdc
Note that this function is not thread safe.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_copy_attached_extension
Packit 549fdc
@anchor{gnutls_pkcs11_copy_attached_extension}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_copy_attached_extension} (const char * @var{token_url}, gnutls_x509_crt_t @var{crt}, gnutls_datum_t * @var{data}, const char * @var{label}, unsigned int @var{flags})
Packit 549fdc
@var{token_url}: A PKCS @code{11}  URL specifying a token
Packit 549fdc
Packit 549fdc
@var{crt}: An X.509 certificate object
Packit 549fdc
Packit 549fdc
@var{data}: the attached extension
Packit 549fdc
Packit 549fdc
@var{label}: A name to be used for the attached extension (may be @code{NULL} )
Packit 549fdc
Packit 549fdc
@var{flags}: One of GNUTLS_PKCS11_OBJ_FLAG_*
Packit 549fdc
Packit 549fdc
This function will copy an the attached extension in  @code{data} for
Packit 549fdc
the certificate provided in  @code{crt} in the PKCS @code{11}  token specified
Packit 549fdc
by the URL (typically a trust module). The extension must be in
Packit 549fdc
RFC5280 Extension format.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.3.8
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_copy_pubkey
Packit 549fdc
@anchor{gnutls_pkcs11_copy_pubkey}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_copy_pubkey} (const char * @var{token_url}, gnutls_pubkey_t @var{pubkey}, const char * @var{label}, const gnutls_datum_t * @var{cid}, unsigned int @var{key_usage}, unsigned int @var{flags})
Packit 549fdc
@var{token_url}: A PKCS @code{11}  URL specifying a token
Packit 549fdc
Packit 549fdc
@var{pubkey}: The public key to copy
Packit 549fdc
Packit 549fdc
@var{label}: The name to be used for the stored data
Packit 549fdc
Packit 549fdc
@var{cid}: The CKA_ID to set for the object -if NULL, the ID will be derived from the public key
Packit 549fdc
Packit 549fdc
@var{key_usage}: One of GNUTLS_KEY_*
Packit 549fdc
Packit 549fdc
@var{flags}: One of GNUTLS_PKCS11_OBJ_FLAG_*
Packit 549fdc
Packit 549fdc
This function will copy a public key object into a PKCS @code{11}  token specified by
Packit 549fdc
a URL. Valid flags to mark the key: @code{GNUTLS_PKCS11_OBJ_FLAG_MARK_TRUSTED} ,
Packit 549fdc
@code{GNUTLS_PKCS11_OBJ_FLAG_MARK_SENSITIVE} , @code{GNUTLS_PKCS11_OBJ_FLAG_MARK_PRIVATE} ,
Packit 549fdc
@code{GNUTLS_PKCS11_OBJ_FLAG_MARK_CA} , @code{GNUTLS_PKCS11_OBJ_FLAG_MARK_ALWAYS_AUTH} .
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.4.6
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_copy_secret_key
Packit 549fdc
@anchor{gnutls_pkcs11_copy_secret_key}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_copy_secret_key} (const char * @var{token_url}, gnutls_datum_t * @var{key}, const char * @var{label}, unsigned int @var{key_usage}, unsigned int @var{flags})
Packit 549fdc
@var{token_url}: A PKCS @code{11}  URL specifying a token
Packit 549fdc
Packit 549fdc
@var{key}: The raw key
Packit 549fdc
Packit 549fdc
@var{label}: A name to be used for the stored data
Packit 549fdc
Packit 549fdc
@var{key_usage}: One of GNUTLS_KEY_*
Packit 549fdc
Packit 549fdc
@var{flags}: One of GNUTLS_PKCS11_OBJ_FLAG_*
Packit 549fdc
Packit 549fdc
This function will copy a raw secret (symmetric) key into a PKCS @code{11}  
Packit 549fdc
token specified by a URL. The key can be marked as sensitive or not.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_copy_x509_crt
Packit 549fdc
@anchor{gnutls_pkcs11_copy_x509_crt}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_copy_x509_crt} (const char * @var{token_url}, gnutls_x509_crt_t @var{crt}, const char * @var{label}, unsigned int @var{flags})
Packit 549fdc
@var{token_url}: A PKCS @code{11}  URL specifying a token
Packit 549fdc
Packit 549fdc
@var{crt}: A certificate
Packit 549fdc
Packit 549fdc
@var{label}: A name to be used for the stored data
Packit 549fdc
Packit 549fdc
@var{flags}: One of GNUTLS_PKCS11_OBJ_FLAG_*
Packit 549fdc
Packit 549fdc
This function will copy a certificate into a PKCS @code{11}  token specified by
Packit 549fdc
a URL. The certificate can be marked as trusted or not.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_copy_x509_crt2
Packit 549fdc
@anchor{gnutls_pkcs11_copy_x509_crt2}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_copy_x509_crt2} (const char * @var{token_url}, gnutls_x509_crt_t @var{crt}, const char * @var{label}, const gnutls_datum_t * @var{cid}, unsigned int @var{flags})
Packit 549fdc
@var{token_url}: A PKCS @code{11}  URL specifying a token
Packit 549fdc
Packit 549fdc
@var{crt}: The certificate to copy
Packit 549fdc
Packit 549fdc
@var{label}: The name to be used for the stored data
Packit 549fdc
Packit 549fdc
@var{cid}: The CKA_ID to set for the object -if NULL, the ID will be derived from the public key
Packit 549fdc
Packit 549fdc
@var{flags}: One of GNUTLS_PKCS11_OBJ_FLAG_*
Packit 549fdc
Packit 549fdc
This function will copy a certificate into a PKCS @code{11}  token specified by
Packit 549fdc
a URL. Valid flags to mark the certificate: @code{GNUTLS_PKCS11_OBJ_FLAG_MARK_TRUSTED} ,
Packit 549fdc
@code{GNUTLS_PKCS11_OBJ_FLAG_MARK_SENSITIVE} , @code{GNUTLS_PKCS11_OBJ_FLAG_MARK_PRIVATE} ,
Packit 549fdc
@code{GNUTLS_PKCS11_OBJ_FLAG_MARK_CA} , @code{GNUTLS_PKCS11_OBJ_FLAG_MARK_ALWAYS_AUTH} .
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.4.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_copy_x509_privkey
Packit 549fdc
@anchor{gnutls_pkcs11_copy_x509_privkey}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_copy_x509_privkey} (const char * @var{token_url}, gnutls_x509_privkey_t @var{key}, const char * @var{label}, unsigned int @var{key_usage}, unsigned int @var{flags})
Packit 549fdc
@var{token_url}: A PKCS @code{11}  URL specifying a token
Packit 549fdc
Packit 549fdc
@var{key}: A private key
Packit 549fdc
Packit 549fdc
@var{label}: A name to be used for the stored data
Packit 549fdc
Packit 549fdc
@var{key_usage}: One of GNUTLS_KEY_*
Packit 549fdc
Packit 549fdc
@var{flags}: One of GNUTLS_PKCS11_OBJ_* flags
Packit 549fdc
Packit 549fdc
This function will copy a private key into a PKCS @code{11}  token specified by
Packit 549fdc
a URL. It is highly recommended flags to contain @code{GNUTLS_PKCS11_OBJ_FLAG_MARK_SENSITIVE} 
Packit 549fdc
unless there is a strong reason not to.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_copy_x509_privkey2
Packit 549fdc
@anchor{gnutls_pkcs11_copy_x509_privkey2}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_copy_x509_privkey2} (const char * @var{token_url}, gnutls_x509_privkey_t @var{key}, const char * @var{label}, const gnutls_datum_t * @var{cid}, unsigned int @var{key_usage}, unsigned int @var{flags})
Packit 549fdc
@var{token_url}: A PKCS @code{11}  URL specifying a token
Packit 549fdc
Packit 549fdc
@var{key}: A private key
Packit 549fdc
Packit 549fdc
@var{label}: A name to be used for the stored data
Packit 549fdc
Packit 549fdc
@var{cid}: The CKA_ID to set for the object -if NULL, the ID will be derived from the public key
Packit 549fdc
Packit 549fdc
@var{key_usage}: One of GNUTLS_KEY_*
Packit 549fdc
Packit 549fdc
@var{flags}: One of GNUTLS_PKCS11_OBJ_* flags
Packit 549fdc
Packit 549fdc
This function will copy a private key into a PKCS @code{11}  token specified by
Packit 549fdc
a URL. It is highly recommended flags to contain @code{GNUTLS_PKCS11_OBJ_FLAG_MARK_SENSITIVE} 
Packit 549fdc
unless there is a strong reason not to.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.4.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_crt_is_known
Packit 549fdc
@anchor{gnutls_pkcs11_crt_is_known}
Packit 549fdc
@deftypefun {unsigned} {gnutls_pkcs11_crt_is_known} (const char * @var{url}, gnutls_x509_crt_t @var{cert}, unsigned int @var{flags})
Packit 549fdc
@var{url}: A PKCS 11 url identifying a token
Packit 549fdc
Packit 549fdc
@var{cert}: is the certificate to find issuer for
Packit 549fdc
Packit 549fdc
@var{flags}: Use zero or flags from @code{GNUTLS_PKCS11_OBJ_FLAG} .
Packit 549fdc
Packit 549fdc
This function will check whether the provided certificate is stored
Packit 549fdc
in the specified token. This is useful in combination with 
Packit 549fdc
@code{GNUTLS_PKCS11_OBJ_FLAG_RETRIEVE_TRUSTED}  or
Packit 549fdc
@code{GNUTLS_PKCS11_OBJ_FLAG_RETRIEVE_DISTRUSTED} ,
Packit 549fdc
to check whether a CA is present or a certificate is blacklisted in
Packit 549fdc
a trust PKCS @code{11}  module.
Packit 549fdc
Packit 549fdc
This function can be used with a  @code{url} of "pkcs11:", and in that case all modules
Packit 549fdc
will be searched. To restrict the modules to the marked as trusted in p11-kit
Packit 549fdc
use the @code{GNUTLS_PKCS11_OBJ_FLAG_PRESENT_IN_TRUSTED_MODULE}  flag.
Packit 549fdc
Packit 549fdc
Note that the flag @code{GNUTLS_PKCS11_OBJ_FLAG_RETRIEVE_DISTRUSTED}  is
Packit 549fdc
specific to p11-kit trust modules.
Packit 549fdc
Packit 549fdc
@strong{Returns:} If the certificate exists non-zero is returned, otherwise zero.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.3.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_deinit
Packit 549fdc
@anchor{gnutls_pkcs11_deinit}
Packit 549fdc
@deftypefun {void} {gnutls_pkcs11_deinit} ( @var{void})
Packit 549fdc
Packit 549fdc
This function will deinitialize the PKCS 11 subsystem in gnutls.
Packit 549fdc
This function is only needed if you need to deinitialize the
Packit 549fdc
subsystem without calling @code{gnutls_global_deinit()} .
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_delete_url
Packit 549fdc
@anchor{gnutls_pkcs11_delete_url}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_delete_url} (const char * @var{object_url}, unsigned int @var{flags})
Packit 549fdc
@var{object_url}: The URL of the object to delete.
Packit 549fdc
Packit 549fdc
@var{flags}: One of GNUTLS_PKCS11_OBJ_* flags
Packit 549fdc
Packit 549fdc
This function will delete objects matching the given URL.
Packit 549fdc
Note that not all tokens support the delete operation.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, the number of objects deleted is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_get_pin_function
Packit 549fdc
@anchor{gnutls_pkcs11_get_pin_function}
Packit 549fdc
@deftypefun {gnutls_pin_callback_t} {gnutls_pkcs11_get_pin_function} (void ** @var{userdata})
Packit 549fdc
@var{userdata}: data to be supplied to callback
Packit 549fdc
Packit 549fdc
This function will return the callback function set using
Packit 549fdc
@code{gnutls_pkcs11_set_pin_function()} .
Packit 549fdc
Packit 549fdc
@strong{Returns:} The function set or NULL otherwise.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.1.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_get_raw_issuer
Packit 549fdc
@anchor{gnutls_pkcs11_get_raw_issuer}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_get_raw_issuer} (const char * @var{url}, gnutls_x509_crt_t @var{cert}, gnutls_datum_t * @var{issuer}, gnutls_x509_crt_fmt_t @var{fmt}, unsigned int @var{flags})
Packit 549fdc
@var{url}: A PKCS 11 url identifying a token
Packit 549fdc
Packit 549fdc
@var{cert}: is the certificate to find issuer for
Packit 549fdc
Packit 549fdc
@var{issuer}: Will hold the issuer if any in an allocated buffer.
Packit 549fdc
Packit 549fdc
@var{fmt}: The format of the exported issuer.
Packit 549fdc
Packit 549fdc
@var{flags}: Use zero or flags from @code{GNUTLS_PKCS11_OBJ_FLAG} .
Packit 549fdc
Packit 549fdc
This function will return the issuer of a given certificate, if it
Packit 549fdc
is stored in the token. By default only marked as trusted issuers
Packit 549fdc
are retuned. If any issuer should be returned specify
Packit 549fdc
@code{GNUTLS_PKCS11_OBJ_FLAG_RETRIEVE_ANY}  in  @code{flags} .
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.2.7
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_get_raw_issuer_by_dn
Packit 549fdc
@anchor{gnutls_pkcs11_get_raw_issuer_by_dn}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_get_raw_issuer_by_dn} (const char * @var{url}, const gnutls_datum_t * @var{dn}, gnutls_datum_t * @var{issuer}, gnutls_x509_crt_fmt_t @var{fmt}, unsigned int @var{flags})
Packit 549fdc
@var{url}: A PKCS 11 url identifying a token
Packit 549fdc
Packit 549fdc
@var{dn}: is the DN to search for
Packit 549fdc
Packit 549fdc
@var{issuer}: Will hold the issuer if any in an allocated buffer.
Packit 549fdc
Packit 549fdc
@var{fmt}: The format of the exported issuer.
Packit 549fdc
Packit 549fdc
@var{flags}: Use zero or flags from @code{GNUTLS_PKCS11_OBJ_FLAG} .
Packit 549fdc
Packit 549fdc
This function will return the certificate with the given DN, if it
Packit 549fdc
is stored in the token. By default only marked as trusted issuers
Packit 549fdc
are retuned. If any issuer should be returned specify
Packit 549fdc
@code{GNUTLS_PKCS11_OBJ_FLAG_RETRIEVE_ANY}  in  @code{flags} .
Packit 549fdc
Packit 549fdc
The name of the function includes issuer because it can
Packit 549fdc
be used to discover issuers of certificates.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.4.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_get_raw_issuer_by_subject_key_id
Packit 549fdc
@anchor{gnutls_pkcs11_get_raw_issuer_by_subject_key_id}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_get_raw_issuer_by_subject_key_id} (const char * @var{url}, const gnutls_datum_t * @var{dn}, const gnutls_datum_t * @var{spki}, gnutls_datum_t * @var{issuer}, gnutls_x509_crt_fmt_t @var{fmt}, unsigned int @var{flags})
Packit 549fdc
@var{url}: A PKCS 11 url identifying a token
Packit 549fdc
Packit 549fdc
@var{dn}: is the DN to search for (may be @code{NULL} )
Packit 549fdc
Packit 549fdc
@var{spki}: is the subject key ID to search for
Packit 549fdc
Packit 549fdc
@var{issuer}: Will hold the issuer if any in an allocated buffer.
Packit 549fdc
Packit 549fdc
@var{fmt}: The format of the exported issuer.
Packit 549fdc
Packit 549fdc
@var{flags}: Use zero or flags from @code{GNUTLS_PKCS11_OBJ_FLAG} .
Packit 549fdc
Packit 549fdc
This function will return the certificate with the given DN and  @code{spki} , if it
Packit 549fdc
is stored in the token. By default only marked as trusted issuers
Packit 549fdc
are retuned. If any issuer should be returned specify
Packit 549fdc
@code{GNUTLS_PKCS11_OBJ_FLAG_RETRIEVE_ANY}  in  @code{flags} .
Packit 549fdc
Packit 549fdc
The name of the function includes issuer because it can
Packit 549fdc
be used to discover issuers of certificates.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.4.2
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_init
Packit 549fdc
@anchor{gnutls_pkcs11_init}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_init} (unsigned int @var{flags}, const char * @var{deprecated_config_file})
Packit 549fdc
@var{flags}: An ORed sequence of @code{GNUTLS_PKCS11_FLAG_} *
Packit 549fdc
Packit 549fdc
@var{deprecated_config_file}: either NULL or the location of a deprecated
Packit 549fdc
configuration file
Packit 549fdc
Packit 549fdc
This function will initialize the PKCS 11 subsystem in gnutls. It will
Packit 549fdc
read configuration files if @code{GNUTLS_PKCS11_FLAG_AUTO}  is used or allow
Packit 549fdc
you to independently load PKCS 11 modules using @code{gnutls_pkcs11_add_provider()} 
Packit 549fdc
if @code{GNUTLS_PKCS11_FLAG_MANUAL}  is specified.
Packit 549fdc
Packit 549fdc
You don't need to call this function since GnuTLS 3.3.0 because it is being called
Packit 549fdc
during the first request PKCS 11 operation. That call will assume the @code{GNUTLS_PKCS11_FLAG_AUTO} 
Packit 549fdc
flag. If another flags are required then it must be called independently
Packit 549fdc
prior to any PKCS 11 operation.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_obj_deinit
Packit 549fdc
@anchor{gnutls_pkcs11_obj_deinit}
Packit 549fdc
@deftypefun {void} {gnutls_pkcs11_obj_deinit} (gnutls_pkcs11_obj_t @var{obj})
Packit 549fdc
@var{obj}: The type to be deinitialized
Packit 549fdc
Packit 549fdc
This function will deinitialize a certificate structure.
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_obj_export
Packit 549fdc
@anchor{gnutls_pkcs11_obj_export}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_obj_export} (gnutls_pkcs11_obj_t @var{obj}, void * @var{output_data}, size_t * @var{output_data_size})
Packit 549fdc
@var{obj}: Holds the object
Packit 549fdc
Packit 549fdc
@var{output_data}: will contain the object data
Packit 549fdc
Packit 549fdc
@var{output_data_size}: holds the size of output_data (and will be
Packit 549fdc
replaced by the actual size of parameters)
Packit 549fdc
Packit 549fdc
This function will export the PKCS11 object data.  It is normal for
Packit 549fdc
data to be inaccesible and in that case @code{GNUTLS_E_INVALID_REQUEST} 
Packit 549fdc
will be returned.
Packit 549fdc
Packit 549fdc
If the buffer provided is not long enough to hold the output, then
Packit 549fdc
*output_data_size is updated and GNUTLS_E_SHORT_MEMORY_BUFFER will
Packit 549fdc
be returned.
Packit 549fdc
Packit 549fdc
@strong{Returns:} In case of failure a negative error code will be
Packit 549fdc
returned, and @code{GNUTLS_E_SUCCESS}  (0) on success.
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_obj_export2
Packit 549fdc
@anchor{gnutls_pkcs11_obj_export2}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_obj_export2} (gnutls_pkcs11_obj_t @var{obj}, gnutls_datum_t * @var{out})
Packit 549fdc
@var{obj}: Holds the object
Packit 549fdc
Packit 549fdc
@var{out}: will contain the object data
Packit 549fdc
Packit 549fdc
This function will export the PKCS11 object data.  It is normal for
Packit 549fdc
data to be inaccesible and in that case @code{GNUTLS_E_INVALID_REQUEST} 
Packit 549fdc
will be returned.
Packit 549fdc
Packit 549fdc
The output buffer is allocated using @code{gnutls_malloc()} .
Packit 549fdc
Packit 549fdc
@strong{Returns:} In case of failure a negative error code will be
Packit 549fdc
returned, and @code{GNUTLS_E_SUCCESS}  (0) on success.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.1.3
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_obj_export3
Packit 549fdc
@anchor{gnutls_pkcs11_obj_export3}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_obj_export3} (gnutls_pkcs11_obj_t @var{obj}, gnutls_x509_crt_fmt_t @var{fmt}, gnutls_datum_t * @var{out})
Packit 549fdc
@var{obj}: Holds the object
Packit 549fdc
Packit 549fdc
@var{fmt}: The format of the exported data
Packit 549fdc
Packit 549fdc
@var{out}: will contain the object data
Packit 549fdc
Packit 549fdc
This function will export the PKCS11 object data.  It is normal for
Packit 549fdc
data to be inaccesible and in that case @code{GNUTLS_E_INVALID_REQUEST} 
Packit 549fdc
will be returned.
Packit 549fdc
Packit 549fdc
The output buffer is allocated using @code{gnutls_malloc()} .
Packit 549fdc
Packit 549fdc
@strong{Returns:} In case of failure a negative error code will be
Packit 549fdc
returned, and @code{GNUTLS_E_SUCCESS}  (0) on success.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.2.7
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_obj_export_url
Packit 549fdc
@anchor{gnutls_pkcs11_obj_export_url}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_obj_export_url} (gnutls_pkcs11_obj_t @var{obj}, gnutls_pkcs11_url_type_t @var{detailed}, char ** @var{url})
Packit 549fdc
@var{obj}: Holds the PKCS 11 certificate
Packit 549fdc
Packit 549fdc
@var{detailed}: non zero if a detailed URL is required
Packit 549fdc
Packit 549fdc
@var{url}: will contain an allocated url
Packit 549fdc
Packit 549fdc
This function will export a URL identifying the given object.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_obj_flags_get_str
Packit 549fdc
@anchor{gnutls_pkcs11_obj_flags_get_str}
Packit 549fdc
@deftypefun {char *} {gnutls_pkcs11_obj_flags_get_str} (unsigned int @var{flags})
Packit 549fdc
@var{flags}: holds the flags
Packit 549fdc
Packit 549fdc
This function given an or-sequence of @code{GNUTLS_PKCS11_OBJ_FLAG_MARK} ,
Packit 549fdc
will return an allocated string with its description. The string
Packit 549fdc
needs to be deallocated using @code{gnutls_free()} .
Packit 549fdc
Packit 549fdc
@strong{Returns:} If flags is zero @code{NULL}  is returned, otherwise an allocated string.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.3.7
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_obj_get_exts
Packit 549fdc
@anchor{gnutls_pkcs11_obj_get_exts}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_obj_get_exts} (gnutls_pkcs11_obj_t @var{obj}, gnutls_x509_ext_st ** @var{exts}, unsigned int * @var{exts_size}, unsigned int @var{flags})
Packit 549fdc
@var{obj}: should contain a @code{gnutls_pkcs11_obj_t}  type
Packit 549fdc
Packit 549fdc
@var{exts}: a pointer to a @code{gnutls_x509_ext_st}  pointer
Packit 549fdc
Packit 549fdc
@var{exts_size}: will be updated with the number of  @code{exts} 
Packit 549fdc
Packit 549fdc
@var{flags}: Or sequence of @code{GNUTLS_PKCS11_OBJ_} * flags 
Packit 549fdc
Packit 549fdc
This function will return information about attached extensions
Packit 549fdc
that associate to the provided object (which should be a certificate).
Packit 549fdc
The extensions are the attached p11-kit trust module extensions.
Packit 549fdc
Packit 549fdc
Each element of  @code{exts} must be deinitialized using @code{gnutls_x509_ext_deinit()} 
Packit 549fdc
while  @code{exts} should be deallocated using @code{gnutls_free()} .
Packit 549fdc
Packit 549fdc
@strong{Returns:} @code{GNUTLS_E_SUCCESS}  (0) on success or a negative error code on error.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.3.8
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_obj_get_flags
Packit 549fdc
@anchor{gnutls_pkcs11_obj_get_flags}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_obj_get_flags} (gnutls_pkcs11_obj_t @var{obj}, unsigned int * @var{oflags})
Packit 549fdc
@var{obj}: The pkcs11 object
Packit 549fdc
Packit 549fdc
@var{oflags}: Will hold the output flags
Packit 549fdc
Packit 549fdc
This function will return the flags of the object.
Packit 549fdc
The  @code{oflags} will be flags from @code{gnutls_pkcs11_obj_flags} . That is,
Packit 549fdc
the @code{GNUTLS_PKCS11_OBJ_FLAG_MARK_} * flags.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.3.7
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_obj_get_info
Packit 549fdc
@anchor{gnutls_pkcs11_obj_get_info}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_obj_get_info} (gnutls_pkcs11_obj_t @var{obj}, gnutls_pkcs11_obj_info_t @var{itype}, void * @var{output}, size_t * @var{output_size})
Packit 549fdc
@var{obj}: should contain a @code{gnutls_pkcs11_obj_t}  type
Packit 549fdc
Packit 549fdc
@var{itype}: Denotes the type of information requested
Packit 549fdc
Packit 549fdc
@var{output}: where output will be stored
Packit 549fdc
Packit 549fdc
@var{output_size}: contains the maximum size of the output and will be overwritten with actual
Packit 549fdc
Packit 549fdc
This function will return information about the PKCS11 certificate
Packit 549fdc
such as the label, id as well as token information where the key is
Packit 549fdc
stored. When output is text it returns null terminated string
Packit 549fdc
although  @code{output_size} contains the size of the actual data only.
Packit 549fdc
Packit 549fdc
In versions previously to 3.6.0 this function included the null terminator
Packit 549fdc
to  @code{output_size} . After 3.6.0 the output size doesn't include the terminator character.
Packit 549fdc
Packit 549fdc
@strong{Returns:} @code{GNUTLS_E_SUCCESS}  (0) on success or a negative error code on error.
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_obj_get_type
Packit 549fdc
@anchor{gnutls_pkcs11_obj_get_type}
Packit 549fdc
@deftypefun {gnutls_pkcs11_obj_type_t} {gnutls_pkcs11_obj_get_type} (gnutls_pkcs11_obj_t @var{obj})
Packit 549fdc
@var{obj}: Holds the PKCS 11 object
Packit 549fdc
Packit 549fdc
This function will return the type of the object being
Packit 549fdc
stored in the structure.
Packit 549fdc
Packit 549fdc
@strong{Returns:} The type of the object
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_obj_import_url
Packit 549fdc
@anchor{gnutls_pkcs11_obj_import_url}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_obj_import_url} (gnutls_pkcs11_obj_t @var{obj}, const char * @var{url}, unsigned int @var{flags})
Packit 549fdc
@var{obj}: The structure to store the object
Packit 549fdc
Packit 549fdc
@var{url}: a PKCS 11 url identifying the key
Packit 549fdc
Packit 549fdc
@var{flags}: Or sequence of GNUTLS_PKCS11_OBJ_* flags
Packit 549fdc
Packit 549fdc
This function will "import" a PKCS 11 URL identifying an object (e.g. certificate)
Packit 549fdc
to the @code{gnutls_pkcs11_obj_t}  type. This does not involve any
Packit 549fdc
parsing (such as X.509 or OpenPGP) since the @code{gnutls_pkcs11_obj_t}  is
Packit 549fdc
format agnostic. Only data are transferred.
Packit 549fdc
Packit 549fdc
If the flag @code{GNUTLS_PKCS11_OBJ_FLAG_OVERWRITE_TRUSTMOD_EXT}  is specified
Packit 549fdc
any certificate read, will have its extensions overwritten by any
Packit 549fdc
stapled extensions in the trust module.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_obj_init
Packit 549fdc
@anchor{gnutls_pkcs11_obj_init}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_obj_init} (gnutls_pkcs11_obj_t * @var{obj})
Packit 549fdc
@var{obj}: A pointer to the type to be initialized
Packit 549fdc
Packit 549fdc
This function will initialize a pkcs11 certificate structure.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_obj_list_import_url3
Packit 549fdc
@anchor{gnutls_pkcs11_obj_list_import_url3}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_obj_list_import_url3} (gnutls_pkcs11_obj_t * @var{p_list}, unsigned int * @var{n_list}, const char * @var{url}, unsigned int @var{flags})
Packit 549fdc
@var{p_list}: An uninitialized object list (may be @code{NULL} )
Packit 549fdc
Packit 549fdc
@var{n_list}: Initially should hold the maximum size of the list. Will contain the actual size.
Packit 549fdc
Packit 549fdc
@var{url}: A PKCS 11 url identifying a set of objects
Packit 549fdc
Packit 549fdc
@var{flags}: Or sequence of GNUTLS_PKCS11_OBJ_* flags
Packit 549fdc
Packit 549fdc
This function will initialize and set values to an object list
Packit 549fdc
by using all objects identified by a PKCS 11 URL.
Packit 549fdc
Packit 549fdc
This function will enumerate all the objects specified by the PKCS@code{11}  URL
Packit 549fdc
provided. It expects an already allocated  @code{p_list} which has * @code{n_list} elements,
Packit 549fdc
and that value will be updated to the actual number of present objects. The
Packit 549fdc
 @code{p_list} objects will be initialized and set by this function.
Packit 549fdc
To obtain a list of all available objects use a  @code{url} of 'pkcs11:'.
Packit 549fdc
Packit 549fdc
All returned objects must be deinitialized using @code{gnutls_pkcs11_obj_deinit()} .
Packit 549fdc
Packit 549fdc
The supported in this function  @code{flags} are @code{GNUTLS_PKCS11_OBJ_FLAG_LOGIN} ,
Packit 549fdc
@code{GNUTLS_PKCS11_OBJ_FLAG_LOGIN_SO} , @code{GNUTLS_PKCS11_OBJ_FLAG_PRESENT_IN_TRUSTED_MODULE} ,
Packit 549fdc
@code{GNUTLS_PKCS11_OBJ_FLAG_CRT} , @code{GNUTLS_PKCS11_OBJ_FLAG_PUBKEY} , @code{GNUTLS_PKCS11_OBJ_FLAG_PRIVKEY} ,
Packit 549fdc
@code{GNUTLS_PKCS11_OBJ_FLAG_WITH_PRIVKEY} , @code{GNUTLS_PKCS11_OBJ_FLAG_MARK_CA} ,
Packit 549fdc
@code{GNUTLS_PKCS11_OBJ_FLAG_MARK_TRUSTED} , and since 3.5.1 the @code{GNUTLS_PKCS11_OBJ_FLAG_OVERWRITE_TRUSTMOD_EXT} .
Packit 549fdc
Packit 549fdc
On versions of GnuTLS prior to 3.4.0 the equivalent function was
Packit 549fdc
@code{gnutls_pkcs11_obj_list_import_url()} . That is also available on this version
Packit 549fdc
as a macro which maps to this function.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.4.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_obj_list_import_url4
Packit 549fdc
@anchor{gnutls_pkcs11_obj_list_import_url4}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_obj_list_import_url4} (gnutls_pkcs11_obj_t ** @var{p_list}, unsigned int * @var{n_list}, const char * @var{url}, unsigned int @var{flags})
Packit 549fdc
@var{p_list}: An uninitialized object list (may be NULL)
Packit 549fdc
Packit 549fdc
@var{n_list}: It will contain the size of the list.
Packit 549fdc
Packit 549fdc
@var{url}: A PKCS 11 url identifying a set of objects
Packit 549fdc
Packit 549fdc
@var{flags}: Or sequence of GNUTLS_PKCS11_OBJ_* flags
Packit 549fdc
Packit 549fdc
This function will enumerate all the objects specified by the PKCS@code{11}  URL
Packit 549fdc
provided. It will initialize and set values to the object pointer list ( @code{p_list} )
Packit 549fdc
provided. To obtain a list of all available objects use a  @code{url} of 'pkcs11:'.
Packit 549fdc
Packit 549fdc
All returned objects must be deinitialized using @code{gnutls_pkcs11_obj_deinit()} ,
Packit 549fdc
and  @code{p_list} must be deinitialized using @code{gnutls_free()} .
Packit 549fdc
Packit 549fdc
The supported in this function  @code{flags} are @code{GNUTLS_PKCS11_OBJ_FLAG_LOGIN} ,
Packit 549fdc
@code{GNUTLS_PKCS11_OBJ_FLAG_LOGIN_SO} , @code{GNUTLS_PKCS11_OBJ_FLAG_PRESENT_IN_TRUSTED_MODULE} ,
Packit 549fdc
@code{GNUTLS_PKCS11_OBJ_FLAG_CRT} , @code{GNUTLS_PKCS11_OBJ_FLAG_PUBKEY} , @code{GNUTLS_PKCS11_OBJ_FLAG_PRIVKEY} ,
Packit 549fdc
@code{GNUTLS_PKCS11_OBJ_FLAG_WITH_PRIVKEY} , @code{GNUTLS_PKCS11_OBJ_FLAG_MARK_CA} ,
Packit 549fdc
@code{GNUTLS_PKCS11_OBJ_FLAG_MARK_TRUSTED} , and since 3.5.1 the @code{GNUTLS_PKCS11_OBJ_FLAG_OVERWRITE_TRUSTMOD_EXT} .
Packit 549fdc
Packit 549fdc
On versions of GnuTLS prior to 3.4.0 the equivalent function was
Packit 549fdc
@code{gnutls_pkcs11_obj_list_import_url2()} . That is also available on this version
Packit 549fdc
as a macro which maps to this function.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.4.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_obj_set_info
Packit 549fdc
@anchor{gnutls_pkcs11_obj_set_info}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_obj_set_info} (gnutls_pkcs11_obj_t @var{obj}, gnutls_pkcs11_obj_info_t @var{itype}, const void * @var{data}, size_t @var{data_size}, unsigned @var{flags})
Packit 549fdc
@var{obj}: should contain a @code{gnutls_pkcs11_obj_t}  type
Packit 549fdc
Packit 549fdc
@var{itype}: Denotes the type of information to be set
Packit 549fdc
Packit 549fdc
@var{data}: the data to set
Packit 549fdc
Packit 549fdc
@var{data_size}: the size of data
Packit 549fdc
Packit 549fdc
@var{flags}: Or sequence of GNUTLS_PKCS11_OBJ_* flags
Packit 549fdc
Packit 549fdc
This function will set attributes on the provided object.
Packit 549fdc
Available options for  @code{itype} are @code{GNUTLS_PKCS11_OBJ_LABEL} ,
Packit 549fdc
@code{GNUTLS_PKCS11_OBJ_ID_HEX} , and @code{GNUTLS_PKCS11_OBJ_ID} .
Packit 549fdc
Packit 549fdc
@strong{Returns:} @code{GNUTLS_E_SUCCESS}  (0) on success or a negative error code on error.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.4.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_obj_set_pin_function
Packit 549fdc
@anchor{gnutls_pkcs11_obj_set_pin_function}
Packit 549fdc
@deftypefun {void} {gnutls_pkcs11_obj_set_pin_function} (gnutls_pkcs11_obj_t @var{obj}, gnutls_pin_callback_t @var{fn}, void * @var{userdata})
Packit 549fdc
@var{obj}: The object structure
Packit 549fdc
Packit 549fdc
@var{fn}: the callback
Packit 549fdc
Packit 549fdc
@var{userdata}: data associated with the callback
Packit 549fdc
Packit 549fdc
This function will set a callback function to be used when
Packit 549fdc
required to access the object. This function overrides the global
Packit 549fdc
set using @code{gnutls_pkcs11_set_pin_function()} .
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.1.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_privkey_cpy
Packit 549fdc
@anchor{gnutls_pkcs11_privkey_cpy}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_privkey_cpy} (gnutls_pkcs11_privkey_t @var{dst}, gnutls_pkcs11_privkey_t @var{src})
Packit 549fdc
@var{dst}: The destination key, which should be initialized.
Packit 549fdc
Packit 549fdc
@var{src}: The source key
Packit 549fdc
Packit 549fdc
This function will copy a private key from source to destination
Packit 549fdc
key. Destination has to be initialized.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.4.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_privkey_deinit
Packit 549fdc
@anchor{gnutls_pkcs11_privkey_deinit}
Packit 549fdc
@deftypefun {void} {gnutls_pkcs11_privkey_deinit} (gnutls_pkcs11_privkey_t @var{key})
Packit 549fdc
@var{key}: the key to be deinitialized
Packit 549fdc
Packit 549fdc
This function will deinitialize a private key structure.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_privkey_export_pubkey
Packit 549fdc
@anchor{gnutls_pkcs11_privkey_export_pubkey}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_privkey_export_pubkey} (gnutls_pkcs11_privkey_t @var{pkey}, gnutls_x509_crt_fmt_t @var{fmt}, gnutls_datum_t * @var{data}, unsigned int @var{flags})
Packit 549fdc
@var{pkey}: The private key
Packit 549fdc
Packit 549fdc
@var{fmt}: the format of output params. PEM or DER.
Packit 549fdc
Packit 549fdc
@var{data}: will hold the public key
Packit 549fdc
Packit 549fdc
@var{flags}: should be zero
Packit 549fdc
Packit 549fdc
This function will extract the public key (modulus and public
Packit 549fdc
exponent) from the private key specified by the  @code{url} private key.
Packit 549fdc
This public key will be stored in  @code{pubkey} in the format specified
Packit 549fdc
by  @code{fmt} .  @code{pubkey} should be deinitialized using @code{gnutls_free()} .
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.3.7
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_privkey_export_url
Packit 549fdc
@anchor{gnutls_pkcs11_privkey_export_url}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_privkey_export_url} (gnutls_pkcs11_privkey_t @var{key}, gnutls_pkcs11_url_type_t @var{detailed}, char ** @var{url})
Packit 549fdc
@var{key}: Holds the PKCS 11 key
Packit 549fdc
Packit 549fdc
@var{detailed}: non zero if a detailed URL is required
Packit 549fdc
Packit 549fdc
@var{url}: will contain an allocated url
Packit 549fdc
Packit 549fdc
This function will export a URL identifying the given key.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_privkey_generate
Packit 549fdc
@anchor{gnutls_pkcs11_privkey_generate}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_privkey_generate} (const char * @var{url}, gnutls_pk_algorithm_t @var{pk}, unsigned int @var{bits}, const char * @var{label}, unsigned int @var{flags})
Packit 549fdc
@var{url}: a token URL
Packit 549fdc
Packit 549fdc
@var{pk}: the public key algorithm
Packit 549fdc
Packit 549fdc
@var{bits}: the security bits
Packit 549fdc
Packit 549fdc
@var{label}: a label
Packit 549fdc
Packit 549fdc
@var{flags}: should be zero
Packit 549fdc
Packit 549fdc
This function will generate a private key in the specified
Packit 549fdc
by the  @code{url} token. The private key will be generate within
Packit 549fdc
the token and will not be exportable.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_privkey_generate2
Packit 549fdc
@anchor{gnutls_pkcs11_privkey_generate2}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_privkey_generate2} (const char * @var{url}, gnutls_pk_algorithm_t @var{pk}, unsigned int @var{bits}, const char * @var{label}, gnutls_x509_crt_fmt_t @var{fmt}, gnutls_datum_t * @var{pubkey}, unsigned int @var{flags})
Packit 549fdc
@var{url}: a token URL
Packit 549fdc
Packit 549fdc
@var{pk}: the public key algorithm
Packit 549fdc
Packit 549fdc
@var{bits}: the security bits
Packit 549fdc
Packit 549fdc
@var{label}: a label
Packit 549fdc
Packit 549fdc
@var{fmt}: the format of output params. PEM or DER
Packit 549fdc
Packit 549fdc
@var{pubkey}: will hold the public key (may be @code{NULL} )
Packit 549fdc
Packit 549fdc
@var{flags}: zero or an OR'ed sequence of @code{GNUTLS_PKCS11_OBJ_FLAGs} 
Packit 549fdc
Packit 549fdc
This function will generate a private key in the specified
Packit 549fdc
by the  @code{url} token. The private key will be generate within
Packit 549fdc
the token and will not be exportable. This function will
Packit 549fdc
store the DER-encoded public key in the SubjectPublicKeyInfo format
Packit 549fdc
in  @code{pubkey} . The  @code{pubkey} should be deinitialized using @code{gnutls_free()} .
Packit 549fdc
Packit 549fdc
Note that when generating an elliptic curve key, the curve
Packit 549fdc
can be substituted in the place of the bits parameter using the
Packit 549fdc
@code{GNUTLS_CURVE_TO_BITS()}  macro.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.1.5
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_privkey_generate3
Packit 549fdc
@anchor{gnutls_pkcs11_privkey_generate3}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_privkey_generate3} (const char * @var{url}, gnutls_pk_algorithm_t @var{pk}, unsigned int @var{bits}, const char * @var{label}, const gnutls_datum_t * @var{cid}, gnutls_x509_crt_fmt_t @var{fmt}, gnutls_datum_t * @var{pubkey}, unsigned int @var{key_usage}, unsigned int @var{flags})
Packit 549fdc
@var{url}: a token URL
Packit 549fdc
Packit 549fdc
@var{pk}: the public key algorithm
Packit 549fdc
Packit 549fdc
@var{bits}: the security bits
Packit 549fdc
Packit 549fdc
@var{label}: a label
Packit 549fdc
Packit 549fdc
@var{cid}: The CKA_ID to use for the new object
Packit 549fdc
Packit 549fdc
@var{fmt}: the format of output params. PEM or DER
Packit 549fdc
Packit 549fdc
@var{pubkey}: will hold the public key (may be @code{NULL} )
Packit 549fdc
Packit 549fdc
@var{key_usage}: One of GNUTLS_KEY_*
Packit 549fdc
Packit 549fdc
@var{flags}: zero or an OR'ed sequence of @code{GNUTLS_PKCS11_OBJ_FLAGs} 
Packit 549fdc
Packit 549fdc
This function will generate a private key in the specified
Packit 549fdc
by the  @code{url} token. The private key will be generate within
Packit 549fdc
the token and will not be exportable. This function will
Packit 549fdc
store the DER-encoded public key in the SubjectPublicKeyInfo format 
Packit 549fdc
in  @code{pubkey} . The  @code{pubkey} should be deinitialized using @code{gnutls_free()} .
Packit 549fdc
Packit 549fdc
Note that when generating an elliptic curve key, the curve
Packit 549fdc
can be substituted in the place of the bits parameter using the
Packit 549fdc
@code{GNUTLS_CURVE_TO_BITS()}  macro.
Packit 549fdc
Packit 549fdc
It is highly recommended flags to contain @code{GNUTLS_PKCS11_OBJ_FLAG_MARK_SENSITIVE} 
Packit 549fdc
unless there is a strong reason not to.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.4.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_privkey_get_info
Packit 549fdc
@anchor{gnutls_pkcs11_privkey_get_info}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_privkey_get_info} (gnutls_pkcs11_privkey_t @var{pkey}, gnutls_pkcs11_obj_info_t @var{itype}, void * @var{output}, size_t * @var{output_size})
Packit 549fdc
@var{pkey}: should contain a @code{gnutls_pkcs11_privkey_t}  type
Packit 549fdc
Packit 549fdc
@var{itype}: Denotes the type of information requested
Packit 549fdc
Packit 549fdc
@var{output}: where output will be stored
Packit 549fdc
Packit 549fdc
@var{output_size}: contains the maximum size of the output and will be overwritten with actual
Packit 549fdc
Packit 549fdc
This function will return information about the PKCS 11 private key such
Packit 549fdc
as the label, id as well as token information where the key is stored. When
Packit 549fdc
output is text it returns null terminated string although @code{output_size}  contains
Packit 549fdc
the size of the actual data only.
Packit 549fdc
Packit 549fdc
@strong{Returns:} @code{GNUTLS_E_SUCCESS}  (0) on success or a negative error code on error.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_privkey_get_pk_algorithm
Packit 549fdc
@anchor{gnutls_pkcs11_privkey_get_pk_algorithm}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_privkey_get_pk_algorithm} (gnutls_pkcs11_privkey_t @var{key}, unsigned int * @var{bits})
Packit 549fdc
@var{key}: should contain a @code{gnutls_pkcs11_privkey_t}  type
Packit 549fdc
Packit 549fdc
@var{bits}: if bits is non null it will hold the size of the parameters' in bits
Packit 549fdc
Packit 549fdc
This function will return the public key algorithm of a private
Packit 549fdc
key.
Packit 549fdc
Packit 549fdc
@strong{Returns:} a member of the @code{gnutls_pk_algorithm_t}  enumeration on
Packit 549fdc
success, or a negative error code on error.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_privkey_import_url
Packit 549fdc
@anchor{gnutls_pkcs11_privkey_import_url}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_privkey_import_url} (gnutls_pkcs11_privkey_t @var{pkey}, const char * @var{url}, unsigned int @var{flags})
Packit 549fdc
@var{pkey}: The private key
Packit 549fdc
Packit 549fdc
@var{url}: a PKCS 11 url identifying the key
Packit 549fdc
Packit 549fdc
@var{flags}: Or sequence of GNUTLS_PKCS11_OBJ_* flags
Packit 549fdc
Packit 549fdc
This function will "import" a PKCS 11 URL identifying a private
Packit 549fdc
key to the @code{gnutls_pkcs11_privkey_t}  type. In reality since
Packit 549fdc
in most cases keys cannot be exported, the private key structure
Packit 549fdc
is being associated with the available operations on the token.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_privkey_init
Packit 549fdc
@anchor{gnutls_pkcs11_privkey_init}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_privkey_init} (gnutls_pkcs11_privkey_t * @var{key})
Packit 549fdc
@var{key}: A pointer to the type to be initialized
Packit 549fdc
Packit 549fdc
This function will initialize an private key structure. This
Packit 549fdc
structure can be used for accessing an underlying PKCS@code{11}  object.
Packit 549fdc
Packit 549fdc
In versions of GnuTLS later than 3.5.11 the object is protected
Packit 549fdc
using locks and a single @code{gnutls_pkcs11_privkey_t}  can be re-used
Packit 549fdc
by many threads. However, for performance it is recommended to utilize
Packit 549fdc
one object per key per thread.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_privkey_set_pin_function
Packit 549fdc
@anchor{gnutls_pkcs11_privkey_set_pin_function}
Packit 549fdc
@deftypefun {void} {gnutls_pkcs11_privkey_set_pin_function} (gnutls_pkcs11_privkey_t @var{key}, gnutls_pin_callback_t @var{fn}, void * @var{userdata})
Packit 549fdc
@var{key}: The private key
Packit 549fdc
Packit 549fdc
@var{fn}: the callback
Packit 549fdc
Packit 549fdc
@var{userdata}: data associated with the callback
Packit 549fdc
Packit 549fdc
This function will set a callback function to be used when
Packit 549fdc
required to access the object. This function overrides the global
Packit 549fdc
set using @code{gnutls_pkcs11_set_pin_function()} .
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.1.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_privkey_status
Packit 549fdc
@anchor{gnutls_pkcs11_privkey_status}
Packit 549fdc
@deftypefun {unsigned} {gnutls_pkcs11_privkey_status} (gnutls_pkcs11_privkey_t @var{key})
Packit 549fdc
@var{key}: Holds the key
Packit 549fdc
Packit 549fdc
Checks the status of the private key token.
Packit 549fdc
Packit 549fdc
@strong{Returns:} this function will return non-zero if the token
Packit 549fdc
holding the private key is still available (inserted), and zero otherwise.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.1.9
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_reinit
Packit 549fdc
@anchor{gnutls_pkcs11_reinit}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_reinit} ( @var{void})
Packit 549fdc
Packit 549fdc
This function will reinitialize the PKCS 11 subsystem in gnutls. 
Packit 549fdc
This is required by PKCS 11 when an application uses @code{fork()} . The
Packit 549fdc
reinitialization function must be called on the child.
Packit 549fdc
Packit 549fdc
Note that since GnuTLS 3.3.0, the reinitialization of the PKCS @code{11} 
Packit 549fdc
subsystem occurs automatically after fork.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_set_pin_function
Packit 549fdc
@anchor{gnutls_pkcs11_set_pin_function}
Packit 549fdc
@deftypefun {void} {gnutls_pkcs11_set_pin_function} (gnutls_pin_callback_t @var{fn}, void * @var{userdata})
Packit 549fdc
@var{fn}: The PIN callback, a @code{gnutls_pin_callback_t()}  function.
Packit 549fdc
Packit 549fdc
@var{userdata}: data to be supplied to callback
Packit 549fdc
Packit 549fdc
This function will set a callback function to be used when a PIN is
Packit 549fdc
required for PKCS 11 operations.  See
Packit 549fdc
@code{gnutls_pin_callback_t()}  on how the callback should behave.
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_set_token_function
Packit 549fdc
@anchor{gnutls_pkcs11_set_token_function}
Packit 549fdc
@deftypefun {void} {gnutls_pkcs11_set_token_function} (gnutls_pkcs11_token_callback_t @var{fn}, void * @var{userdata})
Packit 549fdc
@var{fn}: The token callback
Packit 549fdc
Packit 549fdc
@var{userdata}: data to be supplied to callback
Packit 549fdc
Packit 549fdc
This function will set a callback function to be used when a token
Packit 549fdc
needs to be inserted to continue PKCS 11 operations.
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_token_check_mechanism
Packit 549fdc
@anchor{gnutls_pkcs11_token_check_mechanism}
Packit 549fdc
@deftypefun {unsigned} {gnutls_pkcs11_token_check_mechanism} (const char * @var{url}, unsigned long @var{mechanism}, void * @var{ptr}, unsigned @var{psize}, unsigned @var{flags})
Packit 549fdc
@var{url}: should contain a PKCS 11 URL
Packit 549fdc
Packit 549fdc
@var{mechanism}: The PKCS @code{11}  mechanism ID
Packit 549fdc
Packit 549fdc
@var{ptr}: if set it should point to a CK_MECHANISM_INFO struct
Packit 549fdc
Packit 549fdc
@var{psize}: the size of CK_MECHANISM_INFO struct (for safety)
Packit 549fdc
Packit 549fdc
@var{flags}: must be zero
Packit 549fdc
Packit 549fdc
This function will return whether a mechanism is supported
Packit 549fdc
by the given token. If the mechanism is supported and
Packit 549fdc
 @code{ptr} is set, it will be updated with the token information.
Packit 549fdc
Packit 549fdc
@strong{Returns:} Non-zero if the mechanism is supported or zero otherwise.
Packit 549fdc
Packit 549fdc
@strong{Since:} 3.6.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_token_get_flags
Packit 549fdc
@anchor{gnutls_pkcs11_token_get_flags}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_token_get_flags} (const char * @var{url}, unsigned int * @var{flags})
Packit 549fdc
@var{url}: should contain a PKCS 11 URL
Packit 549fdc
Packit 549fdc
@var{flags}: The output flags (GNUTLS_PKCS11_TOKEN_*)
Packit 549fdc
Packit 549fdc
This function will return information about the PKCS 11 token flags.
Packit 549fdc
Packit 549fdc
The supported flags are: @code{GNUTLS_PKCS11_TOKEN_HW}  and @code{GNUTLS_PKCS11_TOKEN_TRUSTED} .
Packit 549fdc
Packit 549fdc
@strong{Returns:} @code{GNUTLS_E_SUCCESS}  (0) on success or a negative error code on error.
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_token_get_info
Packit 549fdc
@anchor{gnutls_pkcs11_token_get_info}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_token_get_info} (const char * @var{url}, gnutls_pkcs11_token_info_t @var{ttype}, void * @var{output}, size_t * @var{output_size})
Packit 549fdc
@var{url}: should contain a PKCS 11 URL
Packit 549fdc
Packit 549fdc
@var{ttype}: Denotes the type of information requested
Packit 549fdc
Packit 549fdc
@var{output}: where output will be stored
Packit 549fdc
Packit 549fdc
@var{output_size}: contains the maximum size of the output and will be overwritten with actual
Packit 549fdc
Packit 549fdc
This function will return information about the PKCS 11 token such
Packit 549fdc
as the label, id, etc.
Packit 549fdc
Packit 549fdc
@strong{Returns:} @code{GNUTLS_E_SUCCESS}  (0) on success or a negative error code
Packit 549fdc
on error.
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_token_get_mechanism
Packit 549fdc
@anchor{gnutls_pkcs11_token_get_mechanism}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_token_get_mechanism} (const char * @var{url}, unsigned int @var{idx}, unsigned long * @var{mechanism})
Packit 549fdc
@var{url}: should contain a PKCS 11 URL
Packit 549fdc
Packit 549fdc
@var{idx}: The index of the mechanism
Packit 549fdc
Packit 549fdc
@var{mechanism}: The PKCS @code{11}  mechanism ID
Packit 549fdc
Packit 549fdc
This function will return the names of the supported mechanisms
Packit 549fdc
by the token. It should be called with an increasing index until
Packit 549fdc
it return GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE.
Packit 549fdc
Packit 549fdc
@strong{Returns:} @code{GNUTLS_E_SUCCESS}  (0) on success or a negative error code on error.
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_token_get_random
Packit 549fdc
@anchor{gnutls_pkcs11_token_get_random}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_token_get_random} (const char * @var{token_url}, void * @var{rnddata}, size_t @var{len})
Packit 549fdc
@var{token_url}: A PKCS @code{11}  URL specifying a token
Packit 549fdc
Packit 549fdc
@var{rnddata}: A pointer to the memory area to be filled with random data
Packit 549fdc
Packit 549fdc
@var{len}: The number of bytes of randomness to request
Packit 549fdc
Packit 549fdc
This function will get random data from the given token.
Packit 549fdc
It will store rnddata and fill the memory pointed to by rnddata with
Packit 549fdc
len random bytes from the token.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_token_get_url
Packit 549fdc
@anchor{gnutls_pkcs11_token_get_url}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_token_get_url} (unsigned int @var{seq}, gnutls_pkcs11_url_type_t @var{detailed}, char ** @var{url})
Packit 549fdc
@var{seq}: sequence number starting from 0
Packit 549fdc
Packit 549fdc
@var{detailed}: non zero if a detailed URL is required
Packit 549fdc
Packit 549fdc
@var{url}: will contain an allocated url
Packit 549fdc
Packit 549fdc
This function will return the URL for each token available
Packit 549fdc
in system. The url has to be released using @code{gnutls_free()} 
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned,
Packit 549fdc
@code{GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE}  if the sequence number
Packit 549fdc
exceeds the available tokens, otherwise a negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_token_init
Packit 549fdc
@anchor{gnutls_pkcs11_token_init}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_token_init} (const char * @var{token_url}, const char * @var{so_pin}, const char * @var{label})
Packit 549fdc
@var{token_url}: A PKCS @code{11}  URL specifying a token
Packit 549fdc
Packit 549fdc
@var{so_pin}: Security Officer's PIN
Packit 549fdc
Packit 549fdc
@var{label}: A name to be used for the token
Packit 549fdc
Packit 549fdc
This function will initialize (format) a token. If the token is
Packit 549fdc
at a factory defaults state the security officer's PIN given will be
Packit 549fdc
set to be the default. Otherwise it should match the officer's PIN.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_token_set_pin
Packit 549fdc
@anchor{gnutls_pkcs11_token_set_pin}
Packit 549fdc
@deftypefun {int} {gnutls_pkcs11_token_set_pin} (const char * @var{token_url}, const char * @var{oldpin}, const char * @var{newpin}, unsigned int @var{flags})
Packit 549fdc
@var{token_url}: A PKCS @code{11}  URL specifying a token
Packit 549fdc
Packit 549fdc
@var{oldpin}: old user's PIN
Packit 549fdc
Packit 549fdc
@var{newpin}: new user's PIN
Packit 549fdc
Packit 549fdc
@var{flags}: one of @code{gnutls_pin_flag_t} .
Packit 549fdc
Packit 549fdc
This function will modify or set a user's PIN for the given token. 
Packit 549fdc
If it is called to set a user pin for first time the oldpin must
Packit 549fdc
be NULL.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_pkcs11_type_get_name
Packit 549fdc
@anchor{gnutls_pkcs11_type_get_name}
Packit 549fdc
@deftypefun {const char *} {gnutls_pkcs11_type_get_name} (gnutls_pkcs11_obj_type_t @var{type})
Packit 549fdc
@var{type}: Holds the PKCS 11 object type, a @code{gnutls_pkcs11_obj_type_t} .
Packit 549fdc
Packit 549fdc
This function will return a human readable description of the
Packit 549fdc
PKCS11 object type  @code{obj} .  It will return "Unknown" for unknown
Packit 549fdc
types.
Packit 549fdc
Packit 549fdc
@strong{Returns:} human readable string labeling the PKCS11 object type
Packit 549fdc
 @code{type} .
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_x509_crt_import_pkcs11
Packit 549fdc
@anchor{gnutls_x509_crt_import_pkcs11}
Packit 549fdc
@deftypefun {int} {gnutls_x509_crt_import_pkcs11} (gnutls_x509_crt_t @var{crt}, gnutls_pkcs11_obj_t @var{pkcs11_crt})
Packit 549fdc
@var{crt}: A certificate of type @code{gnutls_x509_crt_t} 
Packit 549fdc
Packit 549fdc
@var{pkcs11_crt}: A PKCS 11 object that contains a certificate
Packit 549fdc
Packit 549fdc
This function will import a PKCS 11 certificate to a @code{gnutls_x509_crt_t} 
Packit 549fdc
structure.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc
Packit 549fdc
@subheading gnutls_x509_crt_list_import_pkcs11
Packit 549fdc
@anchor{gnutls_x509_crt_list_import_pkcs11}
Packit 549fdc
@deftypefun {int} {gnutls_x509_crt_list_import_pkcs11} (gnutls_x509_crt_t * @var{certs}, unsigned int @var{cert_max}, gnutls_pkcs11_obj_t * const @var{objs}, unsigned int @var{flags})
Packit 549fdc
@var{certs}: A list of certificates of type @code{gnutls_x509_crt_t} 
Packit 549fdc
Packit 549fdc
@var{cert_max}: The maximum size of the list
Packit 549fdc
Packit 549fdc
@var{objs}: A list of PKCS 11 objects
Packit 549fdc
Packit 549fdc
@var{flags}: 0 for now
Packit 549fdc
Packit 549fdc
This function will import a PKCS 11 certificate list to a list of 
Packit 549fdc
@code{gnutls_x509_crt_t}  type. These must not be initialized.
Packit 549fdc
Packit 549fdc
@strong{Returns:} On success, @code{GNUTLS_E_SUCCESS}  (0) is returned, otherwise a
Packit 549fdc
negative error value.
Packit 549fdc
Packit 549fdc
@strong{Since:} 2.12.0
Packit 549fdc
@end deftypefun
Packit 549fdc