> For the complete documentation index, see [llms.txt](https://docs.aeterna.works/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aeterna.works/features/transfer.md).

# Transfer

Sending the files to anyone

This feature is designed to send encrypted (or unencrypted but tied to NFT) files using asymmetric encryption, you encrypt with receiver's public key, they decrypt with their private key, no re-upload needed. To transfer the file, the recipient must either have at least one outgoing transaction or to provide a public key to the sender.

{% hint style="info" %}
Public keys on Ethereum are not wallet addresses, they are the last 20 bytes of hashed public keys over Keccak256 with 0x prefix. Aeterna automatically reconstructs the public keys where possible, however, if the receiver has no outgoing transactions, then they must provide the public key to the sender through other means. There is special cryptography that has a workaround for this (IBE / ABE) but it has centralization risks that we want to avoid.
{% endhint %}

### Transfer flow

1. User A uploads a file with encryption enabled (ECIES / MLKEM) or just an NFT.
2. User A is given a `Download Key`  for that specific file.
3. User A goes to [Transfer](https://app.aetrna.cloud/transfer) page and pastes the `Download Key` he got. In case if the file was not encrypted and does not have an NFT attached to it, the users gets an error.
4. User A selects the User B's (the receiver) Ethereum address. The system then tries to fetch the receiver's signature from the transaction, then constructs the unsigned transaction [RLP](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/) payload and recovers the public key using the signature.
   1. Aeterna provides prompts for public key in a scenario where the receiver does not have the outgoing transactions yet for both ECIES and MLKEM routes.
5. User A needs to decrypt the symmetric key:
   1. In broswer by inserting the private key. No data is sent to the server, for cryptography [Noble](https://paulmillr.com/noble/) library is used
   2. Offline by using the portable tool provided. User A needs to copy the symmetric key, then run the cool and decrypt that key in terminal offline. This is safer in regards to memory leaks or clipboard sniffers. User A then inputs the plaintext symmetric key that will be checked against `aes_key_hash`  for correctness in case if the User A is malicious or incorrectly pasted the symmetric key.
6. After re-encryption is done, User A gets a Metamask pop-up to send a transaction which updates the `storage_contract` state with a new `encryptedKey`  that the receiver can now decrypt using his Ethereum `private key`&#x20;
7. User B then opens the [Library page](https://app.aetrna.cloud/transfer) on Aeterna website and gets the `download key`  which then is used to download the file from blockchain on [Download pge](https://app.aetrna.cloud/download).
8. User B download a file and decrypts it with his private\_key either in browser or offline using the portable tool.

The portable tool for offline decryption:

<https://github.com/aeterna-docs/portable>
