Function concrete::set_server_key
source · [−]pub fn set_server_key(keys: ServerKey)
Expand description
The function used to initialize internal keys.
As each thread has its own set of keys, this function must be called at least once on each thread to initialize its keys.
Example
Only working in the main
thread
use concrete;
let (client_key, server_key) = concrete::generate_keys(config);
concrete::set_server_key(server_key);
// Now we can do operations on homomorphic types
Working with multiple threads
use concrete;
use concrete::ConfigBuilder;
use std::thread;
let (client_key, server_key) = concrete::generate_keys(config);
let server_key_2 = server_key.clone();
let th1 = thread::spawn(move || {
concrete::set_server_key(server_key);
// Now, this thread we can do operations on homomorphic types
});
let th2 = thread::spawn(move || {
concrete::set_server_key(server_key_2);
// Now, this thread we can do operations on homomorphic types
});
th2.join();
th1.join();