AES Module

MPC implementation of AES (Rijndael). This module can be used to securely compute a secret shared AES encrypted ciphertext of a (possibly) secret shared plaintext with a (possibly) secret shared key. The inputs have to be given either as a list of shares over GF256 (byte-wise) or as a string. The runtime has to be able to handle shares over GF256. Decryption is not implemented yet.

The implementation is based on the fact that AES has arithmetic properties which makes its computation by arithmetic circuits relatively fast.

class viff.aes.AES(runtime, key_size, block_size=128, use_exponentiation=False, quiet=False)

AES instantiation.

This class is used together with a Runtime object:

aes = AES(runtime, 192)
cleartext = [Share(runtime, GF256, GF256(0)) for i in range(128/8)]
key = [runtime.prss_share_random(GF256) for i in range(192/8)]
ciphertext = aes.encrypt("abcdefghijklmnop", key)
ciphertext = aes.encrypt(cleartext, "keykeykeykeykeykeykeykey")
ciphertext = aes.encrypt(cleartext, key)

In every case ciphertext will be a list of shares over GF256.

add_round_key(state, round_key)

Rijndael AddRoundKey.

State should be a list of 4 rows and round_key a list of 4-byte columns (words).

byte_sub(state, use_lin_comb=True)

ByteSub operation of Rijndael.

The first argument should be a matrix consisting of elements of GF(2^8).

encrypt(cleartext, key, benchmark=False, prepare_at_once=False)

Rijndael encryption.

Cleartext and key should be either a string or a list of bytes (possibly shared as elements of GF256).

key_expansion(key, new_length=None)

Rijndael key expansion.

Input and output are lists of 4-byte columns (words). new_length is the round for which the key should be expanded. If ommitted, the key is expanded for all rounds.

mix_column(state, use_lin_comb=True)

Rijndael MixColumn.

Input should be a list of 4 rows.


Rijndael ShiftRow.

State should be a list of 4 rows.

viff.aes.bit_decompose(share, use_lin_comb=True)

Bit decomposition for GF256 shares.

Previous topic

Config Module

Next topic

Constants Module

This Page