Lines Matching refs:x509
98 lws_tls_mbedtls_cert_info(mbedtls_x509_crt *x509, enum lws_tls_cert_info type, in lws_tls_mbedtls_cert_info() argument
104 if (!x509) in lws_tls_mbedtls_cert_info()
112 buf->time = lws_tls_mbedtls_time_to_unix(&x509->MBEDTLS_PRIVATE(valid_from)); in lws_tls_mbedtls_cert_info()
118 buf->time = lws_tls_mbedtls_time_to_unix(&x509->MBEDTLS_PRIVATE(valid_to)); in lws_tls_mbedtls_cert_info()
124 return lws_tls_mbedtls_get_x509_name(&x509->MBEDTLS_PRIVATE(subject), buf, len); in lws_tls_mbedtls_cert_info()
127 return lws_tls_mbedtls_get_x509_name(&x509->MBEDTLS_PRIVATE(issuer), buf, len); in lws_tls_mbedtls_cert_info()
130 buf->usage = x509->MBEDTLS_PRIVATE(key_usage); in lws_tls_mbedtls_cert_info()
138 switch (mbedtls_pk_get_type(&x509->MBEDTLS_PRIVATE(pk))) { in lws_tls_mbedtls_cert_info()
141 mbedtls_rsa_context *rsa = mbedtls_pk_rsa(x509->MBEDTLS_PRIVATE(pk)); in lws_tls_mbedtls_cert_info()
156 mbedtls_ecp_keypair *ecp = mbedtls_pk_ec(x509->MBEDTLS_PRIVATE(pk)); in lws_tls_mbedtls_cert_info()
175 mbedtls_pk_get_type(&x509->MBEDTLS_PRIVATE(pk))); in lws_tls_mbedtls_cert_info()
183 buf->ns.len = (int)x509->MBEDTLS_PRIVATE(raw).MBEDTLS_PRIVATE(len); in lws_tls_mbedtls_cert_info()
185 if (len < x509->MBEDTLS_PRIVATE(raw).MBEDTLS_PRIVATE(len)) in lws_tls_mbedtls_cert_info()
192 memcpy(buf->ns.name, x509->MBEDTLS_PRIVATE(raw).MBEDTLS_PRIVATE(p), in lws_tls_mbedtls_cert_info()
193 x509->MBEDTLS_PRIVATE(raw).MBEDTLS_PRIVATE(len)); in lws_tls_mbedtls_cert_info()
201 lws_x509_get_crt_ext(x509, &skid, &akid); in lws_tls_mbedtls_cert_info()
217 lws_x509_get_crt_ext(x509, &skid, &akid); in lws_tls_mbedtls_cert_info()
243 lws_x509_get_crt_ext(x509, &skid, &akid); in lws_tls_mbedtls_cert_info()
260 lws_x509_get_crt_ext(x509, &skid, &akid); in lws_tls_mbedtls_cert_info()
281 mbedtls_x509_crt *x509; in lws_tls_vhost_cert_info() local
283 x509 = ssl_ctx_get_mbedtls_x509_crt(vhost->tls.ssl_ctx); in lws_tls_vhost_cert_info()
285 return lws_tls_mbedtls_cert_info(x509, type, buf, len); in lws_tls_vhost_cert_info()
292 mbedtls_x509_crt *x509; in lws_tls_peer_cert_info() local
296 x509 = ssl_get_peer_mbedtls_x509_crt(wsi->tls.ssl); in lws_tls_peer_cert_info()
298 if (!x509) in lws_tls_peer_cert_info()
306 return lws_tls_mbedtls_cert_info(x509, type, buf, len); in lws_tls_peer_cert_info()
314 lws_x509_info(struct lws_x509_cert *x509, enum lws_tls_cert_info type, in lws_x509_info() argument
317 return lws_tls_mbedtls_cert_info(&x509->cert, type, buf, len); in lws_x509_info()
321 lws_x509_create(struct lws_x509_cert **x509) in lws_x509_create() argument
323 *x509 = lws_malloc(sizeof(**x509), __func__); in lws_x509_create()
325 return !(*x509); in lws_x509_create()
334 lws_x509_parse_from_pem(struct lws_x509_cert *x509, const void *pem, size_t len) in lws_x509_parse_from_pem() argument
338 mbedtls_x509_crt_init(&x509->cert); in lws_x509_parse_from_pem()
340 ret = mbedtls_x509_crt_parse(&x509->cert, pem, len); in lws_x509_parse_from_pem()
343 mbedtls_x509_crt_free(&x509->cert); in lws_x509_parse_from_pem()
354 lws_x509_verify(struct lws_x509_cert *x509, struct lws_x509_cert *trusted, in lws_x509_verify() argument
360 ret = mbedtls_x509_crt_verify_with_profile(&x509->cert, &trusted->cert, in lws_x509_verify()
379 lws_x509_public_to_jwk(struct lws_jwk *jwk, struct lws_x509_cert *x509, in lws_x509_public_to_jwk() argument
382 int kt = (int)mbedtls_pk_get_type(&x509->cert.MBEDTLS_PRIVATE(pk)), in lws_x509_public_to_jwk()
394 rsactx = mbedtls_pk_rsa(x509->cert.MBEDTLS_PRIVATE(pk)); in lws_x509_public_to_jwk()
412 ecpctx = mbedtls_pk_ec(x509->cert.MBEDTLS_PRIVATE(pk)); in lws_x509_public_to_jwk()
531 lws_x509_destroy(struct lws_x509_cert **x509) in lws_x509_destroy() argument
533 if (!*x509) in lws_x509_destroy()
536 mbedtls_x509_crt_free(&(*x509)->cert); in lws_x509_destroy()
538 lws_free_set_NULL(*x509); in lws_x509_destroy()