nPA: added option to disable validity period check

This commit is contained in:
Frank Morgner
2012-10-01 12:40:26 +02:00
parent 765d284bc4
commit 4f6945917e
7 changed files with 31 additions and 12 deletions

View File

@@ -81,6 +81,10 @@ npa.add_argument("-c", "--ca",
action="store",
type=str,
help="CHR of the CVCA.")
npa.add_argument("-d", "--disable-checks",
action="store_true", default=False,
help="Disable checking validity period of TA certificate")
args = parser.parse_args()
@@ -106,5 +110,5 @@ if (args.ca_pubkey):
vicc = VirtualICC(args.file, args.type,
args.hostname, args.port, readernum=args.reader,
ef_cardaccess=ef_cardaccess_data, ef_cardsecurity=ef_cardsecurity_data, ca_pubkey=ca_pubkey_data,
ca_key=ca_key_data, ca=args.ca)
ca_key=ca_key_data, ca=args.ca, disable_checks=args.disable_checks)
vicc.run()

View File

@@ -499,11 +499,12 @@ class RelayOS(SmartcardOS):
class NPAOS(Iso7816OS):
def __init__(self, mf, sam, ins2handler=None, maxle=MAX_EXTENDED_LE, ef_cardsecurity=None, ef_cardaccess=None, ca_key=None, ca_pubkey=None, ca=None):
def __init__(self, mf, sam, ins2handler=None, maxle=MAX_EXTENDED_LE, ef_cardsecurity=None, ef_cardaccess=None, ca_key=None, ca_pubkey=None, ca=None, disable_checks=False):
Iso7816OS.__init__(self, mf, sam, ins2handler, maxle)
self.ins2handler[0x86] = self.SAM.general_authenticate
self.ins2handler[0x2c] = self.SAM.reset_retry_counter
self.atr = '\x3B\x8A\x80\x01\x80\x31\xF8\x73\xF7\x41\xE0\x82\x90\x00\x75'
self.SAM.current_SE.disable_checks = disable_checks
if ef_cardsecurity:
ef = self.mf.select('fid', 0x011d)
ef.data = ef_cardsecurity
@@ -556,7 +557,7 @@ class VirtualICC(object):
the vpcd, which forwards it to the application.
"""
def __init__(self, filename, card_type, host, port, lenlen=3, readernum=None, ef_cardsecurity=None, ef_cardaccess=None, ca_key=None, ca_pubkey=None, ca=None):
def __init__(self, filename, card_type, host, port, lenlen=3, readernum=None, ef_cardsecurity=None, ef_cardaccess=None, ca_key=None, ca_pubkey=None, ca=None, disable_checks=False):
from os.path import exists
logging.basicConfig(level = logging.INFO,
@@ -581,7 +582,7 @@ class VirtualICC(object):
if card_type == "iso7816" or card_type == "ePass":
self.os = Iso7816OS(MF, SAM)
elif card_type == "nPA":
self.os = NPAOS(MF, SAM, ef_cardsecurity=ef_cardsecurity, ef_cardaccess=ef_cardaccess, ca_key=ca_key, ca_pubkey=ca_pubkey, ca=ca)
self.os = NPAOS(MF, SAM, ef_cardsecurity=ef_cardsecurity, ef_cardaccess=ef_cardaccess, ca_key=ca_key, ca_pubkey=ca_pubkey, ca=ca, disable_checks=disable_checks)
elif card_type == "cryptoflex":
self.os = CryptoflexOS(MF, SAM)
elif card_type == "relay":

View File

@@ -109,6 +109,7 @@ class nPA_SE(Security_Environment):
self.ca = "DECVCAeID00102"
self.ca_key = None
self.ca_pubkey = None
self.disable_checks = False
def _set_SE(self, p2, data):
sw, resp = Security_Environment._set_SE(self, p2, data)
@@ -302,6 +303,8 @@ class nPA_SE(Security_Environment):
pace.print_ossl_err()
raise SwError(SW["WARN_NOINFO63"])
result.append([0x87, len(self.ca), self.ca])
if (self.disable_checks):
pace.TA_disable_checks(self.eac_ctx)
return 0x9000, nPA_SE.__pack_general_authenticate(result)