-
Notifications
You must be signed in to change notification settings - Fork 4
Testing Milestone 2
First, run Fennel Protocol as a dev node:
$ ./scripts/setup.sh
$ ./scripts/build-run.shExtrinsics are available by navigating to Polkadot.js and entering the Developer > Extrinsics menu.
The following represent the features outlined as the deliverables outlined for Milestone 2:
Given key and location, the Key Announcement extrinsic will insert a Storage entry announcing the existence of a Key to the Issued Key's list of keys.
Fennel provides support in our integration libraries for AES encryption and the generation of AES keys (source). A light wrapper around the OpenSSL implementation of AES is used for both key generation and encryption/decryption. An AES key will be generated based on the shared secret for each communication channel established and be used for encrypting the messages exchanged within it.
-
AESCipher::newgenerates an AES cipher instance based on a randomly generated secret -
AESCipher::from_filegenerates an AES cipher instance based on a secret stored in a file -
AESCipher::new_from_shared_secretgenerates an AES cipher instance based on a given secret -
generate_keysusing a given secret, this method will return an AES encryption and decryption keys for the OpenSSL implementation -
aes_encryptencrypts the given plain text using the given AES Key and a randomly generated IV. It returns the cipher text appended to the randomly generated IV -
aes_decryptdecrypts the given cipher text using the given AES Key and the appended random IV that was generated for it, returning the original plain text
Fennel provides support in our integration libraries for RSA encryption and the generation of RSA keys. A light wrapper around the RSA
Having the capability to map public keys to accounts is critical to offering cryptographically secure avenues for Fennel protocol users to request and establish communication channels between each other. By storing the public keys on-chain in connection with user accounts, blockchain level security is achieved for the connection between the public key and the account that claims it. It also ensures that when an account retires a public key, it occurs on-chain so that others are made aware it is no longer active.
You can announce a new RSA public key to the network by calling the issue_key extrinsic (source) with a key fingerprint and a link to a public key storage location.
Any existing RSA public key on-chain can also be revoked by calling the revoke_key extrinsic (source) by supplying the fingerprint.
Public Key Retrieval is implemented as a storage handler around a StorageDoubleMap, mapping accounts to key fingerprints to storage locations. You can find an example of a Rust function to call against this storage endpoint in fennel-lib.
The changes in this milestone include both a library used to integrate key management and encryption negotiation features into Rust-based applications through a new fennel-lib implementation, and a Fennel Protocol pallet used to announce both Diffie-Hellman public keys and RSA public keys to the network. In the next milestone, we'll complete a client/server pair targeting easy deployment with this library integrated.
Fennel utilizes the Diffie-Hellman (DH) algorithm for establishing secure communication channels. A light wrapper around the x25519_dalek crate provides the functions Fennel will use for the communication channel handshake between two accounts (source).
-
get_session_secretthis function generates a secret for a user to be used for DH -
get_session_public_keythis function returns the public key derived from the given DH secret, which is exchanged with another user's public key for DH -
get_shared_secretwhen a user receives another user's public key, they can combine it with their DH secret to create the DH shared secret