Ejemplo n.º 1
0
 public IComputationEnvironment AllocateComputationEnv()
 {
     environmentQueue.TryDequeue(out AtomicSealBfvEncryptedEnvironment env);
     if (env == null)
     {
         env = new AtomicSealBfvEncryptedEnvironment(ReferenceEnvironment);
     }
     return(env);
 }
Ejemplo n.º 2
0
        public void GenerateEncryptionKeys(ulong[] primes, ulong n, int DecompositionBitCount, int GaloisDecompositionBitCount, int SmallModulusCount = -1)
        {
            var envs = new AtomicSealBfvEncryptedEnvironment[primes.Length];

            Parallel.For(0, primes.Length, i =>
            {
                envs[i] = new AtomicSealBfvEncryptedEnvironment();
                envs[i].GenerateEncryptionKeys(primes[i], n, DecompositionBitCount, GaloisDecompositionBitCount, SmallModulusCount);
                envs[i].ParentFactory = new AtomicEncryptedFactory()
                {
                    ReferenceEnvironment = envs[i]
                };
            });
            Environments = envs;
        }
Ejemplo n.º 3
0
 private void LoadFromStream(Stream stream)
 {
     using (var archive = new ZipArchive(stream, ZipArchiveMode.Read, true))
     {
         Environments = archive.Entries.Select(e =>
         {
             var env           = new AtomicSealBfvEncryptedEnvironment();
             env.ParentFactory = new AtomicEncryptedFactory()
             {
                 ReferenceEnvironment = env
             };
             using (var s = e.Open())
                 env.LoadFromStream(s);
             return(env);
         }).ToArray();
     }
 }