Пример #1
0
        public PaillierAbstractCipher(PaillierKeyStruct p_key_struct)
        {
            // set the key details
            o_key_struct = p_key_struct;

            // calculate the blocksizes
            o_plaintext_blocksize  = p_key_struct.getPlaintextBlocksize();
            o_ciphertext_blocksize = p_key_struct.getCiphertextBlocksize();

            // set the default block for plaintext, which is suitable for encryption
            o_block_size = o_plaintext_blocksize;
        }
Пример #2
0
        public PaillierManaged()
        {
            // create the key struct
            o_key_struct = new PaillierKeyStruct();

            // set all of the big integers to zero
            o_key_struct.N      = new BigInteger(0);
            o_key_struct.G      = new BigInteger(0);
            o_key_struct.Lambda = new BigInteger(0);
            o_key_struct.Miu    = new BigInteger(0);

            // set the default key size value
            KeySizeValue = 1024;

            // set the default padding mode
            Padding = PaillierPaddingMode.LeadingZeros;

            // set the range of legal keys
            LegalKeySizesValue = new KeySizes[] { new KeySizes(384, 1088, 8) };
        }
Пример #3
0
 public PaillierDecryptor(PaillierKeyStruct p_struct)
     : base(p_struct)
 {
     // set the default block size to be ciphertext
     o_block_size = o_ciphertext_blocksize;
 }
Пример #4
0
 public PaillierEncryptor(PaillierKeyStruct p_struct)
     : base(p_struct)    // this base keyword means the constructor will use the base's constructor -TA
 {
     o_random = new Random();
 }
Пример #5
0
 public PaillierDecryptor(PaillierKeyStruct keyStruct)
     : base(keyStruct)
 {
 }
Пример #6
0
 public PaillierEncryptor(PaillierKeyStruct keyStruct)
     : base(keyStruct)
 {
     rng = RandomNumberGenerator.Create();
 }
Пример #7
0
 public PaillierEncryptor(PaillierKeyStruct p_struct)
     : base(p_struct)
 {
     o_random = new RNGCryptoServiceProvider();
 }