[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
C.7 Abstract key API
The following functions are to be used for abstract key handling. Their prototypes lie in ‘gnutls/abstract.h’.
gnutls_certificate_set_key
- Function: int gnutls_certificate_set_key (gnutls_certificate_credentials_t res, const char** names, int names_size, gnutls_pcert_st * pcert_list, int pcert_list_size, gnutls_privkey_t key)
res: is a
gnutls_certificate_credentials_t
structure.names: is an array of DNS name of the certificate (NULL if none)
names_size: holds the size of the names list
pcert_list: contains a certificate list (path) for the specified private key
pcert_list_size: holds the size of the certificate list
key: is a gnutls_x509_privkey_t key
Description: This function sets a certificate/private key pair in the gnutls_certificate_credentials_t structure. This function may be called more than once, in case multiple keys/certificates exist for the server. For clients that wants to send more than its own end entity certificate (e.g., also an intermediate CA cert) then put the certificate chain in
pcert_list
. Thepcert_list
andkey
will become part of the credentials structure and must not be deallocated. They will be automatically deallocated whenres
is deinitialized.Returns:
GNUTLS_E_SUCCESS
(0) on success, or a negative error code.Since: 3.0.0
gnutls_pcert_deinit
- Function: void gnutls_pcert_deinit (gnutls_pcert_st * pcert)
pcert: The structure to be deinitialized
Description: This function will deinitialize a pcert structure.
Since: 3.0.0
gnutls_pcert_import_openpgp
- Function: int gnutls_pcert_import_openpgp (gnutls_pcert_st* pcert, gnutls_openpgp_crt_t crt, unsigned int flags)
pcert: The pcert structure
crt: The raw certificate to be imported
flags: zero for now
Description: This convenience function will import the given certificate to a
gnutls_pcert_st
structure. The structure must be deinitialized afterwards usinggnutls_pcert_deinit()
;Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 3.0.0
gnutls_pcert_import_openpgp_raw
- Function: int gnutls_pcert_import_openpgp_raw (gnutls_pcert_st * pcert, const gnutls_datum_t* cert, gnutls_openpgp_crt_fmt_t format, gnutls_openpgp_keyid_t keyid, unsigned int flags)
pcert: The pcert structure
cert: The raw certificate to be imported
format: The format of the certificate
keyid: The key ID to use (NULL for the master key)
flags: zero for now
Description: This convenience function will import the given certificate to a
gnutls_pcert_st
structure. The structure must be deinitialized afterwards usinggnutls_pcert_deinit()
;Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 3.0.0
gnutls_pcert_import_x509
- Function: int gnutls_pcert_import_x509 (gnutls_pcert_st* pcert, gnutls_x509_crt_t crt, unsigned int flags)
pcert: The pcert structure
crt: The raw certificate to be imported
flags: zero for now
Description: This convenience function will import the given certificate to a
gnutls_pcert_st
structure. The structure must be deinitialized afterwards usinggnutls_pcert_deinit()
;Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 3.0.0
gnutls_pcert_import_x509_raw
- Function: int gnutls_pcert_import_x509_raw (gnutls_pcert_st * pcert, const gnutls_datum_t* cert, gnutls_x509_crt_fmt_t format, unsigned int flags)
pcert: The pcert structure
cert: The raw certificate to be imported
format: The format of the certificate
flags: zero for now
Description: This convenience function will import the given certificate to a
gnutls_pcert_st
structure. The structure must be deinitialized afterwards usinggnutls_pcert_deinit()
;Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 3.0.0
gnutls_pcert_list_import_x509_raw
- Function: int gnutls_pcert_list_import_x509_raw (gnutls_pcert_st * pcerts, unsigned int * pcert_max, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format, unsigned int flags)
pcerts: The structures to store the parsed certificate. Must not be initialized.
pcert_max: Initially must hold the maximum number of certs. It will be updated with the number of certs available.
data: The certificates.
format: One of DER or PEM.
flags: must be (0) or an OR’d sequence of gnutls_certificate_import_flags.
Description: This function will convert the given PEM encoded certificate list to the native gnutls_x509_crt_t format. The output will be stored in
certs
. They will be automatically initialized.If the Certificate is PEM encoded it should have a header of "X509 CERTIFICATE", or "CERTIFICATE".
Returns: the number of certificates read or a negative error value.
Since: 3.0.0
gnutls_privkey_decrypt_data
- Function: int gnutls_privkey_decrypt_data (gnutls_privkey_t key, unsigned int flags, const gnutls_datum_t * ciphertext, gnutls_datum_t * plaintext)
key: Holds the key
flags: zero for now
ciphertext: holds the data to be decrypted
plaintext: will contain the decrypted data, allocated with
gnutls_malloc()
Description: This function will decrypt the given data using the algorithm supported by the private key.
Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 2.12.0
gnutls_privkey_deinit
- Function: void gnutls_privkey_deinit (gnutls_privkey_t key)
key: The structure to be deinitialized
Description: This function will deinitialize a private key structure.
Since: 2.12.0
gnutls_privkey_get_pk_algorithm
- Function: int gnutls_privkey_get_pk_algorithm (gnutls_privkey_t key, unsigned int * bits)
key: should contain a
gnutls_privkey_t
structurebits: If set will return the number of bits of the parameters (may be NULL)
Description: This function will return the public key algorithm of a private key and if possible will return a number of bits that indicates the security parameter of the key.
Returns: a member of the
gnutls_pk_algorithm_t
enumeration on success, or a negative error code on error.Since: 2.12.0
gnutls_privkey_get_type
- Function: gnutls_privkey_type_t gnutls_privkey_get_type (gnutls_privkey_t key)
key: should contain a
gnutls_privkey_t
structureDescription: This function will return the type of the private key. This is actually the type of the subsystem used to set this private key.
Returns: a member of the
gnutls_privkey_type_t
enumeration on success, or a negative error code on error.Since: 2.12.0
gnutls_privkey_import_ext
- Function: int gnutls_privkey_import_ext (gnutls_privkey_t pkey, gnutls_pk_algorithm_t pk, void* userdata, gnutls_privkey_sign_func sign_func, gnutls_privkey_decrypt_func decrypt_func, unsigned int flags)
pkey: The private key
pk: The public key algorithm
userdata: private data to be provided to the callbacks
sign_func: callback for signature operations
decrypt_func: callback for decryption operations
flags: Flags for the import
Description: This function will associate the given callbacks with the
gnutls_privkey_t
structure. At least one of the two callbacks must be non-null.Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 3.0.0
gnutls_privkey_import_openpgp
- Function: int gnutls_privkey_import_openpgp (gnutls_privkey_t pkey, gnutls_openpgp_privkey_t key, unsigned int flags)
pkey: The private key
key: The private key to be imported
flags: Flags for the import
Description: This function will import the given private key to the abstract
gnutls_privkey_t
structure.The
gnutls_openpgp_privkey_t
object must not be deallocated during the lifetime of this structure. The subkey set as preferred will be used, or the master key otherwise.flags
might be zero or one ofGNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE
andGNUTLS_PRIVKEY_IMPORT_COPY
.Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 2.12.0
gnutls_privkey_import_pkcs11
- Function: int gnutls_privkey_import_pkcs11 (gnutls_privkey_t pkey, gnutls_pkcs11_privkey_t key, unsigned int flags)
pkey: The private key
key: The private key to be imported
flags: Flags for the import
Description: This function will import the given private key to the abstract
gnutls_privkey_t
structure.The
gnutls_pkcs11_privkey_t
object must not be deallocated during the lifetime of this structure.flags
might be zero or one ofGNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE
andGNUTLS_PRIVKEY_IMPORT_COPY
.Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 2.12.0
gnutls_privkey_import_x509
- Function: int gnutls_privkey_import_x509 (gnutls_privkey_t pkey, gnutls_x509_privkey_t key, unsigned int flags)
pkey: The private key
key: The private key to be imported
flags: Flags for the import
Description: This function will import the given private key to the abstract
gnutls_privkey_t
structure.The
gnutls_x509_privkey_t
object must not be deallocated during the lifetime of this structure.flags
might be zero or one ofGNUTLS_PRIVKEY_IMPORT_AUTO_RELEASE
andGNUTLS_PRIVKEY_IMPORT_COPY
.Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 2.12.0
gnutls_privkey_init
- Function: int gnutls_privkey_init (gnutls_privkey_t * key)
key: The structure to be initialized
Description: This function will initialize an private key structure.
Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 2.12.0
gnutls_privkey_sign_data
- Function: int gnutls_privkey_sign_data (gnutls_privkey_t signer, gnutls_digest_algorithm_t hash, unsigned int flags, const gnutls_datum_t * data, gnutls_datum_t * signature)
signer: Holds the key
hash: should be a digest algorithm
flags: should be 0 for now
data: holds the data to be signed
signature: will contain the signature allocate with
gnutls_malloc()
Description: This function will sign the given data using a signature algorithm supported by the private key. Signature algorithms are always used together with a hash functions. Different hash functions may be used for the RSA algorithm, but only the SHA family for the DSA keys.
Use
gnutls_pubkey_get_preferred_hash_algorithm()
to determine the hash algorithm.Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 2.12.0
gnutls_privkey_sign_hash
- Function: int gnutls_privkey_sign_hash (gnutls_privkey_t signer, gnutls_digest_algorithm_t hash_algo, unsigned int flags, const gnutls_datum_t * hash_data, gnutls_datum_t * signature)
signer: Holds the signer’s key
hash_algo: The hash algorithm used
flags: zero for now
hash_data: holds the data to be signed
signature: will contain newly allocated signature
Description: This function will sign the given hashed data using a signature algorithm supported by the private key. Signature algorithms are always used together with a hash functions. Different hash functions may be used for the RSA algorithm, but only SHA-XXX for the DSA keys.
Use
gnutls_pubkey_get_preferred_hash_algorithm()
to determine the hash algorithm.Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 2.12.0
gnutls_pubkey_deinit
- Function: void gnutls_pubkey_deinit (gnutls_pubkey_t key)
key: The structure to be deinitialized
Description: This function will deinitialize a public key structure.
Since: 2.12.0
gnutls_pubkey_export
- Function: int gnutls_pubkey_export (gnutls_pubkey_t key, gnutls_x509_crt_fmt_t format, void * output_data, size_t * output_data_size)
key: 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)
Description: This function will export the certificate to DER or PEM format.
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
gnutls_pubkey_get_key_id
- Function: int gnutls_pubkey_get_key_id (gnutls_pubkey_t key, unsigned int flags, unsigned char * output_data, size_t * output_data_size)
key: Holds the public key
flags: should be 0 for now
output_data: will contain the key ID
output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters)
Description: This function will return a unique ID the depends on the public key parameters. This ID can be used in checking whether a certificate corresponds to the given public key.
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. The output will normally be a SHA-1 hash output, which is 20 bytes.Returns: In case of failure a negative error code will be returned, and 0 on success.
Since: 2.12.0
gnutls_pubkey_get_key_usage
- Function: int gnutls_pubkey_get_key_usage (gnutls_pubkey_t key, unsigned int * usage)
key: should contain a
gnutls_pubkey_t
structureusage: If set will return the number of bits of the parameters (may be NULL)
Description: This function will return the key usage of the public key.
Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 2.12.0
gnutls_pubkey_get_openpgp_key_id
- Function: int gnutls_pubkey_get_openpgp_key_id (gnutls_pubkey_t key, unsigned int flags, unsigned char * output_data, size_t * output_data_size, unsigned int * subkey)
key: Holds the public key
flags: should be 0 for now
output_data: will contain the key ID
output_data_size: holds the size of output_data (and will be replaced by the actual size of parameters)
subkey: Will be non zero if the key ID corresponds to a subkey
Description: This function will return a unique ID the depends on the public key parameters. This ID can be used in checking whether a certificate corresponds to the given public key.
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. The output will normally be a SHA-1 hash output, which is 20 bytes.Returns: In case of failure a negative error code will be returned, and 0 on success.
Since: 3.0.0
gnutls_pubkey_get_pk_algorithm
- Function: int gnutls_pubkey_get_pk_algorithm (gnutls_pubkey_t key, unsigned int * bits)
key: should contain a
gnutls_pubkey_t
structurebits: If set will return the number of bits of the parameters (may be NULL)
Description: This function will return the public key algorithm of a public key and if possible will return a number of bits that indicates the security parameter of the key.
Returns: a member of the
gnutls_pk_algorithm_t
enumeration on success, or a negative error code on error.Since: 2.12.0
gnutls_pubkey_get_pk_dsa_raw
- Function: int gnutls_pubkey_get_pk_dsa_raw (gnutls_pubkey_t key, gnutls_datum_t * p, gnutls_datum_t * q, gnutls_datum_t * g, gnutls_datum_t * y)
key: Holds the public key
p: will hold the p
q: will hold the q
g: will hold the g
y: will hold the y
Description: This function will export the DSA public key’s parameters found in the given certificate. The new parameters will be allocated using
gnutls_malloc()
and will be stored in the appropriate datum.Returns:
GNUTLS_E_SUCCESS
on success, otherwise a negative error code.Since: 2.12.0
gnutls_pubkey_get_pk_ecc_raw
- Function: int gnutls_pubkey_get_pk_ecc_raw (gnutls_pubkey_t key, gnutls_ecc_curve_t * curve, gnutls_datum_t * x, gnutls_datum_t * y)
key: Holds the public key
curve: will hold the curve
x: will hold x
y: will hold y
Description: This function will export the ECC public key’s parameters found in the given certificate. The new parameters will be allocated using
gnutls_malloc()
and will be stored in the appropriate datum.Returns:
GNUTLS_E_SUCCESS
on success, otherwise a negative error code.Since: 3.0.0
gnutls_pubkey_get_pk_ecc_x962
- Function: int gnutls_pubkey_get_pk_ecc_x962 (gnutls_pubkey_t key, gnutls_datum_t* parameters, gnutls_datum_t * ecpoint)
key: Holds the public key
parameters: DER encoding of an ANSI X9.62 parameters
ecpoint: DER encoding of ANSI X9.62 ECPoint
Description: This function will export the ECC public key’s parameters found in the given certificate. The new parameters will be allocated using
gnutls_malloc()
and will be stored in the appropriate datum.Returns:
GNUTLS_E_SUCCESS
on success, otherwise a negative error code.Since: 3.0.0
gnutls_pubkey_get_pk_rsa_raw
- Function: int gnutls_pubkey_get_pk_rsa_raw (gnutls_pubkey_t key, gnutls_datum_t * m, gnutls_datum_t * e)
key: Holds the certificate
m: will hold the modulus
e: will hold the public exponent
Description: This function will export the RSA public key’s parameters found in the given structure. The new parameters will be allocated using
gnutls_malloc()
and will be stored in the appropriate datum.Returns:
GNUTLS_E_SUCCESS
on success, otherwise a negative error code.Since: 2.12.0
gnutls_pubkey_get_preferred_hash_algorithm
- Function: int gnutls_pubkey_get_preferred_hash_algorithm (gnutls_pubkey_t key, gnutls_digest_algorithm_t * hash, unsigned int * mand)
key: Holds the certificate
hash: The result of the call with the hash algorithm used for signature
mand: If non zero it means that the algorithm MUST use this hash. May be NULL.
Description: This function will read the certifcate and return the appropriate digest algorithm to use for signing with this certificate. Some certificates (i.e. DSA might not be able to sign without the preferred algorithm).
Returns: the 0 if the hash algorithm is found. A negative error code is returned on error.
Since: 2.12.0
gnutls_pubkey_get_verify_algorithm
- Function: int gnutls_pubkey_get_verify_algorithm (gnutls_pubkey_t key, const gnutls_datum_t * signature, gnutls_digest_algorithm_t * hash)
key: Holds the certificate
signature: contains the signature
hash: The result of the call with the hash algorithm used for signature
Description: This function will read the certifcate and the signed data to determine the hash algorithm used to generate the signature.
Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 2.12.0
gnutls_pubkey_import
- Function: int gnutls_pubkey_import (gnutls_pubkey_t key, const gnutls_datum_t * data, gnutls_x509_crt_fmt_t format)
key: The structure to store the parsed public key.
data: The DER or PEM encoded certificate.
format: One of DER or PEM
Description: This function will convert the given DER or PEM encoded Public key to the native gnutls_pubkey_t format.The output will be stored in
key
. If the Certificate is PEM encoded it should have a header of "PUBLIC KEY".Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 2.12.0
gnutls_pubkey_import_dsa_raw
- Function: int gnutls_pubkey_import_dsa_raw (gnutls_pubkey_t key, const gnutls_datum_t * p, const gnutls_datum_t * q, const gnutls_datum_t * g, const gnutls_datum_t * y)
key: The structure to store the parsed key
p: holds the p
q: holds the q
g: holds the g
y: holds the y
Description: This function will convert the given DSA raw parameters to the native
gnutls_pubkey_t
format. The output will be stored inkey
.Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 2.12.0
gnutls_pubkey_import_ecc_raw
- Function: int gnutls_pubkey_import_ecc_raw (gnutls_pubkey_t key, gnutls_ecc_curve_t curve, const gnutls_datum_t * x, const gnutls_datum_t * y)
key: The structure to store the parsed key
curve: holds the curve
x: holds the x
y: holds the y
Description: This function will convert the given elliptic curve parameters to a
gnutls_pubkey_t
. The output will be stored inkey
.Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 3.0.0
gnutls_pubkey_import_ecc_x962
- Function: int gnutls_pubkey_import_ecc_x962 (gnutls_pubkey_t key, const gnutls_datum_t * parameters, const gnutls_datum_t * ecpoint)
key: The structure to store the parsed key
parameters: DER encoding of an ANSI X9.62 parameters
ecpoint: DER encoding of ANSI X9.62 ECPoint
Description: This function will convert the given elliptic curve parameters to a
gnutls_pubkey_t
. The output will be stored inkey
.Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 3.0.0
gnutls_pubkey_import_openpgp
- Function: int gnutls_pubkey_import_openpgp (gnutls_pubkey_t key, gnutls_openpgp_crt_t crt, unsigned int flags)
key: The public key
crt: The certificate to be imported
flags: should be zero
Description: Imports a public key from an openpgp key. This function will import the given public key to the abstract
gnutls_pubkey_t
structure. The subkey set as preferred will be imported or the master key otherwise.Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 2.12.0
gnutls_pubkey_import_pkcs11
- Function: int gnutls_pubkey_import_pkcs11 (gnutls_pubkey_t key, gnutls_pkcs11_obj_t obj, unsigned int flags)
key: The public key
obj: The parameters to be imported
flags: should be zero
Description: Imports a public key from a pkcs11 key. 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_pkcs11_url
- Function: int gnutls_pubkey_import_pkcs11_url (gnutls_pubkey_t key, const char * url, unsigned int flags)
key: A key of type
gnutls_pubkey_t
url: A PKCS 11 url
flags: One of GNUTLS_PKCS11_OBJ_* flags
Description: This function will import a PKCS 11 certificate to a
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_privkey
- Function: int gnutls_pubkey_import_privkey (gnutls_pubkey_t key, gnutls_privkey_t pkey, unsigned int usage, unsigned int flags)
key: The public key
pkey: The private key
usage: GNUTLS_KEY_* key usage flags.
flags: should be zero
Description: Imports the public key from a private. 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_rsa_raw
- Function: int gnutls_pubkey_import_rsa_raw (gnutls_pubkey_t key, const gnutls_datum_t * m, const gnutls_datum_t * e)
key: Is a structure will hold the parameters
m: holds the modulus
e: holds the public exponent
Description: This function will replace the parameters in the given structure. The new parameters should be stored in the appropriate gnutls_datum.
Returns:
GNUTLS_E_SUCCESS
on success, or an negative error code.Since: 2.12.0
gnutls_pubkey_import_x509
- Function: int gnutls_pubkey_import_x509 (gnutls_pubkey_t key, gnutls_x509_crt_t crt, unsigned int flags)
key: The public key
crt: The certificate to be imported
flags: should be zero
Description: 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_init
- Function: int gnutls_pubkey_init (gnutls_pubkey_t * key)
key: The structure to be initialized
Description: This function will initialize an public key structure.
Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 2.12.0
gnutls_pubkey_set_key_usage
- Function: int gnutls_pubkey_set_key_usage (gnutls_pubkey_t key, unsigned int usage)
key: a certificate of type
gnutls_x509_crt_t
usage: an ORed sequence of the GNUTLS_KEY_* elements.
Description: This function will set the key usage flags of the public key. This is only useful if the key is to be exported to a certificate or certificate request.
Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 2.12.0
gnutls_pubkey_verify_data
- Function: int gnutls_pubkey_verify_data (gnutls_pubkey_t pubkey, unsigned int flags, const gnutls_datum_t * data, const gnutls_datum_t * signature)
pubkey: Holds the public key
flags: should be 0 for now
data: holds the signed data
signature: contains the signature
Description: This function will verify the given signed data, using the parameters from the certificate.
Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value (GNUTLS_E_PK_SIG_VERIFY_FAILED
in verification failure).Since: 2.12.0
gnutls_pubkey_verify_data2
- Function: int gnutls_pubkey_verify_data2 (gnutls_pubkey_t pubkey, gnutls_sign_algorithm_t algo, unsigned int flags, const gnutls_datum_t * data, const gnutls_datum_t * signature)
pubkey: Holds the public key
algo: The signature algorithm used
flags: should be 0 for now
data: holds the signed data
signature: contains the signature
Description: This function will verify the given signed data, using the parameters from the certificate.
Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value (GNUTLS_E_PK_SIG_VERIFY_FAILED
in verification failure).Since: 3.0.0
gnutls_pubkey_verify_hash
- Function: int gnutls_pubkey_verify_hash (gnutls_pubkey_t key, unsigned int flags, const gnutls_datum_t * hash, const gnutls_datum_t * signature)
key: Holds the certificate
flags: should be 0 for now
hash: holds the hash digest to be verified
signature: contains the signature
Description: This function will verify the given signed digest, using the parameters from the certificate.
Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value (GNUTLS_E_PK_SIG_VERIFY_FAILED
in verification failure).Since: 2.12.0
gnutls_x509_crl_privkey_sign
- Function: int gnutls_x509_crl_privkey_sign (gnutls_x509_crl_t crl, gnutls_x509_crt_t issuer, gnutls_privkey_t issuer_key, gnutls_digest_algorithm_t dig, unsigned int flags)
crl: should contain a gnutls_x509_crl_t structure
issuer: is the certificate of the certificate issuer
issuer_key: holds the issuer’s private key
dig: The message digest to use. GNUTLS_DIG_SHA1 is the safe choice unless you know what you’re doing.
flags: must be 0
Description: This function will sign the CRL with the issuer’s private key, and will copy the issuer’s information into the CRL.
This must be the last step in a certificate CRL since all the previously set parameters are now signed.
Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since 2.12.0
gnutls_x509_crq_privkey_sign
- Function: int gnutls_x509_crq_privkey_sign (gnutls_x509_crq_t crq, gnutls_privkey_t key, gnutls_digest_algorithm_t dig, unsigned int flags)
crq: should contain a
gnutls_x509_crq_t
structurekey: holds a private key
dig: The message digest to use, i.e.,
GNUTLS_DIG_SHA1
flags: must be 0
Description: This function will sign the certificate request with a private key. This must be the same key as the one used in
gnutls_x509_crt_set_key()
since a certificate request is self signed.This must be the last step in a certificate request generation since all the previously set parameters are now signed.
Returns:
GNUTLS_E_SUCCESS
on success, otherwise a negative error code.GNUTLS_E_ASN1_VALUE_NOT_FOUND
is returned if you didn’t set all information in the certificate request (e.g., the version usinggnutls_x509_crq_set_version()
).Since: 2.12.0
gnutls_x509_crq_set_pubkey
- Function: int gnutls_x509_crq_set_pubkey (gnutls_x509_crq_t crq, gnutls_pubkey_t key)
crq: should contain a
gnutls_x509_crq_t
structurekey: holds a public key
Description: This function will set the public parameters from the given public key to the request.
Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 2.12.0
gnutls_x509_crt_privkey_sign
- Function: int gnutls_x509_crt_privkey_sign (gnutls_x509_crt_t crt, gnutls_x509_crt_t issuer, gnutls_privkey_t issuer_key, gnutls_digest_algorithm_t dig, unsigned int flags)
crt: a certificate of type
gnutls_x509_crt_t
issuer: is the certificate of the certificate issuer
issuer_key: holds the issuer’s private key
dig: The message digest to use,
GNUTLS_DIG_SHA1
is a safe choiceflags: must be 0
Description: This function will sign the certificate with the issuer’s private key, and will copy the issuer’s information into the certificate.
This must be the last step in a certificate generation since all the previously set parameters are now signed.
Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.
gnutls_x509_crt_set_pubkey
- Function: int gnutls_x509_crt_set_pubkey (gnutls_x509_crt_t crt, gnutls_pubkey_t key)
crt: should contain a
gnutls_x509_crt_t
structurekey: holds a public key
Description: This function will set the public parameters from the given public key to the request.
Returns: On success,
GNUTLS_E_SUCCESS
(0) is returned, otherwise a negative error value.Since: 2.12.0
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on January 4, 2012 using texi2html 5.0.