mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-10-01 04:03:18 +03:00
more dce
This commit is contained in:
1 parent
8fa092106e
commit
cf9ed7910a
10 files changed
-1023
No files matched your search
@@ -361,153 +361,6 @@ void MHD_gtls_certificate_server_set_retrieve_function
|
||||
cred->server_get_cert_callback = func;
|
||||
}
|
||||
|
||||
/*-
|
||||
* MHD__gnutls_x509_extract_certificate_activation_time - This function returns the peer's certificate activation time
|
||||
* @cert: should contain an X.509 DER encoded certificate
|
||||
*
|
||||
* This function will return the certificate's activation time in UNIX time
|
||||
* (ie seconds since 00:00:00 UTC January 1, 1970).
|
||||
*
|
||||
* Returns a (time_t) -1 in case of an error.
|
||||
*
|
||||
-*/
|
||||
static time_t
|
||||
MHD__gnutls_x509_get_raw_crt_activation_time (const MHD_gnutls_datum_t * cert)
|
||||
{
|
||||
MHD_gnutls_x509_crt_t xcert;
|
||||
time_t result;
|
||||
|
||||
result = MHD_gnutls_x509_crt_init (&xcert);
|
||||
if (result < 0)
|
||||
return (time_t) - 1;
|
||||
|
||||
result = MHD_gnutls_x509_crt_import (xcert, cert, GNUTLS_X509_FMT_DER);
|
||||
if (result < 0)
|
||||
{
|
||||
MHD_gnutls_x509_crt_deinit (xcert);
|
||||
return (time_t) - 1;
|
||||
}
|
||||
|
||||
result = MHD_gnutls_x509_crt_get_activation_time (xcert);
|
||||
|
||||
MHD_gnutls_x509_crt_deinit (xcert);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*-
|
||||
* MHD_gnutls_x509_extract_certificate_expiration_time - This function returns the certificate's expiration time
|
||||
* @cert: should contain an X.509 DER encoded certificate
|
||||
*
|
||||
* This function will return the certificate's expiration time in UNIX
|
||||
* time (ie seconds since 00:00:00 UTC January 1, 1970). Returns a
|
||||
*
|
||||
* (time_t) -1 in case of an error.
|
||||
*
|
||||
-*/
|
||||
static time_t
|
||||
MHD__gnutls_x509_get_raw_crt_expiration_time (const MHD_gnutls_datum_t * cert)
|
||||
{
|
||||
MHD_gnutls_x509_crt_t xcert;
|
||||
time_t result;
|
||||
|
||||
result = MHD_gnutls_x509_crt_init (&xcert);
|
||||
if (result < 0)
|
||||
return (time_t) - 1;
|
||||
|
||||
result = MHD_gnutls_x509_crt_import (xcert, cert, GNUTLS_X509_FMT_DER);
|
||||
if (result < 0)
|
||||
{
|
||||
MHD_gnutls_x509_crt_deinit (xcert);
|
||||
return (time_t) - 1;
|
||||
}
|
||||
|
||||
result = MHD_gnutls_x509_crt_get_expiration_time (xcert);
|
||||
|
||||
MHD_gnutls_x509_crt_deinit (xcert);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* MHD_gtls_certificate_expiration_time_peers - This function returns the peer's certificate expiration time
|
||||
* @session: is a gnutls session
|
||||
*
|
||||
* This function will return the peer's certificate expiration time.
|
||||
*
|
||||
* Returns: (time_t)-1 on error.
|
||||
**/
|
||||
time_t
|
||||
MHD_gtls_certificate_expiration_time_peers (MHD_gtls_session_t session)
|
||||
{
|
||||
cert_auth_info_t info;
|
||||
|
||||
CHECK_AUTH (MHD_GNUTLS_CRD_CERTIFICATE, GNUTLS_E_INVALID_REQUEST);
|
||||
|
||||
info = MHD_gtls_get_auth_info (session);
|
||||
if (info == NULL)
|
||||
{
|
||||
return (time_t) - 1;
|
||||
}
|
||||
|
||||
if (info->raw_certificate_list == NULL || info->ncerts == 0)
|
||||
{
|
||||
MHD_gnutls_assert ();
|
||||
return (time_t) - 1;
|
||||
}
|
||||
|
||||
switch (MHD_gnutls_certificate_type_get (session))
|
||||
{
|
||||
case MHD_GNUTLS_CRT_X509:
|
||||
return
|
||||
MHD__gnutls_x509_get_raw_crt_expiration_time (&info->
|
||||
raw_certificate_list
|
||||
[0]);
|
||||
default:
|
||||
return (time_t) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* MHD_gtls_certificate_activation_time_peers - This function returns the peer's certificate activation time
|
||||
* @session: is a gnutls session
|
||||
*
|
||||
* This function will return the peer's certificate activation time.
|
||||
* This is the creation time for openpgp keys.
|
||||
*
|
||||
* Returns: (time_t)-1 on error.
|
||||
**/
|
||||
time_t
|
||||
MHD_gtls_certificate_activation_time_peers (MHD_gtls_session_t session)
|
||||
{
|
||||
cert_auth_info_t info;
|
||||
|
||||
CHECK_AUTH (MHD_GNUTLS_CRD_CERTIFICATE, GNUTLS_E_INVALID_REQUEST);
|
||||
|
||||
info = MHD_gtls_get_auth_info (session);
|
||||
if (info == NULL)
|
||||
{
|
||||
return (time_t) - 1;
|
||||
}
|
||||
|
||||
if (info->raw_certificate_list == NULL || info->ncerts == 0)
|
||||
{
|
||||
MHD_gnutls_assert ();
|
||||
return (time_t) - 1;
|
||||
}
|
||||
|
||||
switch (MHD_gnutls_certificate_type_get (session))
|
||||
{
|
||||
case MHD_GNUTLS_CRT_X509:
|
||||
return
|
||||
MHD__gnutls_x509_get_raw_crt_activation_time (&info->
|
||||
raw_certificate_list
|
||||
[0]);
|
||||
default:
|
||||
return (time_t) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
MHD_gtls_raw_cert_to_gcert (MHD_gnutls_cert * gcert,
|
||||
enum MHD_GNUTLS_CertificateType type,
|
||||
|
||||
Reference in new issue
Block a user