named-data / python-ndn

An NDN client library with AsyncIO support in Python 3
https://python-ndn.readthedocs.io/en/latest
Apache License 2.0
24 stars 17 forks source link

How to add new signing algorithm in python-ndn? #52

Closed killerdbob closed 2 years ago

killerdbob commented 2 years ago

Hi, I would like to add a new feature to python-ndn. For now, python-ndn only has ecdsa, and I would like to add sm2 which is also an asymmetric encryption algorithm. Moreover, I would like to add sm3 which is a hash algorithm. So, how to do these in an easy way?

zjkmxy commented 2 years ago

To sign a packet using your algorithm, you need to write a Signer and passes it to the encoding function. You may refer to existing signer, such as the ECDSA one.

To verify the signature, you need to write a Validator and pass it as the validator of function calls such as register or express_interest. You may refer to existing ones.

However, the default SQLite KeyChain does not support new key types, so you will be unable to use other keyword arguments related to signature such as identity, key and cert. If you still want to have a KeyChain, you may implement KeyChain class, but I think this is overshooting.

killerdbob commented 2 years ago

thank you, I will try to do these

zjkmxy commented 2 years ago

FYI: #54