Problem Statement: Memos/messages when incorporated by a layer 2 service will need to be encrypted to ensure only the Nano addresses involved in a particular block can read the messages. Finalize the best approach to encrypt arbitrary data using the existing private/public Nano keys on a Layer 2 system.
Potential Solution: Asymmetric key encryption of the arbitrary data using existing account private/public keys.
I want to open up a discussion on the above topic. I understand rudimentary basics of cryptography but would like someone to elaborate on a solution for the above problem statement.
Alice sends Bob 10 Nanos and wants to send the message 'Hello World' to Bob for that particular block hash/transaction.
Alice encrypts the message 'Hello World' using Bob's public key derived from Bob's public Nano address (Please suggest which algorithm to use for this).
Alice signs the encrypted message (using her private key) in the similar fashion how a standard Nano transaction block is signed to authenticate the encrypted message is being published by Alice.
Alice publishes the signed encrypted message to a layer 2 service. Layer 2 service verifies the signature and ensures it is Alice sending the message.
Layer 2 service stores this data mapping it to the transaction block and broadcasts it to Bob.
Bob receives the message and decrypts the message with Bobs private key (remember that the message was encrypted using Bobs public key.)
Bob can read the plain text 'Hello World' and stores it on device cache. A reply message can be sent by Bob using the same flow.
Potential issues: If message data is too long maybe use hybrid system of asymmetric and symmetric key encryption instead.
Kindly suggest which algorithms can be used for encryption as well as any short comings to this technique.