Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: support for Belgian eID cards #104

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
Make the virtual card act slightly more like an actual belpic card
  • Loading branch information
yoe committed Jun 15, 2017
commit ddc0df1bc7080177c545bf761e78ad997ac87319
12 changes: 10 additions & 2 deletions virtualsmartcard/src/vpicc/virtualsmartcard/cards/belpic.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# virtualsmartcard. If not, see <http:https://www.gnu.org/licenses/>.

from virtualsmartcard.VirtualSmartcard import Iso7816OS
from virtualsmartcard.ConstantDefinitions import MAX_SHORT_LE, FDB, LCB
from virtualsmartcard.ConstantDefinitions import MAX_SHORT_LE, FDB, LCB, REF
from virtualsmartcard.SmartcardFilesystem import MF, DF, TransparentStructureEF
from virtualsmartcard.SWutils import SW, SwError

Expand Down Expand Up @@ -53,7 +53,7 @@ def __init__(self, datafile, filedescriptor=FDB["NOTSHAREABLEFILE" ] | FDB["DF"]
tree = ET.parse(datafile)
root = tree.getroot()
ns = {'f': 'urn:be:fedict:eid:dev:virtualcard:1.0'}
DF00 = DF(self, 0xDF00)
DF00 = DF(self, 0xDF00, dfname="A000000177504B43532D3135".decode('hex'))
self.append(DF00)
DF01 = DF(self, 0xDF01)
self.append(DF01)
Expand All @@ -73,6 +73,14 @@ def __init__(self, datafile, filedescriptor=FDB["NOTSHAREABLEFILE" ] | FDB["DF"]
fid = int(id[4:], 16)
parent.append(TransparentStructureEF(parent, fid, data = content.decode('hex')))

def select(self, attribute, value, reference=REF["IDENTIFIER_FIRST"], index_current=0):
if (hasattr(self, attribute) and
((getattr(self, attribute) == value) or
(attribute == 'dfname' and
getattr(self, attribute).startswith(value)))):
return self
return DF.select(self, attribute, value, reference, index_current)

@staticmethod
def create(p1, p2, data):
raise SwError(SW["ERR_INSNOTSUPPORTED"])