nPA: use given credentials for CA
The user can now specify an EF.CardSecurity, CA private/public key and CHR of the trust anchor via the command line.
This commit is contained in:
@@ -60,9 +60,42 @@ relay.add_argument("-r", "--reader",
|
||||
type=int,
|
||||
help="number of the reader which contains the smart card to be relayed.")
|
||||
|
||||
npa = parser.add_argument_group('options for nPA emulation')
|
||||
npa.add_argument("-e", "--ef-cardsecurity",
|
||||
action="store",
|
||||
type=argparse.FileType('r'),
|
||||
help="EF.CardSecurity with the signed CA public key.")
|
||||
npa.add_argument("-k", "--ca-key",
|
||||
action="store",
|
||||
type=argparse.FileType('r'),
|
||||
help="CA private key.")
|
||||
npa.add_argument("-p", "--ca-pubkey",
|
||||
action="store",
|
||||
type=argparse.FileType('r'),
|
||||
help="CA public key.")
|
||||
npa.add_argument("-c", "--ca",
|
||||
action="store",
|
||||
type=str,
|
||||
help="CHR of the CVCA.")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
from virtualsmartcard.VirtualSmartcard import VirtualICC
|
||||
|
||||
ef_cardsecurity_data = None
|
||||
ca_key_data = None
|
||||
ca_pubkey_data = None
|
||||
if (args.ef_cardsecurity):
|
||||
ef_cardsecurity_data = args.ef_cardsecurity.read()
|
||||
args.ef_cardsecurity.close()
|
||||
if (args.ca_key):
|
||||
ca_key_data = args.ca_key.read()
|
||||
args.ca_key.close()
|
||||
if (args.ca_pubkey):
|
||||
ca_pubkey_data = args.ca_pubkey.read()
|
||||
args.ca_pubkey.close()
|
||||
vicc = VirtualICC(args.file, args.type,
|
||||
args.hostname, args.port, readernum=args.reader)
|
||||
args.hostname, args.port, readernum=args.reader,
|
||||
ef_cardsecurity=ef_cardsecurity_data, ca_pubkey=ca_pubkey_data,
|
||||
ca_key=ca_key_data, ca=args.ca)
|
||||
vicc.run()
|
||||
|
||||
Reference in New Issue
Block a user