ndn-lite
Functions
signed-interest.h File Reference
#include "interest.h"
#include "../security/ndn-lite-hmac.h"
#include "../security/ndn-lite-sha.h"
#include "../security/ndn-lite-ecc.h"

Go to the source code of this file.

Functions

int ndn_signed_interest_digest_sign (ndn_interest_t *interest)
 Use Digest (SHA256) to sign the Interest and encode the Signed Interest into wire format. More...
 
int ndn_signed_interest_ecdsa_sign (ndn_interest_t *interest, const ndn_name_t *identity, const ndn_ecc_prv_t *prv_key)
 Use ECDSA Algorithm to sign the Interest and encode the Signed Interest into wire format. More...
 
int ndn_signed_interest_hmac_sign (ndn_interest_t *interest, const ndn_name_t *identity, const ndn_hmac_key_t *hmac_key)
 Use HMAC Algorithm to sign the Interest and encode the Signed Interest into wire format. More...
 
int ndn_signed_interest_digest_verify (const ndn_interest_t *interest)
 Verify the Digest (SHA256) signature of a decoded Signed Interest. More...
 
int ndn_signed_interest_ecdsa_verify (const ndn_interest_t *interest, const ndn_ecc_pub_t *pub_key)
 Verify the ECDSA signature of a decoded Signed Interest. More...
 
int ndn_signed_interest_hmac_verify (const ndn_interest_t *interest, const ndn_hmac_key_t *hmac_key)
 Verify the HMAC signature of a decoded Signed Interest. More...
 

Function Documentation

◆ ndn_signed_interest_digest_sign()

int ndn_signed_interest_digest_sign ( ndn_interest_t interest)

Use Digest (SHA256) to sign the Interest and encode the Signed Interest into wire format.

This function will automatically set signature info and signature value.

Parameters
encoder.Output. The encoder to keep the encoded Signed Interest. The encoder should be inited to proper output buffer.
interest.Input. The Interest to be signed and encoded.
Returns
0 if there is no error.

◆ ndn_signed_interest_digest_verify()

int ndn_signed_interest_digest_verify ( const ndn_interest_t interest)

Verify the Digest (SHA256) signature of a decoded Signed Interest.

Parameters
interest.Input. The decoded Signed Interest whose signature to be verified.
Returns
0 if there is no error and the signature is valid.

◆ ndn_signed_interest_ecdsa_sign()

int ndn_signed_interest_ecdsa_sign ( ndn_interest_t interest,
const ndn_name_t identity,
const ndn_ecc_prv_t prv_key 
)

Use ECDSA Algorithm to sign the Interest and encode the Signed Interest into wire format.

This function will automatically set signature info and signature value.

Parameters
encoder.Output. The encoder to keep the encoded Signed Interest. The encoder should be inited to proper output buffer.
interest.Input. The Interest to be signed and encoded.
producer_identity.Input. The producer's identity name.
prv_key.Input. The private ECC key used to generate the signature.
Returns
0 if there is no error.

◆ ndn_signed_interest_ecdsa_verify()

int ndn_signed_interest_ecdsa_verify ( const ndn_interest_t interest,
const ndn_ecc_pub_t pub_key 
)

Verify the ECDSA signature of a decoded Signed Interest.

Parameters
interest.Input. The decoded Signed Interest whose signature to be verified.
pub_key.Input. The ECC public key used to verify the Signed Interest signature.
Returns
0 if there is no error and the signature is valid.

◆ ndn_signed_interest_hmac_sign()

int ndn_signed_interest_hmac_sign ( ndn_interest_t interest,
const ndn_name_t identity,
const ndn_hmac_key_t hmac_key 
)

Use HMAC Algorithm to sign the Interest and encode the Signed Interest into wire format.

This function will automatically set signature info and signature value.

Parameters
encoder.Output. The encoder to keep the encoded Signed Interest. The encoder should be inited to proper output buffer.
interest.Input. The Interest to be signed and encoded.
producer_identity.Input. The producer's identity name.
prv_key.Input. The private HMAC key used to generate the signature.
Returns
0 if there is no error.

◆ ndn_signed_interest_hmac_verify()

int ndn_signed_interest_hmac_verify ( const ndn_interest_t interest,
const ndn_hmac_key_t hmac_key 
)

Verify the HMAC signature of a decoded Signed Interest.

Parameters
interest.Input. The decoded Signed Interest whose signature to be verified.
hmac_key.Input. The HMAC public key used to verify the Signed Interest signature.
Returns
0 if there is no error and the signature is valid.