nPA: updated CLI information regarding CAR
This commit is contained in:
@@ -73,10 +73,10 @@ npa.add_argument("-k", "--ca-key",
|
|||||||
action="store",
|
action="store",
|
||||||
type=argparse.FileType('rb'),
|
type=argparse.FileType('rb'),
|
||||||
help="CA private key.")
|
help="CA private key.")
|
||||||
npa.add_argument("-c", "--ca",
|
npa.add_argument("-c", "--car",
|
||||||
action="store",
|
action="store",
|
||||||
type=str,
|
type=str,
|
||||||
help="CHR of the CVCA.")
|
help="certificate authority reference (CHR of the CVCA)")
|
||||||
npa.add_argument("-d", "--disable-checks",
|
npa.add_argument("-d", "--disable-checks",
|
||||||
action="store_true", default=False,
|
action="store_true", default=False,
|
||||||
help="Disable checking validity period of TA certificate")
|
help="Disable checking validity period of TA certificate")
|
||||||
@@ -102,5 +102,5 @@ if (args.ca_key):
|
|||||||
vicc = VirtualICC(args.file, args.type,
|
vicc = VirtualICC(args.file, args.type,
|
||||||
args.hostname, args.port, readernum=args.reader,
|
args.hostname, args.port, readernum=args.reader,
|
||||||
ef_cardaccess=ef_cardaccess_data, ef_cardsecurity=ef_cardsecurity_data,
|
ef_cardaccess=ef_cardaccess_data, ef_cardsecurity=ef_cardsecurity_data,
|
||||||
ca_key=ca_key_data, ca=args.ca, disable_checks=args.disable_checks)
|
ca_key=ca_key_data, car=args.car, disable_checks=args.disable_checks)
|
||||||
vicc.run()
|
vicc.run()
|
||||||
|
|||||||
@@ -499,7 +499,7 @@ class RelayOS(SmartcardOS):
|
|||||||
|
|
||||||
|
|
||||||
class NPAOS(Iso7816OS):
|
class NPAOS(Iso7816OS):
|
||||||
def __init__(self, mf, sam, ins2handler=None, maxle=MAX_EXTENDED_LE, ef_cardsecurity=None, ef_cardaccess=None, ca_key=None, ca=None, disable_checks=False):
|
def __init__(self, mf, sam, ins2handler=None, maxle=MAX_EXTENDED_LE, ef_cardsecurity=None, ef_cardaccess=None, ca_key=None, car=None, disable_checks=False):
|
||||||
Iso7816OS.__init__(self, mf, sam, ins2handler, maxle)
|
Iso7816OS.__init__(self, mf, sam, ins2handler, maxle)
|
||||||
self.ins2handler[0x86] = self.SAM.general_authenticate
|
self.ins2handler[0x86] = self.SAM.general_authenticate
|
||||||
self.ins2handler[0x2c] = self.SAM.reset_retry_counter
|
self.ins2handler[0x2c] = self.SAM.reset_retry_counter
|
||||||
@@ -511,8 +511,8 @@ class NPAOS(Iso7816OS):
|
|||||||
if ef_cardaccess:
|
if ef_cardaccess:
|
||||||
ef = self.mf.select('fid', 0x011c)
|
ef = self.mf.select('fid', 0x011c)
|
||||||
ef.data = ef_cardaccess
|
ef.data = ef_cardaccess
|
||||||
if ca:
|
if car:
|
||||||
self.SAM.current_SE.ca = ca
|
self.SAM.current_SE.car = car
|
||||||
if ca_key:
|
if ca_key:
|
||||||
self.SAM.current_SE.ca_key = ca_key
|
self.SAM.current_SE.ca_key = ca_key
|
||||||
|
|
||||||
@@ -555,7 +555,7 @@ class VirtualICC(object):
|
|||||||
the vpcd, which forwards it to the application.
|
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=None, disable_checks=False):
|
def __init__(self, filename, card_type, host, port, lenlen=3, readernum=None, ef_cardsecurity=None, ef_cardaccess=None, ca_key=None, car=None, disable_checks=False):
|
||||||
from os.path import exists
|
from os.path import exists
|
||||||
|
|
||||||
logging.basicConfig(level = logging.INFO,
|
logging.basicConfig(level = logging.INFO,
|
||||||
@@ -580,7 +580,7 @@ class VirtualICC(object):
|
|||||||
if card_type == "iso7816" or card_type == "ePass":
|
if card_type == "iso7816" or card_type == "ePass":
|
||||||
self.os = Iso7816OS(MF, SAM)
|
self.os = Iso7816OS(MF, SAM)
|
||||||
elif card_type == "nPA":
|
elif card_type == "nPA":
|
||||||
self.os = NPAOS(MF, SAM, ef_cardsecurity=ef_cardsecurity, ef_cardaccess=ef_cardaccess, ca_key=ca_key, ca=ca, disable_checks=disable_checks)
|
self.os = NPAOS(MF, SAM, ef_cardsecurity=ef_cardsecurity, ef_cardaccess=ef_cardaccess, ca_key=ca_key, car=car, disable_checks=disable_checks)
|
||||||
elif card_type == "cryptoflex":
|
elif card_type == "cryptoflex":
|
||||||
self.os = CryptoflexOS(MF, SAM)
|
self.os = CryptoflexOS(MF, SAM)
|
||||||
elif card_type == "relay":
|
elif card_type == "relay":
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ class nPA_SE(Security_Environment):
|
|||||||
self.sec = None
|
self.sec = None
|
||||||
self.eac_ctx = None
|
self.eac_ctx = None
|
||||||
self.ssc = 0
|
self.ssc = 0
|
||||||
self.ca = "DECVCAeID00102"
|
self.car = "DECVCAeID00102"
|
||||||
self.ca_key = None
|
self.ca_key = None
|
||||||
self.disable_checks = False
|
self.disable_checks = False
|
||||||
|
|
||||||
@@ -301,11 +301,11 @@ class nPA_SE(Security_Environment):
|
|||||||
|
|
||||||
result = [[0x86, len(my_token), my_token]]
|
result = [[0x86, len(my_token), my_token]]
|
||||||
if self.at.chat:
|
if self.at.chat:
|
||||||
result.append([0x87, len(self.ca), self.ca])
|
result.append([0x87, len(self.car), self.car])
|
||||||
if (self.disable_checks):
|
if (self.disable_checks):
|
||||||
pace.TA_disable_checks(self.eac_ctx)
|
pace.TA_disable_checks(self.eac_ctx)
|
||||||
else:
|
else:
|
||||||
if not pace.EAC_CTX_init_ta(self.eac_ctx, None, None, self.ca):
|
if not pace.EAC_CTX_init_ta(self.eac_ctx, None, None, self.car):
|
||||||
pace.print_ossl_err()
|
pace.print_ossl_err()
|
||||||
raise SwError(SW["WARN_NOINFO63"])
|
raise SwError(SW["WARN_NOINFO63"])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user