ndn-lite
Functions | Variables
access-control.c File Reference
#include "access-control.h"
#include "../encode/signed-interest.h"
#include "../encode/key-storage.h"
#include "../security/ndn-lite-aes.h"
#include "../security/ndn-lite-rng.h"
#include "../security/ndn-lite-ecc.h"
#include "../security/ndn-lite-hmac.h"

Functions

void ndn_ac_state_init (const ndn_name_t *self_identity, const ndn_ecc_pub_t *self_pub_key, const ndn_ecc_prv_t *self_prv_key)
 Init a Access Control State structure. More...
 
int ndn_ac_prepare_key_request_interest (ndn_encoder_t *encoder, const ndn_name_t *home_prefix, const name_component_t *self_identity, uint32_t ac_key_id, const ndn_ecc_prv_t *prv_key, uint8_t is_ek)
 Prepare a Key Request to send. More...
 
int ndn_ac_on_ek_response_process (const ndn_data_t *data)
 Process Encryption Request's Response. More...
 
int ndn_ac_on_dk_response_process (const ndn_data_t *data)
 Process Deryption Request's Response. More...
 
int ndn_ac_on_interest_process (ndn_data_t *response, const ndn_interest_t *interest)
 Process Access Control Request. More...
 
int ndn_ac_prepare_ek_response (ndn_decoder_t *decoder, const ndn_interest_t *interest, ndn_data_t *response)
 
int ndn_ac_prepare_dk_response (ndn_decoder_t *decoder, const ndn_interest_t *interest, ndn_data_t *response)
 

Variables

static ndn_ac_unfinished_key_t unfinished_key
 
static ndn_ac_state_t ac_state
 

Function Documentation

◆ ndn_ac_on_dk_response_process()

int ndn_ac_on_dk_response_process ( const ndn_data_t data)

Process Deryption Request's Response.

This function will automatically set and update Access Control State.

Parameters
data.Input. Decoded and signature verified Decryption Request's Response Packet.
Returns
0 if there is no error.

◆ ndn_ac_on_ek_response_process()

int ndn_ac_on_ek_response_process ( const ndn_data_t data)

Process Encryption Request's Response.

This function will automatically set and update Access Control State.

Parameters
data.Input. Decoded and signature verified Encryption Request's Response Packet.
Returns
0 if there is no error.

◆ ndn_ac_on_interest_process()

int ndn_ac_on_interest_process ( ndn_data_t response,
const ndn_interest_t interest 
)

Process Access Control Request.

This function will automatically set and update Access Control State on the access controller side.

Parameters
response.Output. Prepared Response.
interest.Input. Decoded and signature verified signed interest.
Returns
0 if there is no error.

◆ ndn_ac_prepare_dk_response()

int ndn_ac_prepare_dk_response ( ndn_decoder_t decoder,
const ndn_interest_t interest,
ndn_data_t response 
)

◆ ndn_ac_prepare_ek_response()

int ndn_ac_prepare_ek_response ( ndn_decoder_t decoder,
const ndn_interest_t interest,
ndn_data_t response 
)

◆ ndn_ac_prepare_key_request_interest()

int ndn_ac_prepare_key_request_interest ( ndn_encoder_t encoder,
const ndn_name_t home_prefix,
const name_component_t self_identity,
uint32_t  ac_key_id,
const ndn_ecc_prv_t prv_key,
uint8_t  is_ek 
)

Prepare a Key Request to send.

This function will automatically sign and encode the interest.

Parameters
encoder.Output. The encoder to keep the encoded Key Request. The encoder should be inited to proper output buffer.
home_prefix.Input. The network home prefix to configure the state manager.
self_identity.Input. The local state manager identity.
prv_key.Input. The ECC private key used to sign the interest.
is_ek.Input. Determine whether to encode a Encryption Request or Decryption Request.
Returns
0 if there is no error.

◆ ndn_ac_state_init()

void ndn_ac_state_init ( const ndn_name_t self_identity,
const ndn_ecc_pub_t self_pub_key,
const ndn_ecc_prv_t self_prv_key 
)

Init a Access Control State structure.

Parameters
self_identity.Input. Local state manager identity.
self_pub_key.Input. The identity ECC public key.
self_prv_key.Input. The identity ECC private key.

Variable Documentation

◆ ac_state

ndn_ac_state_t ac_state
static

◆ unfinished_key

ndn_ac_unfinished_key_t unfinished_key
static