grouped virtual smartcard objects in virtualsmartcard package
git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@325 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -1,22 +1,26 @@
|
||||
EXTRA_DIST = virtualsmartcard.in
|
||||
EXTRA_DIST = vicc.in
|
||||
|
||||
vpiccdir = $(pythondir)
|
||||
vpiccdir = $(pythondir)/virtualsmartcard
|
||||
|
||||
vpicc_PYTHON = CardGenerator.py SEutils.py TLVutils.py ConstantDefinitions.py \
|
||||
SmartcardFilesystem.py utils.py CryptoUtils.py SmartcardSAM.py \
|
||||
SWutils.py VirtualSmartcard.py
|
||||
vpicc_PYTHON = virtualsmartcard/CardGenerator.py \
|
||||
virtualsmartcard/SEutils.py \
|
||||
virtualsmartcard/TLVutils.py \
|
||||
virtualsmartcard/ConstantDefinitions.py \
|
||||
virtualsmartcard/SmartcardFilesystem.py \
|
||||
virtualsmartcard/utils.py \
|
||||
virtualsmartcard/CryptoUtils.py \
|
||||
virtualsmartcard/SmartcardSAM.py \
|
||||
virtualsmartcard/SWutils.py \
|
||||
virtualsmartcard/VirtualSmartcard.py \
|
||||
virtualsmartcard/__init__.py
|
||||
|
||||
all-local:
|
||||
perl -ne "s|PYTHONDIR|$(pythondir)| ; print" $(srcdir)/virtualsmartcard.in > tmp
|
||||
perl -ne "s|PYTHONBIN|$(PYTHON)| ; print" tmp > virtualsmartcard
|
||||
rm -f tmp
|
||||
|
||||
install-exec-local: all-local
|
||||
perl -ne "s|PYTHONBIN|$(PYTHON)| ; print" vicc.in > vicc
|
||||
$(mkinstalldirs) $(DESTDIR)$(bindir)
|
||||
$(INSTALL_SCRIPT) virtualsmartcard $(DESTDIR)$(bindir)/virtualsmartcard
|
||||
$(INSTALL_SCRIPT) vicc $(DESTDIR)$(bindir)/vicc
|
||||
|
||||
uninstall-local:
|
||||
rm -f $(DESTDIR)$(bindir)/virtualsmartcard
|
||||
rm -f $(DESTDIR)$(bindir)/vicc
|
||||
|
||||
clean-local:
|
||||
rm -f virtualsmartcard
|
||||
rm -f vicc
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
import sys, getpass, anydbm, readline, os, dircache
|
||||
from pickle import loads, dumps
|
||||
from TLVutils import pack
|
||||
from utils import inttostring
|
||||
from SmartcardFilesystem import *
|
||||
from virtualsmartcard.utils import inttostring
|
||||
from virtualsmartcard.SmartcardFilesystem import *
|
||||
|
||||
# pgp directory
|
||||
#self.mf.append(DF(parent=self.mf,
|
||||
@@ -42,7 +42,7 @@ class CardGenerator(object):
|
||||
self.sam = None
|
||||
|
||||
def __generate_iso_card(self):
|
||||
from SmartcardSAM import SAM
|
||||
from virtualsmartcard.SmartcardSAM import SAM
|
||||
|
||||
print "Using default SAM. Insecure!!!"
|
||||
self.sam = SAM("1234", "1234567890") #FIXME: Use user provided data
|
||||
@@ -52,7 +52,7 @@ class CardGenerator(object):
|
||||
|
||||
def __generate_ePass(self):
|
||||
from PIL import Image
|
||||
from SmartcardSAM import PassportSAM
|
||||
from virtualsmartcard.SmartcardSAM import PassportSAM
|
||||
|
||||
MRZ = raw_input("Please enter the MRZ as one string: ") #TODO: Sanity checks
|
||||
|
||||
@@ -114,7 +114,7 @@ class CardGenerator(object):
|
||||
self.sam = PassportSAM(self.mf)
|
||||
|
||||
def __generate_cryptoflex(self):
|
||||
from SmartcardSAM import CryptoflexSAM
|
||||
from virtualsmartcard.SmartcardSAM import CryptoflexSAM
|
||||
|
||||
self.mf = CryptoflexMF()
|
||||
self.mf.append(TransparentStructureEF(parent=self.mf, fid=0x0002, filedescriptor=0x01,
|
||||
@@ -144,7 +144,7 @@ class CardGenerator(object):
|
||||
|
||||
|
||||
def loadCard(self, filename, password=None):
|
||||
from CryptoUtils import read_protected_string
|
||||
from virtualsmartcard.CryptoUtils import read_protected_string
|
||||
|
||||
try:
|
||||
db = anydbm.open(filename, 'r')
|
||||
@@ -161,7 +161,7 @@ class CardGenerator(object):
|
||||
self.type = db["type"]
|
||||
|
||||
def saveCard(self, filename, password=None):
|
||||
from CryptoUtils import protect_string
|
||||
from virtualsmartcard.CryptoUtils import protect_string
|
||||
|
||||
if password is None:
|
||||
passwd1 = getpass.getpass("Please enter a password.")
|
||||
@@ -21,7 +21,7 @@ from Crypto.Cipher import DES3, DES, AES, ARC4 #,IDEA no longer present in pytho
|
||||
from struct import pack
|
||||
from binascii import b2a_hex
|
||||
from random import randint
|
||||
from utils import inttostring, stringtoint, hexdump
|
||||
from virtualsmartcard.utils import inttostring, stringtoint, hexdump
|
||||
import string
|
||||
import re
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# virtualsmartcard. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
import TLVutils
|
||||
import virtualsmartcard.TLVutils
|
||||
from time import time
|
||||
from random import seed, randint
|
||||
from ConstantDefinitions import *
|
||||
from utils import inttostring, stringtoint
|
||||
from virtualsmartcard.ConstantDefinitions import *
|
||||
from virtualsmartcard.utils import inttostring, stringtoint
|
||||
|
||||
class ControlReferenceTemplate:
|
||||
def __init__(self,type,config=""):
|
||||
@@ -21,10 +21,10 @@
|
||||
@todo zu lange daten abschneiden und trotzdem tlv laenge beibehalten
|
||||
"""
|
||||
from pickle import dumps, loads
|
||||
from ConstantDefinitions import *
|
||||
from TLVutils import *
|
||||
from SWutils import *
|
||||
from utils import stringtoint, inttostring
|
||||
from virtualsmartcard.ConstantDefinitions import *
|
||||
from virtualsmartcard.TLVutils import *
|
||||
from virtualsmartcard.SWutils import *
|
||||
from virtualsmartcard.utils import stringtoint, inttostring
|
||||
|
||||
def isEqual(list): # {{{
|
||||
"""Returns True, if all items are equal, otherwise False"""
|
||||
1261
virtualsmartcard/src/vpicc/virtualsmartcard/SmartcardSAM.py
Normal file
1261
virtualsmartcard/src/vpicc/virtualsmartcard/SmartcardSAM.py
Normal file
File diff suppressed because it is too large
Load Diff
@@ -16,12 +16,12 @@
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# virtualsmartcard. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
from ConstantDefinitions import *
|
||||
from TLVutils import *
|
||||
from SWutils import SwError, SW
|
||||
from SmartcardFilesystem import prettyprint_anything, MF, DF, CryptoflexMF, TransparentStructureEF, make_property
|
||||
from utils import C_APDU, R_APDU, hexdump, inttostring
|
||||
from SmartcardSAM import SAM, PassportSAM, CryptoflexSAM
|
||||
from virtualsmartcard.ConstantDefinitions import *
|
||||
from virtualsmartcard.TLVutils import *
|
||||
from virtualsmartcard.SWutils import SwError, SW
|
||||
from virtualsmartcard.SmartcardFilesystem import prettyprint_anything, MF, DF, CryptoflexMF, TransparentStructureEF, make_property
|
||||
from virtualsmartcard.utils import C_APDU, R_APDU, hexdump, inttostring
|
||||
from virtualsmartcard.SmartcardSAM import SAM, PassportSAM, CryptoflexSAM
|
||||
import CardGenerator
|
||||
from smartcard.CardMonitoring import CardMonitor, CardObserver
|
||||
|
||||
@@ -579,28 +579,3 @@ class VirtualICC(object): # {{{
|
||||
self.cardGenerator.setCard(self.os.mf, self.os.SAM)
|
||||
self.cardGenerator.saveCard(self.filename)
|
||||
# }}}
|
||||
|
||||
if __name__ == "__main__":
|
||||
from optparse import OptionParser
|
||||
parser = OptionParser()
|
||||
parser.add_option("-t", "--type", action="store", type="choice",
|
||||
default='iso7816',
|
||||
choices=['iso7816', 'cryptoflex', 'ePass', 'relay'],
|
||||
help="Type of Smartcard [default: %default]")
|
||||
parser.add_option("-r", "--reader", action="store", type="int",
|
||||
default=None,
|
||||
help="Number of reader for relaying")
|
||||
parser.add_option("-f", "--file", action="store", type="string",
|
||||
default=None,
|
||||
help="Load a saved card")
|
||||
parser.add_option("-n", "--hostname", action="store", type="string",
|
||||
default='localhost',
|
||||
help="Address of Virtual PCD [default: %default]")
|
||||
parser.add_option("-p", "--port", action="store", type="int",
|
||||
default=35963,
|
||||
help="Port of Virtual PCD [default: %default]")
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
vicc = VirtualICC(options.file, options.type, options.hostname,
|
||||
options.port, readernum=options.reader)
|
||||
vicc.run()
|
||||
Reference in New Issue
Block a user