public ElGamalAbstractCipher(ElGamalKeyStruct p_key_struct)
        {
            o_key_struct = p_key_struct;

            o_plaintext_blocksize  = p_key_struct.getPlaintextBlocksize();
            o_ciphertext_blocksize = p_key_struct.getCiphertextBlocksize();

            o_block_size = o_plaintext_blocksize;
        }
        public ElGamalAbstractCipher(ElGamalKeyStruct 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;
        }
示例#3
0
        public ElGamalManaged()
        {
            // create the key struct
            o_key_struct = new ElGamalKeyStruct();

            // set all of the big integers to zero
            o_key_struct.P = new BigInteger(0);
            o_key_struct.G = new BigInteger(0);
            o_key_struct.Y = new BigInteger(0);
            o_key_struct.X = new BigInteger(0);

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

            // set the default padding mode
            Padding = ElGamalPaddingMode.Zeros;

            // set the range of legal keys
            LegalKeySizesValue = new KeySizes[] { new KeySizes(384, 1088, 8) };
        }
示例#4
0
        public ElGamalManaged()
        {
            // create the key struct and set all of the big integers to zero
            o_key_struct = new ElGamalKeyStruct
            {
                P = BigInteger.Zero,
                G = BigInteger.Zero,
                Y = BigInteger.Zero,
                X = BigInteger.Zero
            };

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

            // set the default padding mode
            Padding = ElGamalPaddingMode.BigIntegerPadding;

            // set the range of legal keys
            LegalKeySizesValue = new[] { new KeySizes(384, 1088, 8) };
        }
示例#5
0
 public ElGamalDecryptor(ElGamalKeyStruct p_struct)
     : base(p_struct)
 {
     o_block_size = o_ciphertext_blocksize;
 }
示例#6
0
 public ElGamalEncryptor(ElGamalKeyStruct p_struct)
     : base(p_struct)
 {
     o_random = RandomNumberGenerator.Create();
 }
示例#7
0
 public ElGamalDecryptor(ElGamalKeyStruct p_struct)
     : base(p_struct)
 {
     // set the default block size to be ciphertext
     o_block_size = o_ciphertext_blocksize;
 }
示例#8
0
 public ElGamalEncryptor(ElGamalKeyStruct p_struct)
     : base(p_struct)
 {
     o_random = new RNGCryptoServiceProvider();
 }