Exemple #1
0
        // params must have df1..df3 and dr1..dr3 set as well as df and dr
        private void EncryptDecrypt(NTRUParameters param)
        {
            NTRUKeyPair kp;

            using (NTRUKeyGenerator kg = new NTRUKeyGenerator(param))
                kp = (NTRUKeyPair)kg.GenerateKeyPair();

            NTRUEncrypt ntru = new NTRUEncrypt(param);

            TextTest(ntru, kp, param);
            // sparse/dense
            param.Sparse = !param.Sparse;
            TextTest(ntru, kp, param);
            param.Sparse = !param.Sparse;
            EmptyTest(ntru, kp, param);
            MaxLength(ntru, kp, param);
            TooLong(ntru, kp, param);

            kp.Dispose();
            ntru.Dispose();
        }