def __init__(self, card):
     TCOS_Security_Environment.__init__(self, card)
     self.last_vanilla_c_apdu = None
     
     # Set up a fake SE config to be able to reuse the TCOS code
     self.set_key( 1, self.card.KSenc)
     enc_config = "\x80\x01\x0d\x83\x01\x01\x85\x00"
     self.set_key( 2, self.card.KSmac)
     mac_config = "\x80\x01\x0d\x83\x01\x02\x85\x00"
     
     self.set_config( tcos_card.SE_APDU,  tcos_card.TEMPLATE_CCT, SE_Config(mac_config) )
     self.set_config( tcos_card.SE_RAPDU, tcos_card.TEMPLATE_CCT, SE_Config(mac_config) )
     
     self.set_config( tcos_card.SE_APDU,  tcos_card.TEMPLATE_CT, SE_Config(enc_config) )
     self.set_config( tcos_card.SE_RAPDU, tcos_card.TEMPLATE_CT, SE_Config(enc_config) )
示例#2
0
    def __init__(self, card):
        TCOS_Security_Environment.__init__(self, card)
        self.last_vanilla_c_apdu = None

        # Set up a fake SE config to be able to reuse the TCOS code
        self.set_key(1, self.card.KSenc)
        enc_config = "\x80\x01\x0d\x83\x01\x01\x85\x00"
        self.set_key(2, self.card.KSmac)
        mac_config = "\x80\x01\x0d\x83\x01\x02\x85\x00"

        self.set_config(tcos_card.SE_APDU, tcos_card.TEMPLATE_CCT,
                        SE_Config(mac_config))
        self.set_config(tcos_card.SE_RAPDU, tcos_card.TEMPLATE_CCT,
                        SE_Config(mac_config))

        self.set_config(tcos_card.SE_APDU, tcos_card.TEMPLATE_CT,
                        SE_Config(enc_config))
        self.set_config(tcos_card.SE_RAPDU, tcos_card.TEMPLATE_CT,
                        SE_Config(enc_config))