public void GetKeyTest() { SEALContext context = GlobalContext.BFVContext; KeyGenerator keygen = new KeyGenerator(context); RelinKeys relinKeys = keygen.RelinKeys(); Assert.IsTrue(relinKeys.HasKey(2)); Assert.IsFalse(relinKeys.HasKey(3)); Assert.ThrowsException <ArgumentException>(() => relinKeys.Key(0)); Assert.ThrowsException <ArgumentException>(() => relinKeys.Key(1)); List <PublicKey> key1 = new List <PublicKey>(relinKeys.Key(2)); Assert.AreEqual(4, key1.Count); Assert.AreEqual(5ul, key1[0].Data.CoeffModCount); }
public void GetKeyTest() { SEALContext context = GlobalContext.Context; KeyGenerator keygen = new KeyGenerator(context); RelinKeys relinKeys = keygen.RelinKeys(decompositionBitCount: 60, count: 3); Assert.IsFalse(relinKeys.HasKey(0)); Assert.IsFalse(relinKeys.HasKey(1)); Assert.IsTrue(relinKeys.HasKey(2)); Assert.IsTrue(relinKeys.HasKey(3)); Assert.IsTrue(relinKeys.HasKey(4)); Assert.IsFalse(relinKeys.HasKey(5)); Assert.ThrowsException <ArgumentOutOfRangeException>(() => relinKeys.Key(1)); List <Ciphertext> key1 = new List <Ciphertext>(relinKeys.Key(2)); Assert.AreEqual(2, key1.Count); Assert.AreEqual(2ul, key1[0].CoeffModCount); Assert.AreEqual(2ul, key1[1].CoeffModCount); List <Ciphertext> key2 = new List <Ciphertext>(relinKeys.Key(3)); Assert.AreEqual(2, key2.Count); Assert.AreEqual(2ul, key2[0].CoeffModCount); Assert.AreEqual(2ul, key2[1].CoeffModCount); List <Ciphertext> key3 = new List <Ciphertext>(relinKeys.Key(4)); Assert.AreEqual(2, key3.Count); Assert.AreEqual(2ul, key3[0].CoeffModCount); Assert.AreEqual(2ul, key3[1].CoeffModCount); }