credman.h File Reference

(D)TLS credentials management module definitions More...

Detailed Description

(D)TLS credentials management module definitions

Note
This module DOES NOT copy the credentials into the system. It just holds the pointers to the credentials given by the user. The user must make sure that these pointers are valid during the lifetime of the application.
Author
Aiman Ismail muham.nosp@m.mada.nosp@m.imanb.nosp@m.in.i.nosp@m.smail.nosp@m.@haw.nosp@m.-hamb.nosp@m.urg..nosp@m.de

Definition in file credman.h.

#include <unistd.h>
#include <stdint.h>
#include "kernel_defines.h"
+ Include dependency graph for credman.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  credman_buffer_t
 Buffer of the credential. More...
 
struct  psk_params_t
 PSK parameters. More...
 
struct  ecdsa_public_key_t
 ECDSA public keys. More...
 
struct  ecdsa_params_t
 ECDSA parameters. More...
 
struct  credman_credential_t
 Credential information. More...
 

Macros

#define CONFIG_CREDMAN_MAX_CREDENTIALS   (2)
 Maximum number of credentials in credential pool.
 
#define CONFIG_CREDMAN_MAX_ASN1_OBJ   (8)
 Maximum number of ASN.1 objects when decoding keys.
 
#define CREDMAN_TAG_EMPTY   (0)
 Used to signal empty/no tag.
 

Typedefs

typedef uint16_t credman_tag_t
 Tag of the credential.
 

Enumerations

enum  credman_type_t { CREDMAN_TYPE_EMPTY = 0 , CREDMAN_TYPE_PSK = 1 , CREDMAN_TYPE_ECDSA = 2 }
 Credential types. More...
 
enum  {
  CREDMAN_OK = 0 , CREDMAN_EXIST = -1 , CREDMAN_NO_SPACE = -2 , CREDMAN_NOT_FOUND = -3 ,
  CREDMAN_INVALID = -4 , CREDMAN_TYPE_UNKNOWN = -5 , CREDMAN_ERROR = -6
}
 Return values. More...
 

Functions

int credman_add (const credman_credential_t *credential)
 Adds a credential to the credential pool. More...
 
int credman_get (credman_credential_t *credential, credman_tag_t tag, credman_type_t type)
 Gets a credential from credential pool. More...
 
void credman_delete (credman_tag_t tag, credman_type_t type)
 Delete a credential from the credential pool. More...
 
int credman_get_used_count (void)
 Gets the number of credentials currently in the credential pool. More...
 
int credman_load_public_key (const void *buf, size_t buf_len, ecdsa_public_key_t *out)
 Load a public key from a buffer, as a SubjectPublicKeyInfo sequence, according to RFC5280. More...
 
int credman_load_private_key (const void *buf, size_t buf_len, credman_credential_t *cred)
 Load a private key from a buffer, as a OneAsymmetricKey sequence, according to RFC5958. More...
 
int credman_load_private_ecc_key (const void *buf, size_t buf_len, credman_credential_t *cred)
 Load an ECC private key from a buffer, as an ECPrivateKey sequence, according to RFC5915. More...
 
void credman_reset (void)
 Empties the credential pool.