mimoo / disco-c

A tiny C cryptographic library to encrypt sessions, authenticate messages, sign, hash, etc. based only on SHA-3 and Curve25519
https://embeddeddisco.com/
Apache License 2.0
65 stars 3 forks source link

wrappers around API #20

Open mimoo opened 5 years ago

mimoo commented 5 years ago

We need wrappers around disco_Initialize for the different handshakes. Some ideas:

These are really mouthy. Perhaps a composition system?

my_protocol = new(Disco)
my_protocol.authenticate_server(PKI)
tada

Need a composition system for disco_Initialize as well. Too many NULL in there. Can add:

my_protocol.addMyKey()
my_protocol.addRemoteKey()
mimoo commented 5 years ago

What about the following:

my_protocol = new(Disco)
// won't work out of the box
my_protocol.Authenticate_server_with_whitelist(whitelist_keys[]) // NX
// or
my_protocol.Authenticate_server_with_PKI(root_key) // NX
// or
my_protocol.Authenticate_server_with_TOFU(TOFU_list[], callback_fingerprint) // NX
// or
my_protocol.Authenticate_server_with_key(server_key) // NK
// at this point the protocol can be used with `Nsomething`
my_protocol.Authenticate_client_with_key(my_key) // KK
// at this point the protocol can be used while authenticating the client as well!

of course power users can still use disco_initialize since this is also a library