eID middleware |

# be.portugal.eid.PTEID_SmartCard Class Reference

Base class for a Smart card. More...

Inheritance diagram for be.portugal.eid.PTEID_SmartCard:

List of all members.

## Public Member Functions

synchronized void | delete ()
void | selectApplication (PTEID_ByteArray applicationId) throws java.lang.Exception
| Select an application from the card.
PTEID_ByteArray | sendAPDU (PTEID_ByteArray cmd, PTEID_Pin pin, String csPinCode) throws java.lang.Exception
| Send an APDU command to the card and get the result.
PTEID_ByteArray | sendAPDU (PTEID_ByteArray cmd, PTEID_Pin pin) throws java.lang.Exception
| Send an APDU command to the card and get the result.
PTEID_ByteArray | sendAPDU (PTEID_ByteArray cmd) throws java.lang.Exception
| Send an APDU command to the card and get the result.
int | readFile (String fileID, PTEID_ByteArray in, PTEID_Pin pin, String csPinCode) throws java.lang.Exception
| Read a File from the card.
int | readFile (String fileID, PTEID_ByteArray in, PTEID_Pin pin) throws java.lang.Exception
| Read a File from the card.
int | readFile (String fileID, PTEID_ByteArray in) throws java.lang.Exception
| Read a File from the card.
boolean | writeFile (String fileID, PTEID_ByteArray out, PTEID_Pin pin, String csPinCode) throws java.lang.Exception
| Write a file to the card Throw PTEID_ExCmdNotAllowed exception you're not allowed to write the file.
boolean | writeFile (String fileID, PTEID_ByteArray out, PTEID_Pin pin) throws java.lang.Exception
| Write a file to the card Throw PTEID_ExCmdNotAllowed exception you're not allowed to write the file.
boolean | writeFile (String fileID, PTEID_ByteArray out) throws java.lang.Exception
| Write a file to the card Throw PTEID_ExCmdNotAllowed exception you're not allowed to write the file.
long | pinCount () throws java.lang.Exception
| Return the number of pins on the card.
PTEID_Pins | getPins () throws java.lang.Exception
| Return an object to access all the pins on the card.
long | certificateCount () throws java.lang.Exception
| Return the number of certificates on the card.
PTEID_Certificates | getCertificates () throws java.lang.Exception
| Return an object to access all the certificates on the card.
PTEID_ByteArray | getChallenge (boolean bForceNewInit) throws java.lang.Exception
| Get the challenge.
PTEID_ByteArray | getChallenge () throws java.lang.Exception
| Get the challenge.
PTEID_ByteArray | getChallengeResponse () throws java.lang.Exception
| Get the response to the challenge.
boolean | verifyChallengeResponse (PTEID_ByteArray challenge, PTEID_ByteArray response) throws java.lang.Exception
| Verify the challenge-response.

## Protected Member Functions

| PTEID_SmartCard (long cPtr, boolean cMemoryOwn)
void | finalize ()

## Static Protected Member Functions

static long | getCPtr (PTEID_SmartCard obj)

## Detailed Description

Base class for a Smart card.

## Constructor & Destructor Documentation

be.portugal.eid.PTEID_SmartCard.PTEID_SmartCard | ( | long | cPtr,
|  | boolean | cMemoryOwn |
| ) |  |  | `[protected]`

## Member Function Documentation

long be.portugal.eid.PTEID_SmartCard.certificateCount | ( |  | ) | throws java.lang.Exception

Return the number of certificates on the card.

synchronized void be.portugal.eid.PTEID_SmartCard.delete | ( |  | ) |

Reimplemented from be.portugal.eid.PTEID_Card.

Reimplemented in be.portugal.eid.PTEID_EIDCard, be.portugal.eid.PTEID_ForeignerCard, and be.portugal.eid.PTEID_KidsCard.

References be.portugal.eid.PTEID_Object.swigCMemOwn.

void be.portugal.eid.PTEID_SmartCard.finalize | ( |  | ) | `[protected]`

Reimplemented from be.portugal.eid.PTEID_Card.

Reimplemented in be.portugal.eid.PTEID_EIDCard, be.portugal.eid.PTEID_ForeignerCard, and be.portugal.eid.PTEID_KidsCard.

PTEID_Certificates be.portugal.eid.PTEID_SmartCard.getCertificates | ( |  | ) | throws java.lang.Exception

Return an object to access all the certificates on the card.

PTEID_ByteArray be.portugal.eid.PTEID_SmartCard.getChallenge | ( |  | ) | throws java.lang.Exception

Get the challenge.

PTEID_ByteArray be.portugal.eid.PTEID_SmartCard.getChallenge | ( | boolean | bForceNewInit | ) | throws java.lang.Exception

Get the challenge.

Parameters:

  | bForceNewInit | force a new initialization of the couple challenge/response

PTEID_ByteArray be.portugal.eid.PTEID_SmartCard.getChallengeResponse | ( |  | ) | throws java.lang.Exception

Get the response to the challenge.

static long be.portugal.eid.PTEID_SmartCard.getCPtr | ( | PTEID_SmartCard | obj | ) | `[static, protected]`

References be.portugal.eid.PTEID_SmartCard.swigCPtr.

PTEID_Pins be.portugal.eid.PTEID_SmartCard.getPins | ( |  | ) | throws java.lang.Exception

Return an object to access all the pins on the card.

long be.portugal.eid.PTEID_SmartCard.pinCount | ( |  | ) | throws java.lang.Exception

Return the number of pins on the card.

int be.portugal.eid.PTEID_SmartCard.readFile | ( | String | fileID,
|  | PTEID_ByteArray | in |
| ) |  |  | throws java.lang.Exception

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

Parameters:

  | fileID | is the path of the file
  | in | return the file

int be.portugal.eid.PTEID_SmartCard.readFile | ( | String | fileID,
|  | PTEID_ByteArray | in,
|  | PTEID_Pin | pin |
| ) |  |  | throws java.lang.Exception

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

Parameters:

  | fileID | is the path of the file
  | in | return the file
  | pin | is the pin to ask for writing

int be.portugal.eid.PTEID_SmartCard.readFile | ( | String | fileID,
|  | PTEID_ByteArray | in,
|  | PTEID_Pin | pin,
|  | String | csPinCode |
| ) |  |  | throws java.lang.Exception

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

Parameters:

  | fileID | is the path of the file
  | in | return the file
  | pin | is the pin to ask for writing
  | csPinCode | is the code of the pin (it will be asked if needed and not set)

void be.portugal.eid.PTEID_SmartCard.selectApplication | ( | PTEID_ByteArray | applicationId | ) | throws java.lang.Exception

Select an application from the card.

PTEID_ByteArray be.portugal.eid.PTEID_SmartCard.sendAPDU | ( | PTEID_ByteArray | cmd | ) | throws java.lang.Exception

Send an APDU command to the card and get the result.

Parameters:

  | cmd | is the apdu command

Returns:
  a PTEID_ByteArray containing the result

Reimplemented from be.portugal.eid.PTEID_Card.

PTEID_ByteArray be.portugal.eid.PTEID_SmartCard.sendAPDU | ( | PTEID_ByteArray | cmd,
|  | PTEID_Pin | pin |
| ) |  |  | throws java.lang.Exception

Send an APDU command to the card and get the result.

Parameters:

  | cmd | is the apdu command
  | pin | is the pin to ask for writing

Returns:
  a PTEID_ByteArray containing the result

PTEID_ByteArray be.portugal.eid.PTEID_SmartCard.sendAPDU | ( | PTEID_ByteArray | cmd,
|  | PTEID_Pin | pin,
|  | String | csPinCode |
| ) |  |  | throws java.lang.Exception

Send an APDU command to the card and get the result.

Parameters:

  | cmd | is the apdu command
  | pin | is the pin to ask for writing
  | csPinCode | is the code of the pin (it will be asked if needed and not set)

Returns:
  a PTEID_ByteArray containing the result

boolean be.portugal.eid.PTEID_SmartCard.verifyChallengeResponse | ( | PTEID_ByteArray | challenge,
|  | PTEID_ByteArray | response |
| ) |  |  | throws java.lang.Exception

Verify the challenge-response.

Parameters:

  | challenge | is the challenge to check
  | response | is the response expected from the card

Returns:
  true if the response of the card to the given challenge is the same as the response expected For virtual cards (=from file), always return false

boolean be.portugal.eid.PTEID_SmartCard.writeFile | ( | String | fileID,
|  | PTEID_ByteArray | out |
| ) |  |  | throws java.lang.Exception

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

Parameters:

  | fileID | is the path of the file
  | out | contents the bytes to write

Reimplemented from be.portugal.eid.PTEID_Card.

boolean be.portugal.eid.PTEID_SmartCard.writeFile | ( | String | fileID,
|  | PTEID_ByteArray | out,
|  | PTEID_Pin | pin |
| ) |  |  | throws java.lang.Exception

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

Parameters:

  | fileID | is the path of the file
  | out | contents the bytes to write
  | pin | is the pin to ask for writing

boolean be.portugal.eid.PTEID_SmartCard.writeFile | ( | String | fileID,
|  | PTEID_ByteArray | out,
|  | PTEID_Pin | pin,
|  | String | csPinCode |
| ) |  |  | throws java.lang.Exception

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

Parameters:

  | fileID | is the path of the file
  | out | contents the bytes to write
  | pin | is the pin to ask for writing
  | csPinCode | is the code of the pin (it will be asked if needed and not set)