opencard.opt.iso.fs
Interface FileSystemCardService
- public abstract interface FileSystemCardService
- extends FileAccessCardService
Interface defining creational methods for file system based smartcards.
Creational methods are methods that support file creation, deletion, and
invalidation. These methods are extensions to the file access methods
specified in ISO 7816-4. A card service has to implement these methods
in order to support the corresponding methods in class CardFile.
For the CardFilePath arguments in the methods defined here, the
restrictions described in FileAccessCardService apply, too.
- See Also:
CardFile
,
FileAccessCardService
create
public void create(CardFilePath parent,
byte[] data)
throws opencard.core.service.CardServiceException,
opencard.core.terminal.CardTerminalException
- Creates a file on the smartcard.
Creating files is a card-specific operation. While the ISO file types
are specified, the access conditions that can be defined are not. When
creating a file, the access conditions to the new file have to be given.
The result is that no card-independent arguments to a create
method can be specified.
This method defines only a card-neutral signature by expecting
a byte array as a parameter. The data to be stored in that byte array
is card-specific. It is suggested, but not required, that a file header,
as it is returned by CardFileInfo.getHeader, is accepted as
that parameter block. A file header typically holds all information
needed for creating a file, in a card-specific encoding. This information
includes the file ID, structure, size, and the access conditions.
This method is intended to be used in a scenario where new applications
have to be downloaded on a smartcard. Typically, a server will be
contacted to retrieve the information about the directories and files
that have to be created. This server can be supplied with the card's ATR,
which is encapsulated by class CardID. The server will then be
able to send parameter blocks that are appropriate arguments for this
method and the respective card.
- Parameters:
parent
- the path to the directory in which to create a new filedata
- the parameters specifying the file to create.
This argument is card-specific. Refer to the documentation
of the card-specific service for details.- Throws:
- opencard.core.service.CardServiceException - if the service encountered an error
- opencard.core.terminal.CardTerminalException - if the terminal encountered an error
- See Also:
FileAccessCardService.getFileInfo(opencard.opt.iso.fs.CardFilePath)
,
CardFileInfo.getHeader()
,
CardID
,
SmartCard.getCardID()
delete
public void delete(CardFilePath file)
throws opencard.core.service.CardServiceException,
opencard.core.terminal.CardTerminalException
- Deletes a file on the smartcard.
Deleting a file completely removes it from the smartcard. The associated
resources on the card, that is the allocated memory, will be freed. It
is not possible to restore the file. A new file with the same id as the
deleted file may be created in the same directory (DF).
- Parameters:
file
- the path to the file to delete- Throws:
- opencard.core.service.CardServiceException - if the service encountered an error
- opencard.core.terminal.CardTerminalException - if the terminal encountered an error
invalidate
public void invalidate(CardFilePath file)
throws opencard.core.service.CardServiceInabilityException,
opencard.core.service.CardServiceException,
opencard.core.terminal.CardTerminalException
- Invalidates a file on the smartcard.
Invalidating a file makes it inaccessible, but leaves it on the card.
The associated resources of the file are not freed. It is not possible
to create a new file with the same id in the same directory (DF).
It may be possible to reverse the invalidation by invoking
rehabilitate.
Since a card service may implement this interface to provide create
and delete access only, a CardServiceInabilityException may
be thrown if invalidation is not supported.
This method should not be implemented by setting all access
conditions of the file to NEVER. Files with access condition NEVER
are often used for internal purposes, for example to hold keys or
application specific executable code. Invalidating a file should make
the card OS ignore the file's contents.
- Parameters:
file
- the path to the file to invalidate- Throws:
- opencard.core.service.CardServiceInabilityException - if the service does not support this operation
- opencard.core.service.CardServiceException - if the service encountered an error
- opencard.core.terminal.CardTerminalException - if the terminal encountered an error
rehabilitate
public void rehabilitate(CardFilePath file)
throws opencard.core.service.CardServiceInabilityException,
opencard.core.service.CardServiceException,
opencard.core.terminal.CardTerminalException
- Rehabilitates a file on the smartcard.
This is the inverse operation to the invalidation of a smartcard file.
It restores the file to the state it had before invalidation. Since a
card service may implement this interface to provide create and
delete access only, a CardServiceInabilityException may be
thrown if rehabilitation is not supported.
- Parameters:
file
- the path to the file to rehabilitate- Throws:
- opencard.core.service.CardServiceInabilityException - if the service does not support this operation
- opencard.core.service.CardServiceException - if the service encountered an error
- opencard.core.terminal.CardTerminalException - if the terminal encountered an error