def __init__(self, MF, SAM): Security_Environment.__init__(self, MF, SAM) self.at = nPA_AT_CRT() # This breaks support for 3DES self.cct.blocklength = 16 self.cct.algorithm = "CC" self.eac_step = 0 self.sec = None self.eac_ctx = None self.cvca = None self.car = None self.ca_key = None self.disable_checks = False
def __init__(self, MF, SAM): Security_Environment.__init__(self, MF, SAM) self.at = nPA_AT_CRT() #This breaks support for 3DES self.cct.blocklength = 16 self.cct.algorithm = "CC" self.eac_step = 0 self.sec = None self.eac_ctx = None self.cvca = None self.car = None self.ca_key = None self.disable_checks = False
def _set_SE(self, p2, data): sw, resp = Security_Environment._set_SE(self, p2, data) if self.at.algorithm == "PACE": self.eac_step = 0 elif self.at.algorithm == "TA": if self.eac_step != 4: SwError(SW["ERR_AUTHBLOCKED"]) elif self.at.algorithm == "CA": if self.eac_step != 5: SwError(SW["ERR_AUTHBLOCKED"]) return sw, resp
def _set_SE(self, p2, data): sw, resp = Security_Environment._set_SE(self, p2, data) if self.at.algorithm == "PACE": if self.at.keyref_is_pin(): if self.sam.counter <= 0: print "Must use PUK to unblock" return 0x63c0, "" if self.sam.counter == 1 and not self.sam.active: print "Must use CAN to activate" return 0x63c1, "" self.eac_step = 0 elif self.at.algorithm == "TA": if self.eac_step != 4: SwError(SW["ERR_AUTHBLOCKED"]) elif self.at.algorithm == "CA": if self.eac_step != 5: SwError(SW["ERR_AUTHBLOCKED"]) return sw, resp
def _set_SE(self, p2, data): sw, resp = Security_Environment._set_SE(self, p2, data) if self.at.algorithm == "PACE": if self.at.keyref_is_pin(): if self.sam.counter <= 0: print("Must use PUK to unblock") return 0x63c0, "" if self.sam.counter == 1 and not self.sam.active: print("Must use CAN to activate") return 0x63c1, "" self.eac_step = 0 elif self.at.algorithm == "TA": if self.eac_step != 4: raise SwError(SW["ERR_AUTHBLOCKED"]) elif self.at.algorithm == "CA": if self.eac_step != 5: raise SwError(SW["ERR_AUTHBLOCKED"]) return sw, resp
def __init__(self, MF, SAM): Security_Environment.__init__(self, MF, SAM)
def __init__(self, MF, SAM, ssc=None): Security_Environment.__init__(self, MF, SAM) self.ssc = ssc self.cct.algorithm = "CC" self.cct.blocklength = 8 self.ct.algorithm = "DES3-CBC"