IoTivity-Lite
oc_certs.h File Reference
#include "oc_export.h"
#include "mbedtls/build_info.h"
#include "mbedtls/ecp.h"
#include "mbedtls/md.h"
#include "mbedtls/x509_crt.h"
#include <stdbool.h>

Macros

#define OCF_CERTS_SUPPORTED_ELLIPTIC_CURVES
 
#define OCF_CERTS_SUPPORTED_MDS
 

Functions

mbedtls_ecp_group_id oc_sec_certs_ecp_group_id (void)
 Get elliptic curve to be used when generating keys for CSRs or certificates. More...
 
bool oc_sec_certs_ecp_group_id_is_allowed (mbedtls_ecp_group_id gid)
 Check if the elliptic curve is allowed globally by IoTivity-lite. More...
 
unsigned oc_sec_certs_ecp_group_ids_allowed (void)
 Return bitmask of globally allowed elliptic curves. More...
 
void oc_sec_certs_ecp_set_group_id (mbedtls_ecp_group_id gid)
 Set elliptic curve to be used when generating keys for CSRs or certificates. More...
 
void oc_sec_certs_ecp_set_group_ids_allowed (unsigned gid_mask)
 Set the bitmask of globally allowed elliptic curves. More...
 
bool oc_sec_certs_md_algorithm_is_allowed (mbedtls_md_type_t md)
 Check if the message digest is allowed globally by IoTivity-lite. More...
 
unsigned oc_sec_certs_md_algorithms_allowed (void)
 Return bitmask of globally allowed message digest types. More...
 
void oc_sec_certs_md_set_algorithms_allowed (unsigned md_mask)
 Set the bitmask of globally allowed message digest types. More...
 
void oc_sec_certs_md_set_signature_algorithm (mbedtls_md_type_t md)
 Set message digest to use when generating certificates or certificate signing requests. More...
 
mbedtls_md_type_t oc_sec_certs_md_signature_algorithm (void)
 Get message digest to use when generating certificates or certificate signing requests. More...
 

Macro Definition Documentation

◆ OCF_CERTS_SUPPORTED_ELLIPTIC_CURVES

#define OCF_CERTS_SUPPORTED_ELLIPTIC_CURVES
Value:
(MBEDTLS_X509_ID_FLAG(MBEDTLS_ECP_DP_SECP256R1) | \
MBEDTLS_X509_ID_FLAG(MBEDTLS_ECP_DP_SECP384R1))

◆ OCF_CERTS_SUPPORTED_MDS

#define OCF_CERTS_SUPPORTED_MDS
Value:
(MBEDTLS_X509_ID_FLAG(MBEDTLS_MD_SHA256) | \
MBEDTLS_X509_ID_FLAG(MBEDTLS_MD_SHA384))

Function Documentation

◆ oc_sec_certs_ecp_group_id()

mbedtls_ecp_group_id oc_sec_certs_ecp_group_id ( void  )

Get elliptic curve to be used when generating keys for CSRs or certificates.

Returns
group identifier of the curve used in signatures

◆ oc_sec_certs_ecp_group_id_is_allowed()

bool oc_sec_certs_ecp_group_id_is_allowed ( mbedtls_ecp_group_id  gid)

Check if the elliptic curve is allowed globally by IoTivity-lite.

Parameters
gidgroup id of the elliptic curve to check
Returns
true elliptic curve is allowed
false elliptic curve is not allowed
See also
oc_sec_certs_ecp_set_group_ids_allowed

◆ oc_sec_certs_ecp_group_ids_allowed()

unsigned oc_sec_certs_ecp_group_ids_allowed ( void  )

Return bitmask of globally allowed elliptic curves.

Returns
bitmask of globally allowed elliptic curve groupids
See also
oc_sec_certs_ecp_set_group_ids_allowed

◆ oc_sec_certs_ecp_set_group_id()

void oc_sec_certs_ecp_set_group_id ( mbedtls_ecp_group_id  gid)

Set elliptic curve to be used when generating keys for CSRs or certificates.

Parameters
gidgroup identifier of the curve to be used

◆ oc_sec_certs_ecp_set_group_ids_allowed()

void oc_sec_certs_ecp_set_group_ids_allowed ( unsigned  gid_mask)

Set the bitmask of globally allowed elliptic curves.

Parameters
gid_maskbitmask of globally allowed elliptic curve groupids

◆ oc_sec_certs_md_algorithm_is_allowed()

bool oc_sec_certs_md_algorithm_is_allowed ( mbedtls_md_type_t  md)

Check if the message digest is allowed globally by IoTivity-lite.

Parameters
mdmessage digest to check
Returns
true md is allowed
false md is not allowed
See also
oc_sec_certs_md_set_algorithms_allowed

◆ oc_sec_certs_md_algorithms_allowed()

unsigned oc_sec_certs_md_algorithms_allowed ( void  )

Return bitmask of globally allowed message digest types.

Returns
bitmask of globally allowed message digest types
See also
oc_sec_certs_md_set_algorithms_allowed

◆ oc_sec_certs_md_set_algorithms_allowed()

void oc_sec_certs_md_set_algorithms_allowed ( unsigned  md_mask)

Set the bitmask of globally allowed message digest types.

Parameters
md_maskbitmask of globally allowed message digest types

◆ oc_sec_certs_md_set_signature_algorithm()

void oc_sec_certs_md_set_signature_algorithm ( mbedtls_md_type_t  md)

Set message digest to use when generating certificates or certificate signing requests.

Parameters
mdmessage digest to use in signatures

◆ oc_sec_certs_md_signature_algorithm()

mbedtls_md_type_t oc_sec_certs_md_signature_algorithm ( void  )

Get message digest to use when generating certificates or certificate signing requests.

Returns
message digest to use in signatures