def test_get_fingerprint(self):
        """
        Creates a new ThresholdEncryptionSetUp and generate commitments for 
        all trustees add them to the  ThresholdEncryptionSetUp
        an get a fingerpint
        """
        cryptosystem = get_cryptosystem()
        commitments = []

        # Generate a new instance of ThresholdEncryptionSetUp
        tSetUp = ThresholdEncryptionSetUp(cryptosystem, self.num_trustees,
                                          self.threshold)
        # Adding the keys from trustees
        for i in range(self.num_trustees):
            tSetUp.add_trustee_public_key(i, self.trustees[i].public_key)

        # Generate commitmes for trustees
        for i in range(self.num_trustees):
            commitments.append(tSetUp.generate_commitment())

        # get_fingerprint must raise ThresholdEncryptionSetUpStateError
        # if called without added commitments
        self.assertRaises(ThresholdEncryptionSetUpStateError,
                          tSetUp.get_fingerprint)

        # Adding the first  self.num_trustees - 1 commitments from trustees
        for i in range(self.num_trustees - 1):
            tSetUp.add_trustee_commitment(i, commitments[i])

        # get_fingerprint must raise ThresholdEncryptionSetUpStateError
        # if called without all added commitments
        self.assertRaises(ThresholdEncryptionSetUpStateError,
                          tSetUp.get_fingerprint)

        # Add the last commitments from trustees
        tSetUp.add_trustee_commitment(self.num_trustees - 1,
                                      commitments[self.num_trustees - 1])

        # Create 2 fingerpints and they must match
        fingerprint = tSetUp.get_fingerprint()
        fingerprintb = tSetUp.get_fingerprint()
        self.assertEquals(fingerprint, fingerprintb)

        # We create a diferent ThresholdEncryptionSetUp to genera another
        # fingerprint that should not match
        tSetUp2 = ThresholdEncryptionSetUp(cryptosystem, self.num_trustees - 1,
                                           self.threshold - 1)
        for i in range(self.num_trustees - 1):
            tSetUp2.add_trustee_public_key(i, self.trustees[i].public_key)
        commitments2 = []
        for i in range(self.num_trustees - 1):
            commitments2.append(tSetUp2.generate_commitment())
        for i in range(self.num_trustees - 1):
            tSetUp2.add_trustee_commitment(i, commitments2[i])
        fingerprint2 = tSetUp2.get_fingerprint()

        # figerprints generate from diferent ThresholdEncryptionSetUp
        # must be diferent
        self.assertNotEqual(fingerprint, fingerprint2)
 def test_get_fingerprint(self):    
     """
     Creates a new ThresholdEncryptionSetUp and generate commitments for 
     all trustees add them to the  ThresholdEncryptionSetUp
     an get a fingerpint
     """
     cryptosystem = get_cryptosystem()
     commitments = []
     
     # Generate a new instance of ThresholdEncryptionSetUp
     tSetUp = ThresholdEncryptionSetUp(cryptosystem, 
                                       self.num_trustees, self.threshold)                         
     # Adding the keys from trustees
     for i in range(self.num_trustees):
         tSetUp.add_trustee_public_key(i, self.trustees[i].public_key)
     
     # Generate commitmes for trustees
     for i in range(self.num_trustees):
         commitments.append(tSetUp.generate_commitment()) 
         
     # get_fingerprint must raise ThresholdEncryptionSetUpStateError
     # if called without added commitments
     self.assertRaises(ThresholdEncryptionSetUpStateError, 
                       tSetUp.get_fingerprint)
                       
     # Adding the first  self.num_trustees - 1 commitments from trustees
     for i in range(self.num_trustees - 1):
        tSetUp.add_trustee_commitment(i, commitments[i])
        
     # get_fingerprint must raise ThresholdEncryptionSetUpStateError
     # if called without all added commitments
     self.assertRaises(ThresholdEncryptionSetUpStateError, 
                       tSetUp.get_fingerprint) 
                      
     # Add the last commitments from trustees 
     tSetUp.add_trustee_commitment(self.num_trustees - 1, 
                             commitments[self.num_trustees - 1])
                             
     # Create 2 fingerpints and they must match
     fingerprint = tSetUp.get_fingerprint()
     fingerprintb = tSetUp.get_fingerprint()
     self.assertEquals(fingerprint,fingerprintb)
     
     # We create a diferent ThresholdEncryptionSetUp to genera another 
     # fingerprint that should not match
     tSetUp2 = ThresholdEncryptionSetUp(cryptosystem, 
                                       self.num_trustees-1, self.threshold-1)                         
     for i in range(self.num_trustees-1):
         tSetUp2.add_trustee_public_key(i, self.trustees[i].public_key)
     commitments2 = []
     for i in range(self.num_trustees-1):
         commitments2.append(tSetUp2.generate_commitment()) 
     for i in range(self.num_trustees - 1):
        tSetUp2.add_trustee_commitment(i, commitments2[i])
     fingerprint2 = tSetUp2.get_fingerprint()
     
     # figerprints generate from diferent ThresholdEncryptionSetUp 
     # must be diferent
     self.assertNotEqual(fingerprint,fingerprint2)