Various Bugfixes with regard to parsing a MSE:SetAT.
The whole SE and SAM system should really be rewritten. git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@444 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# virtualsmartcard. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
import virtualsmartcard.TLVutils
|
||||
import TLVutils
|
||||
from time import time
|
||||
from random import seed, randint
|
||||
from virtualsmartcard.ConstantDefinitions import *
|
||||
@@ -51,7 +51,7 @@ class ControlReferenceTemplate:
|
||||
for object in structure:
|
||||
tag, length, value = object
|
||||
if tag == 0x80:
|
||||
self.__set_algo(data)
|
||||
self.__set_algo(value)
|
||||
elif tag in (0x81,0x82,0x83,0x84):
|
||||
self.__set_key(tag,length,value)
|
||||
elif tag in range(0x85, 0x93):
|
||||
|
||||
@@ -617,14 +617,16 @@ class Secure_Messaging(object):
|
||||
"""
|
||||
|
||||
cmd = p1 & 0x0F
|
||||
se = p1 & 0xF0
|
||||
se = p1 >> 4
|
||||
if(cmd == 0x01):
|
||||
if se == 0x01: #Set the right SE
|
||||
if se & 0x01: #Secure messaging in command data field
|
||||
self.current_SE = self.CAPDU_SE
|
||||
elif se == 0x02:
|
||||
if se & 0x02: #Secure messaging in response data field
|
||||
self.current_SE = self.RAPDU_SE
|
||||
else:
|
||||
pass #FIXME
|
||||
if se & 0x04: #Computation, decipherment, internal authentication and key agreement
|
||||
pass
|
||||
if se & 0x08: #Verification, encipherment, external authentication and key agreement
|
||||
pass
|
||||
self.__set_SE(p2,data)
|
||||
elif(cmd== 0x02):
|
||||
self.__store_SE(p2)
|
||||
@@ -644,19 +646,18 @@ class Secure_Messaging(object):
|
||||
valid_p2 = (0xA4,0xA6,0xB4,0xB6,0xB8)
|
||||
if not p2 in valid_p2:
|
||||
raise SwError(SW["ERR_INCORRECTP1P2"])
|
||||
tag, length, value = TLVutils.unpack(data) #Only one object?
|
||||
if p2 == 0xA4:
|
||||
self.current_SE.at.parse_SE_config(value)
|
||||
self.current_SE.at.parse_SE_config(data)
|
||||
elif p2 == 0xA6:
|
||||
self.current_SE.kat.parse_SE_config(value)
|
||||
self.current_SE.kat.parse_SE_config(data)
|
||||
elif p2 == 0xAA:
|
||||
self.current_SE.ht.parse_SE_config(value)
|
||||
self.current_SE.ht.parse_SE_config(data)
|
||||
elif p2 == 0xB4:
|
||||
self.current_SE.cct.parse_SE_config(value)
|
||||
self.current_SE.cct.parse_SE_config(data)
|
||||
elif p2 == 0xB6:
|
||||
self.current_SE.dst.parse_SE_config(value)
|
||||
self.current_SE.dst.parse_SE_config(data)
|
||||
elif p2 == 0xB8:
|
||||
self.current_SE.ct.parse_SE_config(value)
|
||||
self.current_SE.ct.parse_SE_config(data)
|
||||
|
||||
def __store_SE(self,SEID):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user