How to write out and read in keys and cipher data

Hi,
I’m very first with Concrete and Rust, so please be patient.

For a demo project I need to create keys, save them in an external DB.

Then Read them back in and use them to cypher some integer. Save the ciphered integer in an external DB.

Then read the back in, add them and decipher them.

The demo program in concrete does all I need except how to save keys and ciphers outside and read them back.

I started with this code:

fn main() {
let config = ConfigBuilder::all_disabled()
.enable_default_uint16()
.build();
let (client_key, server_key) = generate_keys(config);
set_server_key(server_key);

Now I’d like to save or print the two keys.

I also have some problem with cargo doc that return me errors.

A doc link on writing a reading concrete data will be sufficient I suppose.

Thank You in advance.


Andrea

Hello @Andrea

You can check this page of the user doc on serialization and this other page on a client/server setup.

Let me know if it answers your questions!

Best

Than you so much for the very quick answer.

Yes it seems to me the client server doc page is really what I need.

I’m reading and studying it right now.

Best wishes

Andrea

The example in the documentation doesn’t compile for me with an erorr:

error[E0432]: unresolved import crate::details
→ src/main.rs:1:12
|
1 | use crate::details::{ask_for_exit, fhe16_from_stin, fhe3_from_stin, key_gen};
| ^^^^^^^ could not find details in the crate root

cargo search details
give me 3 possible dependencies, but none seems to work.

What I’m doing wrong?

Thank You so much


Andrea

what is the content of your Cargo.toml ?

[package]
name = “FHE_KEY”
version = “0.1.0”
edition = “2021”

See more keys and their definitions at The Manifest Format - The Cargo Book

[dependencies]
concrete = { version = “0.2.0”, features = [ “integers”, “serde”] }
bincode = “1.3.3”

You are trying the server example ?

No the client part.
Client Explanation is the title.

The code refers to this repo GitHub - zama-ai/concrete-example-client-server

did you clone it ?

Not yet.
OK I understood my error.
Thank you so much.


Andrea

Great :slight_smile: let me know if you encounter other issues

Cheers