Blame doc/cha-cert-auth2.texi

Packit aea12f
@node More on certificate authentication
Packit aea12f
@section More on certificate authentication
Packit aea12f
@cindex certificate authentication
Packit aea12f
Packit aea12f
Certificates are not the only structures involved in a public key
Packit aea12f
infrastructure. Several other structures that are used for certificate
Packit aea12f
requests, encrypted private keys, revocation lists, GnuTLS abstract key
Packit aea12f
structures, etc., are discussed in this chapter.
Packit aea12f
Packit aea12f
@menu
Packit aea12f
* PKCS 10 certificate requests::
Packit aea12f
* PKIX certificate revocation lists::
Packit aea12f
* OCSP certificate status checking::
Packit aea12f
* OCSP stapling::
Packit aea12f
* Managing encrypted keys::
Packit aea12f
* certtool Invocation::            Invoking certtool
Packit aea12f
* ocsptool Invocation::            Invoking ocsptool
Packit aea12f
* danetool Invocation::            Invoking danetool
Packit aea12f
@end menu
Packit aea12f
Packit aea12f
@node PKCS 10 certificate requests
Packit aea12f
@subsection @acronym{PKCS} #10 certificate requests
Packit aea12f
@cindex certificate requests
Packit aea12f
@cindex PKCS #10
Packit aea12f
Packit aea12f
A certificate request is a structure, which contain information about
Packit aea12f
an applicant of a certificate service.  It typically contains a public
Packit aea12f
key, a distinguished name and secondary data such as a challenge
Packit aea12f
password. @acronym{GnuTLS} supports the requests defined in
Packit aea12f
@acronym{PKCS} #10 @xcite{RFC2986}. Other formats of certificate requests
Packit aea12f
are not currently supported by GnuTLS.
Packit aea12f
Packit aea12f
A certificate request can be generated by
Packit aea12f
associating it with a private key, setting the
Packit aea12f
subject's information and finally self signing it.
Packit aea12f
The last step ensures that the requester is in
Packit aea12f
possession of the private key.
Packit aea12f
Packit aea12f
@showfuncF{gnutls_x509_crq_set_version,gnutls_x509_crq_set_dn,gnutls_x509_crq_set_dn_by_oid,gnutls_x509_crq_set_key_usage,gnutls_x509_crq_set_key_purpose_oid,gnutls_x509_crq_set_basic_constraints}
Packit aea12f
Packit aea12f
The @funcref{gnutls_x509_crq_set_key} and @funcref{gnutls_x509_crq_sign2} 
Packit aea12f
functions associate the request with a private key and sign it. If a 
Packit aea12f
request is to be signed with a key residing in a PKCS #11 token it is recommended to use
Packit aea12f
the signing functions shown in @ref{Abstract key types}.
Packit aea12f
Packit aea12f
@showfuncdesc{gnutls_x509_crq_set_key}
Packit aea12f
@showfuncdesc{gnutls_x509_crq_sign2}
Packit aea12f
Packit aea12f
The following example is about generating a certificate request, and a
Packit aea12f
private key. A certificate request can be later be processed by a CA
Packit aea12f
which should return a signed certificate.
Packit aea12f
Packit aea12f
@anchor{ex-crq}
Packit aea12f
@verbatiminclude examples/ex-crq.c
Packit aea12f
Packit aea12f
@node PKIX certificate revocation lists
Packit aea12f
@subsection PKIX certificate revocation lists
Packit aea12f
@cindex certificate revocation lists
Packit aea12f
@cindex CRL
Packit aea12f
Packit aea12f
A certificate revocation list (CRL) is a structure issued by an authority
Packit aea12f
periodically containing a list of revoked certificates serial numbers.
Packit aea12f
The CRL structure is signed with the issuing authorities' keys. A typical
Packit aea12f
CRL contains the fields as shown in @ref{tab:crl}.
Packit aea12f
Certificate revocation lists are used to complement the expiration date of a certificate,
Packit aea12f
in order to account for other reasons of revocation, such as compromised keys, etc.
Packit aea12f
Packit aea12f
Each CRL is valid for limited amount of
Packit aea12f
time and is required to provide, except for the current issuing time, also 
Packit aea12f
the issuing time of the next update.
Packit aea12f
Packit aea12f
@float Table,tab:crl
Packit aea12f
@multitable @columnfractions .2 .7
Packit aea12f
Packit aea12f
@headitem Field @tab Description
Packit aea12f
Packit aea12f
@item version @tab
Packit aea12f
The field that indicates the version of the CRL structure.
Packit aea12f
Packit aea12f
@item signature @tab
Packit aea12f
A signature by the issuing authority.
Packit aea12f
Packit aea12f
@item issuer @tab
Packit aea12f
Holds the issuer's distinguished name.
Packit aea12f
Packit aea12f
@item thisUpdate @tab
Packit aea12f
The issuing time of the revocation list.
Packit aea12f
Packit aea12f
@item nextUpdate @tab
Packit aea12f
The issuing time of the revocation list that will update that one.
Packit aea12f
Packit aea12f
@item revokedCertificates @tab
Packit aea12f
List of revoked certificates serial numbers.
Packit aea12f
Packit aea12f
@item extensions @tab
Packit aea12f
Optional CRL structure extensions.
Packit aea12f
Packit aea12f
@end multitable
Packit aea12f
@caption{Certificate revocation list fields.}
Packit aea12f
@end float
Packit aea12f
Packit aea12f
The basic CRL structure functions follow.
Packit aea12f
Packit aea12f
@showfuncD{gnutls_x509_crl_init,gnutls_x509_crl_import,gnutls_x509_crl_export,gnutls_x509_crl_export}
Packit aea12f
Packit aea12f
@subsubheading Reading a CRL
Packit aea12f
Packit aea12f
The most important function that extracts the certificate revocation
Packit aea12f
information from a CRL is @funcref{gnutls_x509_crl_get_crt_serial}. Other
Packit aea12f
functions that return other fields of the CRL structure are also provided.
Packit aea12f
Packit aea12f
@showfuncdesc{gnutls_x509_crl_get_crt_serial}
Packit aea12f
Packit aea12f
@showfuncF{gnutls_x509_crl_get_version,gnutls_x509_crl_get_issuer_dn,gnutls_x509_crl_get_issuer_dn2,gnutls_x509_crl_get_this_update,gnutls_x509_crl_get_next_update,gnutls_x509_crl_get_crt_count}
Packit aea12f
Packit aea12f
@subsubheading Generation of a CRL
Packit aea12f
Packit aea12f
The following functions can be used to generate a CRL.
Packit aea12f
Packit aea12f
@showfuncB{gnutls_x509_crl_set_version,gnutls_x509_crl_set_crt_serial}
Packit aea12f
@showfuncC{gnutls_x509_crl_set_crt,gnutls_x509_crl_set_next_update,gnutls_x509_crl_set_this_update}
Packit aea12f
Packit aea12f
The @funcref{gnutls_x509_crl_sign2} and @funcref{gnutls_x509_crl_privkey_sign} 
Packit aea12f
functions sign the revocation list with a private key. The latter function
Packit aea12f
can be used to sign with a key residing in a PKCS #11 token.
Packit aea12f
Packit aea12f
@showfuncdesc{gnutls_x509_crl_sign2}
Packit aea12f
@showfuncdesc{gnutls_x509_crl_privkey_sign}
Packit aea12f
Packit aea12f
Few extensions on the CRL structure are supported, including the
Packit aea12f
CRL number extension and the authority key identifier.
Packit aea12f
Packit aea12f
@showfuncB{gnutls_x509_crl_set_number,gnutls_x509_crl_set_authority_key_id}
Packit aea12f
Packit aea12f
@node OCSP certificate status checking
Packit aea12f
@subsection @acronym{OCSP} certificate status checking
Packit aea12f
@cindex certificate status
Packit aea12f
@cindex Online Certificate Status Protocol
Packit aea12f
@cindex OCSP
Packit aea12f
Packit aea12f
Certificates may be revoked before their expiration time has been
Packit aea12f
reached.  There are several reasons for revoking certificates, but a
Packit aea12f
typical situation is when the private key associated with a
Packit aea12f
certificate has been compromised.  Traditionally, Certificate
Packit aea12f
Revocation Lists (CRLs) have been used by application to implement
Packit aea12f
revocation checking, however, several problems with CRLs have been
Packit aea12f
identified @xcite{RIVESTCRL}.
Packit aea12f
Packit aea12f
The Online Certificate Status Protocol, or @acronym{OCSP} @xcite{RFC2560}, 
Packit aea12f
is a widely implemented protocol which performs certificate revocation status
Packit aea12f
checking.  An application that wish to verify the
Packit aea12f
identity of a peer will verify the certificate against a set of
Packit aea12f
trusted certificates and then check whether the certificate is listed
Packit aea12f
in a CRL and/or perform an OCSP check for the certificate.
Packit aea12f
Packit aea12f
Applications are typically expected to contact the OCSP server in order to
Packit aea12f
request the certificate validity status. The OCSP server replies with an OCSP
Packit aea12f
response. This section describes this online communication (which can be avoided
Packit aea12f
when using OCSP stapled responses, for that, see @ref{OCSP stapling}).
Packit aea12f
Packit aea12f
Before performing the OCSP query, the application will need to figure
Packit aea12f
out the address of the OCSP server.  The OCSP server address can be
Packit aea12f
provided by the local user in manual configuration or may be stored
Packit aea12f
in the certificate that is being checked.  When stored in a certificate
Packit aea12f
the OCSP server is in the extension field called the Authority Information 
Packit aea12f
Access (AIA). The following function
Packit aea12f
extracts this information from a certificate.
Packit aea12f
Packit aea12f
@showfuncA{gnutls_x509_crt_get_authority_info_access}
Packit aea12f
Packit aea12f
There are several functions in GnuTLS for creating and manipulating
Packit aea12f
OCSP requests and responses.  The general idea is that a client
Packit aea12f
application creates an OCSP request object, stores some information
Packit aea12f
about the certificate to check in the request, and then exports the
Packit aea12f
request in DER format.  The request will then need to be sent to the
Packit aea12f
OCSP responder, which needs to be done by the application (GnuTLS does
Packit aea12f
not send and receive OCSP packets).  Normally an OCSP response is
Packit aea12f
received that the application will need to import into an OCSP
Packit aea12f
response object.  The digital signature in the OCSP response needs to
Packit aea12f
be verified against a set of trust anchors before the information in
Packit aea12f
the response can be trusted.
Packit aea12f
Packit aea12f
The ASN.1 structure of OCSP requests are briefly as follows.  It is
Packit aea12f
useful to review the structures to get an understanding of which
Packit aea12f
fields are modified by GnuTLS functions.
Packit aea12f
Packit aea12f
@example
Packit aea12f
OCSPRequest     ::=     SEQUENCE @{
Packit aea12f
    tbsRequest                  TBSRequest,
Packit aea12f
    optionalSignature   [0]     EXPLICIT Signature OPTIONAL @}
Packit aea12f
Packit aea12f
TBSRequest      ::=     SEQUENCE @{
Packit aea12f
    version             [0]     EXPLICIT Version DEFAULT v1,
Packit aea12f
    requestorName       [1]     EXPLICIT GeneralName OPTIONAL,
Packit aea12f
    requestList                 SEQUENCE OF Request,
Packit aea12f
    requestExtensions   [2]     EXPLICIT Extensions OPTIONAL @}
Packit aea12f
Packit aea12f
Request         ::=     SEQUENCE @{
Packit aea12f
    reqCert                     CertID,
Packit aea12f
    singleRequestExtensions     [0] EXPLICIT Extensions OPTIONAL @}
Packit aea12f
Packit aea12f
CertID          ::=     SEQUENCE @{
Packit aea12f
    hashAlgorithm       AlgorithmIdentifier,
Packit aea12f
    issuerNameHash      OCTET STRING, -- Hash of Issuer's DN
Packit aea12f
    issuerKeyHash       OCTET STRING, -- Hash of Issuers public key
Packit aea12f
    serialNumber        CertificateSerialNumber @}
Packit aea12f
@end example
Packit aea12f
Packit aea12f
The basic functions to initialize, import, export and deallocate OCSP
Packit aea12f
requests are the following.
Packit aea12f
Packit aea12f
@showfuncE{gnutls_ocsp_req_init,gnutls_ocsp_req_deinit,gnutls_ocsp_req_import,gnutls_ocsp_req_export,gnutls_ocsp_req_print}
Packit aea12f
Packit aea12f
To generate an OCSP request the issuer name hash, issuer key hash, and 
Packit aea12f
the checked certificate's serial number are required. There are two
Packit aea12f
interfaces available for setting those in an OCSP request.
Packit aea12f
The is a low-level function when you have the
Packit aea12f
issuer name hash, issuer key hash, and certificate serial number in
Packit aea12f
binary form.  The second is more useful if you have the
Packit aea12f
certificate (and its issuer) in a @code{gnutls_x509_crt_t} type.
Packit aea12f
There is also a function to extract this information from existing an OCSP
Packit aea12f
request.
Packit aea12f
Packit aea12f
@showfuncC{gnutls_ocsp_req_add_cert_id,gnutls_ocsp_req_add_cert,gnutls_ocsp_req_get_cert_id}
Packit aea12f
Packit aea12f
Each OCSP request may contain a number of extensions.  Extensions are
Packit aea12f
identified by an Object Identifier (OID) and an opaque data buffer
Packit aea12f
whose syntax and semantics is implied by the OID. You can extract or
Packit aea12f
set those extensions using the following functions.
Packit aea12f
Packit aea12f
@showfuncB{gnutls_ocsp_req_get_extension,gnutls_ocsp_req_set_extension}
Packit aea12f
Packit aea12f
A common OCSP Request extension is the nonce extension (OID
Packit aea12f
1.3.6.1.5.5.7.48.1.2), which is used to avoid replay attacks of
Packit aea12f
earlier recorded OCSP responses.  The nonce extension carries a value
Packit aea12f
that is intended to be sufficiently random and unique so that an
Packit aea12f
attacker will not be able to give a stale response for the same nonce.
Packit aea12f
Packit aea12f
@showfuncC{gnutls_ocsp_req_get_nonce,gnutls_ocsp_req_set_nonce,gnutls_ocsp_req_randomize_nonce}
Packit aea12f
Packit aea12f
The OCSP response structures is a complex structure. A simplified overview
Packit aea12f
of it is in @ref{tab:ocsp-response}. Note that a response may contain 
Packit aea12f
information on multiple certificates.
Packit aea12f
Packit aea12f
@float Table,tab:ocsp-response
Packit aea12f
@multitable @columnfractions .2 .7
Packit aea12f
Packit aea12f
@headitem Field @tab Description
Packit aea12f
Packit aea12f
@item version @tab
Packit aea12f
The OCSP response version number (typically 1).
Packit aea12f
Packit aea12f
@item responder ID @tab
Packit aea12f
An identifier of the responder (DN name or a hash of its key).
Packit aea12f
Packit aea12f
@item issue time @tab
Packit aea12f
The time the response was generated.
Packit aea12f
Packit aea12f
@item thisUpdate @tab
Packit aea12f
The issuing time of the revocation information.
Packit aea12f
Packit aea12f
@item nextUpdate @tab
Packit aea12f
The issuing time of the revocation information that will update that one.
Packit aea12f
Packit aea12f
@item @tab Revoked certificates
Packit aea12f
Packit aea12f
@item certificate status @tab
Packit aea12f
The status of the certificate.
Packit aea12f
Packit aea12f
@item certificate serial @tab
Packit aea12f
The certificate's serial number.
Packit aea12f
Packit aea12f
@item revocationTime @tab
Packit aea12f
The time the certificate was revoked.
Packit aea12f
Packit aea12f
@item revocationReason @tab
Packit aea12f
The reason the certificate was revoked.
Packit aea12f
Packit aea12f
@end multitable
Packit aea12f
@caption{The most important OCSP response fields.}
Packit aea12f
@end float
Packit aea12f
Packit aea12f
Packit aea12f
We provide basic functions for initialization, importing, exporting
Packit aea12f
and deallocating OCSP responses.  
Packit aea12f
Packit aea12f
@showfuncE{gnutls_ocsp_resp_init,gnutls_ocsp_resp_deinit,gnutls_ocsp_resp_import,gnutls_ocsp_resp_export,gnutls_ocsp_resp_print}
Packit aea12f
Packit aea12f
The utility function that extracts the revocation as well as other information
Packit aea12f
from a response is shown below.
Packit aea12f
Packit aea12f
@showfuncdesc{gnutls_ocsp_resp_get_single}
Packit aea12f
Packit aea12f
The possible revocation reasons available in an OCSP response are shown
Packit aea12f
below.
Packit aea12f
Packit aea12f
@showenumdesc{gnutls_x509_crl_reason_t,The revocation reasons}
Packit aea12f
Packit aea12f
Note, that the OCSP response needs to be verified against some set of trust
Packit aea12f
anchors before it can be relied upon. It is also important to check
Packit aea12f
whether the received OCSP response corresponds to the certificate being checked.
Packit aea12f
Packit aea12f
@showfuncC{gnutls_ocsp_resp_verify,gnutls_ocsp_resp_verify_direct,gnutls_ocsp_resp_check_crt}
Packit aea12f
Packit aea12f
@node OCSP stapling
Packit aea12f
@subsection OCSP stapling
Packit aea12f
@cindex certificate status
Packit aea12f
@cindex Online Certificate Status Protocol
Packit aea12f
@cindex OCSP stapling
Packit aea12f
Packit aea12f
To avoid applications contacting the OCSP server directly, TLS servers
Packit aea12f
can provide a "stapled" OCSP response in the TLS handshake. That way
Packit aea12f
the client application needs to do nothing more. GnuTLS will automatically
Packit aea12f
consider the stapled OCSP response during the TLS certificate verification
Packit aea12f
(see @funcref{gnutls_certificate_verify_peers2}). To disable the automatic
Packit aea12f
OCSP verification the flag @code{GNUTLS_VERIFY_DISABLE_CRL_CHECKS} should be
Packit aea12f
specified to @funcref{gnutls_certificate_set_verify_flags}.
Packit aea12f
Packit aea12f
Since GnuTLS 3.5.1 the client certificate verification will consider the @xcite{RFC7633}
Packit aea12f
OCSP-Must-staple certificate extension, and will consider it while checking for stapled
Packit aea12f
OCSP responses. If the extension is present and no OCSP staple is found, the certificate
Packit aea12f
verification will fail and the status code @code{GNUTLS_CERT_MISSING_OCSP_STATUS} will
Packit aea12f
returned from the verification function.
Packit aea12f
Packit aea12f
Under TLS 1.2 only one stapled response can be sent by a server, the OCSP
Packit aea12f
response associated with the end-certificate. Under TLS 1.3 a server can
Packit aea12f
send multiple OCSP responses, typically one for each certificate in the
Packit aea12f
certificate chain. The following functions can be used by a client
Packit aea12f
application to retrieve the OCSP responses as sent by the server.
Packit aea12f
Packit aea12f
@showfuncB{gnutls_ocsp_status_request_get,gnutls_ocsp_status_request_get2}
Packit aea12f
Packit aea12f
GnuTLS servers can provide OCSP responses to their clients using the following functions.
Packit aea12f
Packit aea12f
@showfuncC{gnutls_certificate_set_retrieve_function3,gnutls_certificate_set_ocsp_status_request_file2,gnutls_ocsp_status_request_is_checked}
Packit aea12f
Packit aea12f
A server is expected to provide the relevant certificate's OCSP responses using
Packit aea12f
@funcref{gnutls_certificate_set_ocsp_status_request_file2}, and ensure a
Packit aea12f
periodic reload/renew of the credentials. An estimation of the OCSP responses
Packit aea12f
expiration can be obtained using the @funcref{gnutls_certificate_get_ocsp_expiration} function.
Packit aea12f
Packit aea12f
@showfuncdesc{gnutls_certificate_get_ocsp_expiration}
Packit aea12f
Packit aea12f
Prior to GnuTLS 3.6.4, the functions
Packit aea12f
@funcref{gnutls_certificate_set_ocsp_status_request_function2}
Packit aea12f
@funcref{gnutls_certificate_set_ocsp_status_request_file} were provided
Packit aea12f
to set OCSP responses. These functions are still functional, but cannot be used
Packit aea12f
to set multiple OCSP responses as allowed by TLS1.3.
Packit aea12f
Packit aea12f
The responses can be updated periodically using the 'ocsptool' command
Packit aea12f
(see also @ref{ocsptool Invocation}).
Packit aea12f
Packit aea12f
@example
Packit aea12f
ocsptool --ask --load-cert server_cert.pem --load-issuer the_issuer.pem
Packit aea12f
         --load-signer the_issuer.pem --outfile ocsp.resp
Packit aea12f
@end example
Packit aea12f
Packit aea12f
In order to allow multiple OCSP responses to be concatenated, GnuTLS
Packit aea12f
supports PEM-encoded OCSP responses. These can be generated using
Packit aea12f
'ocsptool' with the '--no-outder' parameter.
Packit aea12f
Packit aea12f
Packit aea12f
@node Managing encrypted keys
Packit aea12f
@subsection Managing encrypted keys
Packit aea12f
@cindex Encrypted keys
Packit aea12f
Packit aea12f
Transferring or storing private keys in plain may not be a
Packit aea12f
good idea, since any compromise is irreparable.
Packit aea12f
Storing the keys in hardware security modules (see @ref{Smart cards and HSMs})
Packit aea12f
could solve the storage problem but it is not always practical
Packit aea12f
or efficient enough. This section describes ways to store and
Packit aea12f
transfer encrypted private keys.
Packit aea12f
Packit aea12f
There are methods for key encryption, namely the
Packit aea12f
PKCS #8, PKCS #12 and OpenSSL's custom encrypted private key formats. 
Packit aea12f
The PKCS #8 and the OpenSSL's method allow encryption of the private key, 
Packit aea12f
while the PKCS #12 method allows, in addition, the bundling of accompanying 
Packit aea12f
data into the structure. That is typically the corresponding certificate, as 
Packit aea12f
well as a trusted CA certificate.
Packit aea12f
Packit aea12f
@subsubheading High level functionality
Packit aea12f
Generic and higher level private key import functions are available, that
Packit aea12f
import plain or encrypted keys and will auto-detect the encrypted key format.
Packit aea12f
Packit aea12f
@showfuncdesc{gnutls_privkey_import_x509_raw}
Packit aea12f
Packit aea12f
@showfuncdesc{gnutls_x509_privkey_import2}
Packit aea12f
Packit aea12f
Any keys imported using those functions can be imported to a certificate
Packit aea12f
credentials structure using @funcref{gnutls_certificate_set_key}, or alternatively
Packit aea12f
they can be directly imported using @funcref{gnutls_certificate_set_x509_key_file2}.
Packit aea12f
Packit aea12f
@subsubheading @acronym{PKCS} #8 structures
Packit aea12f
@cindex PKCS #8
Packit aea12f
Packit aea12f
PKCS #8 keys can be imported and exported as normal private keys using
Packit aea12f
the functions below. An addition to the normal import functions, are
Packit aea12f
a password and a flags argument. The flags can be any element of the @code{gnutls_pkcs_encrypt_flags_t}
Packit aea12f
enumeration. Note however, that GnuTLS only supports the PKCS #5 PBES2
Packit aea12f
encryption scheme. Keys encrypted with the obsolete PBES1 scheme cannot 
Packit aea12f
be decrypted.
Packit aea12f
Packit aea12f
@showfuncC{gnutls_x509_privkey_import_pkcs8,gnutls_x509_privkey_export_pkcs8,gnutls_x509_privkey_export2_pkcs8}
Packit aea12f
Packit aea12f
@showenumdesc{gnutls_pkcs_encrypt_flags_t,Encryption flags}
Packit aea12f
Packit aea12f
@subsubheading @acronym{PKCS} #12 structures
Packit aea12f
@cindex PKCS #12
Packit aea12f
Packit aea12f
A @acronym{PKCS} #12 structure @xcite{PKCS12} usually contains a user's
Packit aea12f
private keys and certificates. It is commonly used in browsers to
Packit aea12f
export and import the user's identities. A file containing such a key can 
Packit aea12f
be directly imported to a certificate credentials structure by using 
Packit aea12f
@funcref{gnutls_certificate_set_x509_simple_pkcs12_file}.
Packit aea12f
Packit aea12f
In @acronym{GnuTLS} the @acronym{PKCS} #12 structures are handled
Packit aea12f
using the @code{gnutls_pkcs12_t} type. This is an abstract type that
Packit aea12f
may hold several @code{gnutls_pkcs12_bag_t} types.  The bag types are
Packit aea12f
the holders of the actual data, which may be certificates, private
Packit aea12f
keys or encrypted data.  A bag of type encrypted should be decrypted
Packit aea12f
in order for its data to be accessed.
Packit aea12f
Packit aea12f
To reduce the complexity in parsing the structures the simple 
Packit aea12f
helper function @funcref{gnutls_pkcs12_simple_parse} is provided. For more
Packit aea12f
advanced uses, manual parsing of the structure is required using the
Packit aea12f
functions below.
Packit aea12f
Packit aea12f
@showfuncD{gnutls_pkcs12_get_bag,gnutls_pkcs12_verify_mac,gnutls_pkcs12_bag_decrypt,gnutls_pkcs12_bag_get_count}
Packit aea12f
Packit aea12f
@showfuncdesc{gnutls_pkcs12_simple_parse}
Packit aea12f
@showfuncC{gnutls_pkcs12_bag_get_data,gnutls_pkcs12_bag_get_key_id,gnutls_pkcs12_bag_get_friendly_name}
Packit aea12f
Packit aea12f
The functions below are used to generate a PKCS #12 structure. An example
Packit aea12f
of their usage is shown at @ref{PKCS12 structure generation example}.
Packit aea12f
Packit aea12f
@showfuncC{gnutls_pkcs12_set_bag,gnutls_pkcs12_bag_encrypt,gnutls_pkcs12_generate_mac}
Packit aea12f
@showfuncE{gnutls_pkcs12_bag_set_data,gnutls_pkcs12_bag_set_crl,gnutls_pkcs12_bag_set_crt,gnutls_pkcs12_bag_set_key_id,gnutls_pkcs12_bag_set_friendly_name}
Packit aea12f
Packit aea12f
@subsubheading OpenSSL encrypted keys
Packit aea12f
@cindex OpenSSL encrypted keys
Packit aea12f
Unfortunately the structures discussed in the previous sections are
Packit aea12f
not the only structures that may hold an encrypted private key. For example
Packit aea12f
the OpenSSL library offers a custom key encryption method. Those structures
Packit aea12f
are also supported in GnuTLS with @funcref{gnutls_x509_privkey_import_openssl}.
Packit aea12f
Packit aea12f
@showfuncdesc{gnutls_x509_privkey_import_openssl}
Packit aea12f
Packit aea12f
@include invoke-certtool.texi
Packit aea12f
Packit aea12f
@include invoke-ocsptool.texi
Packit aea12f
Packit aea12f
@include invoke-danetool.texi