![]() | ![]() | ![]() | GNU TLS API Reference Manual | ![]() |
---|
pkcs12pkcs12 — |
gnutls_pkcs12_int; gnutls_pkcs12_bag_int; int gnutls_pkcs12_init (gnutls_pkcs12_t *pkcs12); void gnutls_pkcs12_deinit (gnutls_pkcs12_t pkcs12); int gnutls_pkcs12_import (gnutls_pkcs12_t pkcs12, const gnutls_datum_t *data, gnutls_x509_crt_fmt_t format, unsigned int flags); int gnutls_pkcs12_export (gnutls_pkcs12_t pkcs12, gnutls_x509_crt_fmt format, void *output_data, size_t *output_data_size); int gnutls_pkcs12_get_bag (gnutls_pkcs12_t pkcs12, int indx, gnutls_pkcs12_bag_t bag); int gnutls_pkcs12_set_bag (gnutls_pkcs12_t pkcs12, gnutls_pkcs12_bag_t bag); int gnutls_pkcs12_generate_mac (gnutls_pkcs12_t pkcs12, const char *pass); int gnutls_pkcs12_verify_mac (gnutls_pkcs12_t pkcs12, const char *pass); int gnutls_pkcs12_bag_decrypt (gnutls_pkcs12_bag_t bag, const char *pass); int gnutls_pkcs12_bag_encrypt (gnutls_pkcs12_bag_t bag, const char *pass, unsigned int flags); enum gnutls_pkcs12_bag_type_t; gnutls_pkcs12_bag_type_t gnutls_pkcs12_bag_get_type (gnutls_pkcs12_bag_t bag, int indx); int gnutls_pkcs12_bag_get_data (gnutls_pkcs12_bag_t bag, int indx, gnutls_datum_t *data); int gnutls_pkcs12_bag_set_data (gnutls_pkcs12_bag_t bag, gnutls_pkcs12_bag_type_t type, const gnutls_datum_t *data); int gnutls_pkcs12_bag_set_crl (gnutls_pkcs12_bag_t bag, gnutls_x509_crl_t crl); int gnutls_pkcs12_bag_set_crt (gnutls_pkcs12_bag_t bag, gnutls_x509_crt_t crt); int gnutls_pkcs12_bag_init (gnutls_pkcs12_bag_t *bag); void gnutls_pkcs12_bag_deinit (gnutls_pkcs12_bag_t bag); int gnutls_pkcs12_bag_get_count (gnutls_pkcs12_bag_t bag); int gnutls_pkcs12_bag_get_key_id (gnutls_pkcs12_bag_t bag, int indx, gnutls_datum_t *id); int gnutls_pkcs12_bag_set_key_id (gnutls_pkcs12_bag_t bag, int indx, const gnutls_datum_t *id); int gnutls_pkcs12_bag_get_friendly_name (gnutls_pkcs12_bag_t bag, int indx, char **name); int gnutls_pkcs12_bag_set_friendly_name (gnutls_pkcs12_bag_t bag, int indx, const char *name);
typedef struct { struct bag_element element[MAX_BAG_ELEMENTS]; int bag_elements; } gnutls_pkcs12_bag_int;
int gnutls_pkcs12_init (gnutls_pkcs12_t *pkcs12);
This function will initialize a PKCS12 structure. PKCS12 structures usually contain lists of X.509 Certificates and X.509 Certificate revocation lists.
pkcs12 : | |
Returns : |
void gnutls_pkcs12_deinit (gnutls_pkcs12_t pkcs12);
This function will deinitialize a PKCS12 structure.
pkcs12 : |
int gnutls_pkcs12_import (gnutls_pkcs12_t pkcs12, const gnutls_datum_t *data, gnutls_x509_crt_fmt_t format, unsigned int flags);
This function will convert the given DER or PEM encoded PKCS12 to the native gnutls_pkcs12_t format. The output will be stored in 'pkcs12'.
If the PKCS12 is PEM encoded it should have a header of "PKCS12".
pkcs12 : | |
data : | |
format : | |
flags : | |
Returns : |
int gnutls_pkcs12_export (gnutls_pkcs12_t pkcs12, gnutls_x509_crt_fmt format, void *output_data, size_t *output_data_size);
This function will export the pkcs12 structure to DER or PEM format.
If the buffer provided is not long enough to hold the output, then GNUTLS_E_SHORT_MEMORY_BUFFER will be returned.
If the structure is PEM encoded, it will have a header of "BEGIN PKCS12".
In case of failure a negative value will be returned, and 0 on success.
pkcs12 : | |
format : | |
output_data : | |
output_data_size : | |
Returns : |
int gnutls_pkcs12_get_bag (gnutls_pkcs12_t pkcs12, int indx, gnutls_pkcs12_bag_t bag);
This function will return a Bag from the PKCS12 structure.
pkcs12 : | |
indx : | |
bag : | |
Returns : |
int gnutls_pkcs12_set_bag (gnutls_pkcs12_t pkcs12, gnutls_pkcs12_bag_t bag);
This function will insert a Bag into the PKCS12 structure.
pkcs12 : | |
bag : | |
Returns : |
int gnutls_pkcs12_generate_mac (gnutls_pkcs12_t pkcs12, const char *pass);
This function will generate a MAC for the PKCS12 structure.
pkcs12 : | |
pass : | |
Returns : |
int gnutls_pkcs12_verify_mac (gnutls_pkcs12_t pkcs12, const char *pass);
This function will verify the MAC for the PKCS12 structure.
pkcs12 : | |
pass : | |
Returns : |
int gnutls_pkcs12_bag_decrypt (gnutls_pkcs12_bag_t bag, const char *pass);
This function will decrypt the given encrypted bag and return 0 on success.
bag : | |
pass : | |
Returns : |
int gnutls_pkcs12_bag_encrypt (gnutls_pkcs12_bag_t bag, const char *pass, unsigned int flags);
This function will encrypt the given bag and return 0 on success.
bag : | |
pass : | |
flags : | |
Returns : |
typedef enum gnutls_pkcs12_bag_type_t { GNUTLS_BAG_EMPTY = 0, GNUTLS_BAG_PKCS8_ENCRYPTED_KEY = 1, GNUTLS_BAG_PKCS8_KEY, GNUTLS_BAG_CERTIFICATE, GNUTLS_BAG_CRL, GNUTLS_BAG_ENCRYPTED = 10, GNUTLS_BAG_UNKNOWN = 20 } gnutls_pkcs12_bag_type_t;
gnutls_pkcs12_bag_type_t gnutls_pkcs12_bag_get_type (gnutls_pkcs12_bag_t bag, int indx);
This function will return the bag's type. One of the gnutls_pkcs12_bag_type_t enumerations.
bag : | |
indx : | |
Returns : |
int gnutls_pkcs12_bag_get_data (gnutls_pkcs12_bag_t bag, int indx, gnutls_datum_t *data);
This function will return the bag's data. The data is a constant that is stored into the bag. Should not be accessed after the bag is deleted.
bag : | |
indx : | |
data : | |
Returns : |
int gnutls_pkcs12_bag_set_data (gnutls_pkcs12_bag_t bag, gnutls_pkcs12_bag_type_t type, const gnutls_datum_t *data);
This function will insert the given data of the given type into the bag.
bag : | |
type : | |
data : | |
Returns : |
int gnutls_pkcs12_bag_set_crl (gnutls_pkcs12_bag_t bag, gnutls_x509_crl_t crl);
This function will insert the given CRL into the bag. This is just a wrapper over gnutls_pkcs12_bag_set_data().
bag : | |
crl : | |
Returns : |
int gnutls_pkcs12_bag_set_crt (gnutls_pkcs12_bag_t bag, gnutls_x509_crt_t crt);
This function will insert the given certificate into the bag. This is just a wrapper over gnutls_pkcs12_bag_set_data().
bag : | |
crt : | |
Returns : |
int gnutls_pkcs12_bag_init (gnutls_pkcs12_bag_t *bag);
This function will initialize a PKCS12 bag structure. PKCS12 Bags usually contain private keys, lists of X.509 Certificates and X.509 Certificate revocation lists.
bag : | |
Returns : |
void gnutls_pkcs12_bag_deinit (gnutls_pkcs12_bag_t bag);
This function will deinitialize a PKCS12 Bag structure.
bag : |
int gnutls_pkcs12_bag_get_count (gnutls_pkcs12_bag_t bag);
This function will return the number of the elements withing the bag.
bag : | |
Returns : |
int gnutls_pkcs12_bag_get_key_id (gnutls_pkcs12_bag_t bag, int indx, gnutls_datum_t *id);
This function will return the key ID, of the specified bag element. The key ID is usually used to distinguish the local private key and the certificate pair.
bag : | |
indx : | |
id : | |
Returns : |
int gnutls_pkcs12_bag_set_key_id (gnutls_pkcs12_bag_t bag, int indx, const gnutls_datum_t *id);
This function will add the given key ID, to the specified, by the index, bag element. The key ID will be encoded as a 'Local key identifier' bag attribute, which is usually used to distinguish the local private key and the certificate pair.
bag : | |
indx : | |
id : | |
Returns : |
int gnutls_pkcs12_bag_get_friendly_name (gnutls_pkcs12_bag_t bag, int indx, char **name);
This function will return the friendly name, of the specified bag element. The key ID is usually used to distinguish the local private key and the certificate pair.
bag : | |
indx : | |
name : | |
Returns : |
int gnutls_pkcs12_bag_set_friendly_name (gnutls_pkcs12_bag_t bag, int indx, const char *name);
This function will add the given key friendly name, to the specified, by the index, bag element. The name will be encoded as a 'Friendly name' bag attribute, which is usually used to set a user name to the local private key and the certificate pair.
bag : | |
indx : | |
name : | |
Returns : |
<< x509 | openpgp >> |