forked from wolfSSL/wolfssl
add wolfSSL_get_ocsp_producedDate().
This commit is contained in:
@ -3007,6 +3007,16 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
|
||||
|
||||
showPeerEx(ssl, lng_index);
|
||||
|
||||
#ifdef HAVE_OCSP
|
||||
{
|
||||
struct tm tm;
|
||||
char date[32];
|
||||
ret = wolfSSL_get_ocsp_producedDate(ssl, &tm);
|
||||
if ((ret == 0) && (strftime(date, sizeof date, "%Y-%m-%d %H:%M:%S %z",&tm) > 0))
|
||||
printf("OCSP response timestamp: %s\n",date);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef OPENSSL_EXTRA
|
||||
printf("Session timeout set to %ld seconds\n", wolfSSL_get_timeout(ssl));
|
||||
{
|
||||
|
@ -9857,6 +9857,11 @@ static int ProcessCSR(WOLFSSL* ssl, byte* input, word32* inOutIdx,
|
||||
else if (response->status->status != CERT_GOOD)
|
||||
ret = BAD_CERTIFICATE_STATUS_ERROR;
|
||||
|
||||
else {
|
||||
XMEMCPY(ssl->ocspProducedDate, response->producedDate, sizeof ssl->ocspProducedDate);
|
||||
ssl->ocspProducedDateFormat = response->producedDateFormat;
|
||||
}
|
||||
|
||||
*inOutIdx += status_length;
|
||||
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
|
18
src/ssl.c
18
src/ssl.c
@ -44134,6 +44134,24 @@ int wolfSSL_set_ocsp_url(WOLFSSL* ssl, char* url)
|
||||
#endif /* OCSP */
|
||||
#endif /* OPENSSL_ALL || WOLFSSL_NGINX || WOLFSSL_HAPROXY */
|
||||
|
||||
#ifdef HAVE_OCSP
|
||||
int wolfSSL_get_ocsp_producedDate(WOLFSSL *ssl, struct tm *producedTime) {
|
||||
int idx = 0;
|
||||
|
||||
if ((producedTime == NULL) || (ssl->ocspProducedDate == NULL))
|
||||
return BAD_FUNC_ARG;
|
||||
if ((ssl->ocspProducedDateFormat != ASN_UTC_TIME) &&
|
||||
(ssl->ocspProducedDateFormat != ASN_GENERALIZED_TIME))
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
if (ExtractDate(ssl->ocspProducedDate, ssl->ocspProducedDateFormat, producedTime, &idx))
|
||||
return 0;
|
||||
else
|
||||
return ASN_PARSE_E;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY) || \
|
||||
defined(OPENSSL_EXTRA) || defined(OPENSSL_ALL)
|
||||
int wolfSSL_CTX_get_extra_chain_certs(WOLFSSL_CTX* ctx, WOLF_STACK_OF(X509)** chain)
|
||||
|
@ -4167,6 +4167,8 @@ struct WOLFSSL {
|
||||
#endif /* HAVE_TLS_EXTENSIONS */
|
||||
#ifdef HAVE_OCSP
|
||||
void* ocspIOCtx;
|
||||
byte ocspProducedDate[MAX_DATE_SZ];
|
||||
int ocspProducedDateFormat;
|
||||
#ifdef OPENSSL_EXTRA
|
||||
byte* ocspResp;
|
||||
int ocspRespSz;
|
||||
|
@ -3791,6 +3791,10 @@ WOLFSSL_API int wolfSSL_CTX_set_tlsext_ticket_key_cb(WOLFSSL_CTX *, int (*)(
|
||||
WOLFSSL_EVP_CIPHER_CTX *ectx, WOLFSSL_HMAC_CTX *hctx, int enc));
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_OCSP
|
||||
WOLFSSL_API int wolfSSL_get_ocsp_producedDate(WOLFSSL *ssl, struct tm *producedTime);
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_OCSP) || defined(OPENSSL_EXTRA) || defined(OPENSSL_ALL) || \
|
||||
defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY)
|
||||
WOLFSSL_API int wolfSSL_CTX_get_extra_chain_certs(WOLFSSL_CTX* ctx,
|
||||
|
Reference in New Issue
Block a user