Package pt.gov.cartaodecidadao
Class PTEID_SmartCard
- java.lang.Object
-
- pt.gov.cartaodecidadao.PTEID_Object
-
- pt.gov.cartaodecidadao.PTEID_Card
-
- pt.gov.cartaodecidadao.PTEID_SmartCard
-
- All Implemented Interfaces:
PTEID_SigningDevice
- Direct Known Subclasses:
PTEID_EIDCard
public class PTEID_SmartCard extends PTEID_Card
Abstract base class for Smart card.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longcertificateCount()voiddelete()PTEID_PinsgetPins()longpinCount()intreadFile(java.lang.String fileID, PTEID_ByteArray in)Read a File from the card.
If no pin is passed and a pin is needed by the card, the pin code will be asked anyway.
intreadFile(java.lang.String fileID, PTEID_ByteArray in, PTEID_Pin pin)Read a File from the card.
If no pin is passed and a pin is needed by the card, the pin code will be asked anyway.
intreadFile(java.lang.String fileID, PTEID_ByteArray in, PTEID_Pin pin, java.lang.String csPinCode)Read a File from the card.
If no pin is passed and a pin is needed by the card, the pin code will be asked anyway.
voidselectApplication(PTEID_ByteArray applicationId)Select an application from the cardPTEID_ByteArraysendAPDU(PTEID_ByteArray cmd)Send an APDU command to the card and get the result.PTEID_ByteArraysendAPDU(PTEID_ByteArray cmd, PTEID_Pin pin)Send an APDU command to the card and get the result.PTEID_ByteArraysendAPDU(PTEID_ByteArray cmd, PTEID_Pin pin, java.lang.String csPinCode)Send an APDU command to the card and get the result.booleanwriteFile(java.lang.String fileID, PTEID_ByteArray out)Write a file to the card.
Throw PTEID_ExCmdNotAllowed exception you're not allowed to write the file.
If no pin is passed and a pin is needed by the card, the pin code will be asked anyway.
booleanwriteFile(java.lang.String fileID, PTEID_ByteArray out, PTEID_Pin pin)Write a file to the card.
Throw PTEID_ExCmdNotAllowed exception you're not allowed to write the file.
If no pin is passed and a pin is needed by the card, the pin code will be asked anyway.
booleanwriteFile(java.lang.String fileID, PTEID_ByteArray out, PTEID_Pin pin, java.lang.String csPinCode)Write a file to the card.
Throw PTEID_ExCmdNotAllowed exception you're not allowed to write the file.
If no pin is passed and a pin is needed by the card, the pin code will be asked anyway.
booleanwriteFile(java.lang.String fileID, PTEID_ByteArray out, PTEID_Pin pin, java.lang.String csPinCode, long inOffset)Write a file to the card.
Throw PTEID_ExCmdNotAllowed exception you're not allowed to write the file.
If no pin is passed and a pin is needed by the card, the pin code will be asked anyway.
-
Methods inherited from class pt.gov.cartaodecidadao.PTEID_Card
getAuthentication, getCA, getCert, getCertificates, getDeviceType, getRoot, getSignature, getType, initPaceAuthentication, PTEID_SigningDevice_GetInterfaceCPtr, readFile, readFile, readFile, Sign, Sign, Sign, Sign, SignASiC, SignASiC, SignPDF, SignPDF, SignSHA256, SignSHA256, SignXades, SignXades, SignXadesA, SignXadesAIndividual, SignXadesIndividual, SignXadesT, SignXadesTIndividual, writeFile
-
-
-
-
Method Detail
-
delete
public void delete()
- Overrides:
deletein classPTEID_Card
-
selectApplication
public void selectApplication(PTEID_ByteArray applicationId) throws PTEID_Exception
Select an application from the card- Throws:
PTEID_Exception
-
sendAPDU
public PTEID_ByteArray sendAPDU(PTEID_ByteArray cmd, PTEID_Pin pin, java.lang.String csPinCode) throws PTEID_Exception
Send an APDU command to the card and get the result.- Parameters:
cmd- is the apdu commandpin- is the pin to ask for writingcsPinCode- is the code of the pin (it will be asked if needed and not set)- Returns:
- a PTEID_ByteArray containing the result
- Throws:
PTEID_Exception
-
sendAPDU
public PTEID_ByteArray sendAPDU(PTEID_ByteArray cmd, PTEID_Pin pin) throws PTEID_Exception
Send an APDU command to the card and get the result.- Parameters:
cmd- is the apdu commandpin- is the pin to ask for writing
- Returns:
- a PTEID_ByteArray containing the result
- Throws:
PTEID_Exception
-
sendAPDU
public PTEID_ByteArray sendAPDU(PTEID_ByteArray cmd) throws PTEID_Exception
Send an APDU command to the card and get the result.- Overrides:
sendAPDUin classPTEID_Card- Parameters:
cmd- is the apdu command
- Returns:
- a PTEID_ByteArray containing the result
- Throws:
PTEID_Exception
-
readFile
public int readFile(java.lang.String fileID, PTEID_ByteArray in, PTEID_Pin pin, java.lang.String csPinCode) throws PTEID_ExceptionRead a File from the card.
If no pin is passed and a pin is needed by the card, the pin code will be asked anyway.
- Parameters:
fileID- is the path of the filein- return the filepin- is the pin to ask for readingcsPinCode- is the code of the pin (it will be asked if needed and not set)- Throws:
PTEID_Exception
-
readFile
public int readFile(java.lang.String fileID, PTEID_ByteArray in, PTEID_Pin pin) throws PTEID_ExceptionRead a File from the card.
If no pin is passed and a pin is needed by the card, the pin code will be asked anyway.
- Parameters:
fileID- is the path of the filein- return the filepin- is the pin to ask for reading- Throws:
PTEID_Exception
-
readFile
public int readFile(java.lang.String fileID, PTEID_ByteArray in) throws PTEID_ExceptionRead a File from the card.
If no pin is passed and a pin is needed by the card, the pin code will be asked anyway.
- Parameters:
fileID- is the path of the filein- return the file
- Throws:
PTEID_Exception
-
writeFile
public boolean writeFile(java.lang.String fileID, PTEID_ByteArray out, PTEID_Pin pin, java.lang.String csPinCode, long inOffset) throws PTEID_ExceptionWrite a file to the card.
Throw PTEID_ExCmdNotAllowed exception you're not allowed to write the file.
If no pin is passed and a pin is needed by the card, the pin code will be asked anyway.
- Parameters:
fileID- is the path of the fileout- contents the bytes to writepin- is the pin to ask for writingcsPinCode- is the code of the pin (it will be asked if needed and not set)inOffset- is the offset of the data to be written to the file- Throws:
PTEID_Exception
-
writeFile
public boolean writeFile(java.lang.String fileID, PTEID_ByteArray out, PTEID_Pin pin, java.lang.String csPinCode) throws PTEID_ExceptionWrite a file to the card.
Throw PTEID_ExCmdNotAllowed exception you're not allowed to write the file.
If no pin is passed and a pin is needed by the card, the pin code will be asked anyway.
- Parameters:
fileID- is the path of the fileout- contents the bytes to writepin- is the pin to ask for writingcsPinCode- is the code of the pin (it will be asked if needed and not set)- Throws:
PTEID_Exception
-
writeFile
public boolean writeFile(java.lang.String fileID, PTEID_ByteArray out, PTEID_Pin pin) throws PTEID_ExceptionWrite a file to the card.
Throw PTEID_ExCmdNotAllowed exception you're not allowed to write the file.
If no pin is passed and a pin is needed by the card, the pin code will be asked anyway.
- Parameters:
fileID- is the path of the fileout- contents the bytes to writepin- is the pin to ask for writing
- Throws:
PTEID_Exception
-
writeFile
public boolean writeFile(java.lang.String fileID, PTEID_ByteArray out) throws PTEID_ExceptionWrite a file to the card.
Throw PTEID_ExCmdNotAllowed exception you're not allowed to write the file.
If no pin is passed and a pin is needed by the card, the pin code will be asked anyway.
- Overrides:
writeFilein classPTEID_Card- Parameters:
fileID- is the path of the fileout- contents the bytes to write
- Throws:
PTEID_Exception
-
pinCount
public long pinCount() throws PTEID_Exception- Returns:
- the number of pins on the card.
- Throws:
PTEID_Exception
-
getPins
public PTEID_Pins getPins() throws PTEID_Exception
- Returns:
- an object to access all the pins on the card.
- Throws:
PTEID_Exception
-
certificateCount
public long certificateCount() throws PTEID_Exception- Returns:
- the number of certificate on the card.
- Throws:
PTEID_Exception
-
-