public abstract class EidCard extends Object
Modifier and Type | Field and Description |
---|---|
protected static int |
BLOCK_SIZE |
protected javax.smartcardio.Card |
card |
protected javax.smartcardio.CardChannel |
channel |
protected static byte[] |
DOCUMENT_FILE
Document data
|
protected static org.slf4j.Logger |
logger |
protected static byte[] |
PERSONAL_FILE
Personal data
|
protected static byte[] |
PHOTO_FILE
Personal photo in JPEG format
|
protected static byte[] |
RESIDENCE_FILE
Place of residence
|
Modifier | Constructor and Description |
---|---|
protected |
EidCard(javax.smartcardio.Card card) |
Modifier and Type | Method and Description |
---|---|
protected Map<Integer,byte[]> |
addAllToBuilder(EidInfo.Builder builder,
Map<Integer,byte[]> rawTagMap,
Map<Integer,EidInfo.Tag> tagMapper)
Add all raw tags to EidInfo builder.
|
String |
debugEidInfo()
Returns a debug string consisting of per-file debug info.
|
void |
disconnect()
Disconnects, but doesn't reset the card.
|
void |
disconnect(boolean reset) |
protected void |
finalize() |
static EidCard |
fromCard(javax.smartcardio.Card card)
Factory method
Return instance of EidCard implementation supporting the given card
|
protected static boolean |
isKnownAtr(byte[] atrBytes)
Factory "selection" method
|
static Map<Integer,byte[]> |
parseTlv(byte[] bytes)
Subdivides the byte array into byte sub-arrays, keyed by their tags
Encoding sequence is a repeated sequence of the following.
|
protected byte[] |
readBinary(int offset,
int length)
Reads the content of the selected file starting at offset, at most length bytes
|
EidInfo |
readEidInfo() |
Image |
readEidPhoto()
Reads the photo data from the card.
|
protected abstract byte[] |
readElementaryFile(byte[] name,
boolean strip_tag)
Read EF contents, selecting by file path.
|
protected byte[] |
selectFile(byte[] name)
Selects the elementary file to read, based on the name passed in.
|
protected byte[] |
selectFile(byte[] name,
int ne) |
protected static final org.slf4j.Logger logger
protected javax.smartcardio.Card card
protected javax.smartcardio.CardChannel channel
protected static final byte[] DOCUMENT_FILE
protected static final byte[] PERSONAL_FILE
protected static final byte[] RESIDENCE_FILE
protected static final byte[] PHOTO_FILE
protected static final int BLOCK_SIZE
public static EidCard fromCard(javax.smartcardio.Card card) throws IllegalArgumentException, SecurityException, IllegalStateException, javax.smartcardio.CardException
card
- SecurityException
IllegalStateException
IllegalArgumentException
- Card is not regognized as Serbian eIDjavax.smartcardio.CardException
protected static boolean isKnownAtr(byte[] atrBytes)
public static Map<Integer,byte[]> parseTlv(byte[] bytes)
protected abstract byte[] readElementaryFile(byte[] name, boolean strip_tag) throws javax.smartcardio.CardException
javax.smartcardio.CardException
protected byte[] readBinary(int offset, int length) throws javax.smartcardio.CardException
javax.smartcardio.CardException
protected byte[] selectFile(byte[] name) throws javax.smartcardio.CardException
javax.smartcardio.CardException
protected byte[] selectFile(byte[] name, int ne) throws javax.smartcardio.CardException
javax.smartcardio.CardException
public Image readEidPhoto() throws javax.smartcardio.CardException
javax.smartcardio.CardException
protected Map<Integer,byte[]> addAllToBuilder(EidInfo.Builder builder, Map<Integer,byte[]> rawTagMap, Map<Integer,EidInfo.Tag> tagMapper)
builder
- EidInfo builderrawTagMap
- Parsed map of raw byte strings by TLV codetagMapper
- Map translating Tag codes into EidInfo tags; use Tag.NULL
if tag should be silently ignoredpublic EidInfo readEidInfo() throws javax.smartcardio.CardException
javax.smartcardio.CardException
public String debugEidInfo() throws javax.smartcardio.CardException
javax.smartcardio.CardException
public void disconnect() throws javax.smartcardio.CardException
javax.smartcardio.CardException
public void disconnect(boolean reset) throws javax.smartcardio.CardException
javax.smartcardio.CardException
Copyright © 2017 Open Source Developer, Goran Rakic. All rights reserved.