Exemple #1
0
    def encipher(self, p1, p2, data):
        padded = vsCrypto.append_padding(self.cct.blocklength, data)
        cipher = eac.EAC_encrypt(self.eac_ctx, padded)
        if not cipher:
            eac.print_ossl_err()
            raise SwError(SW["ERR_NOINFO69"])

        return cipher
Exemple #2
0
 def encrypt(self, data):
     """Encrypt a block of data using the secret established by the PACE
     protocol. This method can only be used after a successful run of eac.
     """
     enc = eac.EAC_encrypt(self.ctx, data)
     if not enc or not eac.EAC_increment_ssc(self.ctx):
         raise PACEException("Failed to encrypt the following data: " +
                             data)
     return enc