Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to add an application parametet to signed interests? #46

Closed
GlassyYang opened this issue Mar 30, 2022 · 1 comment
Closed

how to add an application parametet to signed interests? #46

GlassyYang opened this issue Mar 30, 2022 · 1 comment

Comments

@GlassyYang
Copy link
Contributor

GlassyYang commented Mar 30, 2022

I use express_interest sending an signed interest with customed signatureinfo. I want to add an applicatioin parameter to the interest, which is like the following code when using ncn-cxx:

Block parameters = makeNonNegativeIntegerBlock(tlv::nfd::ExpirationPeriod, m_expiration->count());
interest.setApplicationParameters(parameters);

It seems like the app_param parameter of express_interest is a byte string, But I don't know how to generate the string. for instance, what kind of byte string can I use to produce the same interest packet as above c++ code? The document on this aspect is very rare.

Another question is that it seems like user cannot customize their signature info. When I want to add timestamp and nonce to signature, I have to add some codes to make_interest:

if signer is not None:
    interest.interest.signature_info = SignatureInfo()
    # code I added 
    interest.interest.signature_info.signature_time = timestamp()
    interest.interest.signature_info.signature_nonce = gen_nonce()
@zjkmxy
Copy link
Member

zjkmxy commented Mar 30, 2022

It seems like the app_param parameter of express_interest is a byte string, But I don't know how to generate the string. for instance, what kind of byte string can I use to produce the same interest packet as above c++ code? The document on this aspect is very rare.

A byte string can be anything. The format is define by your application, not NDN. You can use Pickle, JSON, Protobuf, etc.
If you prefer TLV encoding, you can use TlvModel class.

Also, the code you gave does not looks good: ExpirationPeriod is a type number defined by NFD. I suggest you use your application-defined type number instead of keeping synced with NFD.
If you only want to send an CommandInterest, you may use ndn.app_support.nfd_mgmt package.

Another question is that it seems like user cannot customize their signature info.

No. SignatureInfo is delegated to the signer.

When I want to add timestamp and nonce to signature, I have to add some codes to make_interest:

if signer is not None:
    interest.interest.signature_info = SignatureInfo()
    # code I added 
    interest.interest.signature_info.signature_time = timestamp()
    interest.interest.signature_info.signature_nonce = gen_nonce()

Sorry about this. Currently we have not settled down which one to use, and the default signer does not write any.
You may modify the signer (or write one yourself) to generate these info.
But you also need a corresponding validator to check, because otherwise they don't make any effect.
AFAIK Currently existing NDN software (like vector sync) does not make use of these fields.

@named-data named-data locked and limited conversation to collaborators Mar 30, 2022
@zjkmxy zjkmxy converted this issue into discussion #47 Mar 30, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants