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; }
public override byte[] Multiply(byte[] p_first, byte[] p_second) { var blocksize = o_key_struct.getCiphertextBlocksize(); if (p_first.Length != blocksize) { throw new ArgumentException("p_first", "Ciphertext to multiply should be exactly one block long."); } if (p_second.Length != blocksize) { throw new ArgumentException("p_second", "Ciphertext to multiply should be exactly one block long."); } return(Homomorphism.ElGamalHomomorphism.Multiply(p_first, p_second, o_key_struct.P.getBytes())); }