FreeRDP
x509_utils.c File Reference
#include <openssl/objects.h>
#include <openssl/x509v3.h>
#include <openssl/pem.h>
#include <openssl/err.h>
#include <freerdp/config.h>
#include <winpr/crt.h>
#include <winpr/string.h>
#include <winpr/assert.h>
#include <freerdp/log.h>
#include "x509_utils.h"

Macros

#define TAG   FREERDP_TAG("crypto")
 
#define GEN_ALL   (-1)
 

Typedefs

typedef int(* general_name_mapper_pr) (GENERAL_NAME *name, void *data, int index, int count)
 

Functions

BYTEx509_utils_get_hash (const X509 *xcert, const char *hash, size_t *length)
 
static char * crypto_print_name (const X509_NAME *name)
 
char * x509_utils_get_subject (const X509 *xcert)
 
static const char * general_name_type_label (int general_name_type)
 
static void map_subject_alt_name (const X509 *x509, int general_name_type, general_name_mapper_pr mapper, void *data)
 
static void string_list_initialize (string_list *list)
 
static void string_list_allocate (string_list *list, int allocate_count)
 
static void string_list_free (string_list *list)
 
static int extract_string (GENERAL_NAME *name, void *data, int index, int count)
 
static void object_list_initialize (object_list *list)
 
static void object_list_allocate (object_list *list, int allocate_count)
 
static char * object_string (ASN1_TYPE *object)
 
static void object_list_free (object_list *list)
 
static int extract_othername_object_as_string (GENERAL_NAME *name, void *data, int index, int count)
 
char * x509_utils_get_email (const X509 *x509)
 
char * x509_utils_get_upn (const X509 *x509)
 
char * x509_utils_get_date (const X509 *x509, BOOL startDate)
 
void x509_utils_dns_names_free (size_t count, size_t *lengths, char **dns_names)
 
char ** x509_utils_get_dns_names (const X509 *x509, size_t *count, size_t **lengths)
 
char * x509_utils_get_issuer (const X509 *xcert)
 
BOOL x509_utils_check_eku (const X509 *xcert, int nid)
 
void x509_utils_print_info (const X509 *xcert)
 
static BYTEx509_utils_get_pem (const X509 *xcert, const STACK_OF(X509) *chain, size_t *plength)
 
X509 * x509_utils_from_pem (const char *data, size_t len, BOOL fromFile)
 
static WINPR_MD_TYPE hash_nid_to_winpr (int hash_nid)
 
static WINPR_MD_TYPE get_rsa_pss_digest (const X509_ALGOR *alg)
 
WINPR_MD_TYPE x509_utils_get_signature_alg (const X509 *xcert)
 
char * x509_utils_get_common_name (const X509 *xcert, size_t *plength)
 
static int verify_cb (int ok, X509_STORE_CTX *csc)
 
BOOL x509_utils_verify (X509 *xcert, STACK_OF(X509) *chain, const char *certificate_store_path)
 

Variables

static const char * general_name_type_labels []
 

Macro Definition Documentation

◆ GEN_ALL

#define GEN_ALL   (-1)

◆ TAG

#define TAG   FREERDP_TAG("crypto")

FreeRDP: A Remote Desktop Protocol Implementation Cryptographic Abstraction Layer

Copyright 2011-2012 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2023 Armin Novak anova.nosp@m.k@th.nosp@m.incas.nosp@m.t.co.nosp@m.m Copyright 2023 Thincast Technologies GmbH

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

  http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Typedef Documentation

◆ general_name_mapper_pr

typedef int(* general_name_mapper_pr) (GENERAL_NAME *name, void *data, int index, int count)

Function Documentation

◆ crypto_print_name()

static char* crypto_print_name ( const X509_NAME *  name)
static
Here is the caller graph for this function:

◆ extract_othername_object_as_string()

static int extract_othername_object_as_string ( GENERAL_NAME *  name,
void *  data,
int  index,
int  count 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ extract_string()

static int extract_string ( GENERAL_NAME *  name,
void *  data,
int  index,
int  count 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ general_name_type_label()

static const char* general_name_type_label ( int  general_name_type)
static
Here is the caller graph for this function:

◆ get_rsa_pss_digest()

static WINPR_MD_TYPE get_rsa_pss_digest ( const X509_ALGOR *  alg)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hash_nid_to_winpr()

static WINPR_MD_TYPE hash_nid_to_winpr ( int  hash_nid)
static
Here is the caller graph for this function:

◆ map_subject_alt_name()

static void map_subject_alt_name ( const X509 *  x509,
int  general_name_type,
general_name_mapper_pr  mapper,
void *  data 
)
static
Here is the caller graph for this function:

◆ object_list_allocate()

static void object_list_allocate ( object_list *  list,
int  allocate_count 
)
static
Here is the caller graph for this function:

◆ object_list_free()

static void object_list_free ( object_list *  list)
static
Here is the caller graph for this function:

◆ object_list_initialize()

static void object_list_initialize ( object_list *  list)
static
Here is the caller graph for this function:

◆ object_string()

static char* object_string ( ASN1_TYPE *  object)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ string_list_allocate()

static void string_list_allocate ( string_list *  list,
int  allocate_count 
)
static
Here is the caller graph for this function:

◆ string_list_free()

static void string_list_free ( string_list *  list)
static
Here is the caller graph for this function:

◆ string_list_initialize()

static void string_list_initialize ( string_list *  list)
static
Here is the caller graph for this function:

◆ verify_cb()

static int verify_cb ( int  ok,
X509_STORE_CTX *  csc 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ x509_utils_check_eku()

BOOL x509_utils_check_eku ( const X509 *  xcert,
int  nid 
)
Here is the caller graph for this function:

◆ x509_utils_dns_names_free()

void x509_utils_dns_names_free ( size_t  count,
size_t *  lengths,
char **  dns_names 
)
Here is the caller graph for this function:

◆ x509_utils_from_pem()

X509* x509_utils_from_pem ( const char *  data,
size_t  len,
BOOL  fromFile 
)
Here is the caller graph for this function:

◆ x509_utils_get_common_name()

char* x509_utils_get_common_name ( const X509 *  xcert,
size_t *  plength 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ x509_utils_get_date()

char* x509_utils_get_date ( const X509 *  x509,
BOOL  startDate 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ x509_utils_get_dns_names()

char** x509_utils_get_dns_names ( const X509 *  x509,
size_t *  count,
size_t **  lengths 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ x509_utils_get_email()

char* x509_utils_get_email ( const X509 *  x509)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ x509_utils_get_hash()

BYTE* x509_utils_get_hash ( const X509 *  xcert,
const char *  hash,
size_t *  length 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ x509_utils_get_issuer()

char* x509_utils_get_issuer ( const X509 *  xcert)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ x509_utils_get_pem()

static BYTE* x509_utils_get_pem ( const X509 *  xcert,
const STACK_OF(X509) *  chain,
size_t *  plength 
)
static

Don't manage certificates internally, leave it up entirely to the external client implementation

◆ x509_utils_get_signature_alg()

WINPR_MD_TYPE x509_utils_get_signature_alg ( const X509 *  xcert)

FreeRDP: A Remote Desktop Protocol Implementation Cryptographic Abstraction Layer

Copyright 2011-2012 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com Copyright 2023 Armin Novak anova.nosp@m.k@th.nosp@m.incas.nosp@m.t.co.nosp@m.m Copyright 2023 Thincast Technologies GmbH

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ x509_utils_get_subject()

char* x509_utils_get_subject ( const X509 *  xcert)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ x509_utils_get_upn()

char* x509_utils_get_upn ( const X509 *  x509)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ x509_utils_print_info()

void x509_utils_print_info ( const X509 *  xcert)
Here is the call graph for this function:

◆ x509_utils_verify()

BOOL x509_utils_verify ( X509 *  xcert,
STACK_OF(X509) *  chain,
const char *  certificate_store_path 
)
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ general_name_type_labels

const char* general_name_type_labels[]
static
Initial value:
= { "OTHERNAME", "EMAIL ", "DNS ",
"X400 ", "DIRNAME ", "EDIPARTY ",
"URI ", "IPADD ", "RID " }