bankPk = fileutils.recupKey("banquePk")

merchantkeyclientciphered = []
clientkeybanqueciphered = []

merchantkeyclientciphered.append( fileutils.readKey(sys.argv[2],0))
merchantkeyclientciphered.append( fileutils.readKey(sys.argv[2],1))

clientkeybanqueciphered.append(fileutils.readKey(sys.argv[2],2))
clientkeybanqueciphered.append(fileutils.readKey(sys.argv[2],3))

uid_ciphered = fileutils.readKey(sys.argv[2],4)
sum_ciphered = fileutils.readKey(sys.argv[2],5)

clepub_client = [rsatools.decryptblock(bankPk, clientkeybanqueciphered[0]), rsatools.decryptblock(bankPk, clientkeybanqueciphered[1])]
clepub_merchant = [rsatools.decryptblock( clepub_client, merchantkeyclientciphered[0]), rsatools.decryptblock( clepub_client, merchantkeyclientciphered[1])]

#Decyphering the cypher of the sum and of the id by the client
uid_clear = rsatools.decryptblock(clepub_client, uid_ciphered)
sum_clear = rsatools.decryptblock(clepub_client, sum_ciphered)

#Checking if they are the same than the one on the invoice
if(uid_clear != facture.getUid()):
    print("Elements différents lors de la vérification (UID de la facture)")
if(sum_clear != facture.getTotalSomme()):
    print("Elements différents lors de la vérification (Somme totale de la facture)")
#checking if the merchant's public key ciphered by the client is right
if(clepub_merchant != clepub_merchant_original):
    print("Elements différents lors de la vérification (clée du marchant chiffrée par le client)")