com.licel.jcardsim.samples.SecureRMIDemo
Class MySecurityService

java.lang.Object
  extended by javacard.framework.service.BasicService
      extended by com.licel.jcardsim.samples.SecureRMIDemo.MySecurityService
All Implemented Interfaces:
SecurityService, Service

public class MySecurityService
extends BasicService
implements SecurityService


Field Summary
 
Fields inherited from interface javacard.framework.service.SecurityService
PRINCIPAL_APP_PROVIDER, PRINCIPAL_CARD_ISSUER, PRINCIPAL_CARDHOLDER, PROPERTY_INPUT_CONFIDENTIALITY, PROPERTY_INPUT_INTEGRITY, PROPERTY_OUTPUT_CONFIDENTIALITY, PROPERTY_OUTPUT_INTEGRITY
 
Constructor Summary
MySecurityService()
           
 
Method Summary
 boolean isAuthenticated(short principal)
          Checks whether or not the specified principal is currently authenticated.
 boolean isChannelSecure(byte prop)
           
 boolean isCommandSecure(byte properties)
          Checks whether a secure channel is in use between the card and the host for the ongoing command that guarantees the indicated properties.
 boolean processCommand(APDU apdu)
           
 boolean processDataIn(APDU apdu)
          Pre-processes the input data for the command in the APDU object.
 boolean processDataOut(APDU apdu)
           
 
Methods inherited from class javacard.framework.service.BasicService
fail, getCLA, getINS, getOutputLength, getP1, getP2, getStatusWord, isProcessed, receiveInData, selectingApplet, setOutputLength, setProcessed, setStatusWord, succeed, succeedWithStatusWord
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MySecurityService

public MySecurityService()
Method Detail

processDataIn

public boolean processDataIn(APDU apdu)
Pre-processes the input data for the command in the APDU object. When invoked, the APDU object should either be in STATE_INITIAL with the APDU buffer in the Init format or in STATE_FULL_INCOMING with the APDU buffer in the Input Ready format defined in BasicService.

The method must return true if no more pre-processing should be performed, and false otherwise. In particular, it must return false if it has not performed any processing on the command.

After normal completion, the APDU object is usually in STATE_FULL_INCOMING with the APDU buffer in the Input Ready format defined in BasicService. However, in some cases if the Service processes the command entirely, the APDU object may be in STATE_OUTGOING with the APDU buffer in the Output Ready format defined in BasicService.

Specified by:
processDataIn in interface Service
Overrides:
processDataIn in class BasicService
Parameters:
apdu - the APDU object containing the command being processed.
Returns:
true if input processing is finished, false otherwise.

isCommandSecure

public boolean isCommandSecure(byte properties)
                        throws ServiceException
Checks whether a secure channel is in use between the card and the host for the ongoing command that guarantees the indicated properties. The result is only correct after pre-processing the command (for instance during the processing of the command). For properties on incoming data, the result is guaranteed to be correct; for outgoing data, the result reflects the expectations of the client software, with no other guarantee.

Specified by:
isCommandSecure in interface SecurityService
Parameters:
properties - the required properties.
Returns:
true if the required properties are true, false othewise
Throws:
ServiceException - with the following reason code:
  • ServiceException.ILLEGAL_PARAM if the specified property is unknown.

isAuthenticated

public boolean isAuthenticated(short principal)
                        throws ServiceException
Checks whether or not the specified principal is currently authenticated. The validity timeframe(selection or reset) and authentication method as well as the exact interpretation of the specified principal parameter needs to be detailed by the implementation class. The only generic guarantee is that the authentication has been performed in the current card session.

Specified by:
isAuthenticated in interface SecurityService
Parameters:
principal - an identifier of the principal that needs to be authenticated
Returns:
true if the expected principal is authenticated
Throws:
ServiceException - with the following reason code:
  • ServiceException.ILLEGAL_PARAM if the specified principal is unknown.

processCommand

public boolean processCommand(APDU apdu)
Specified by:
processCommand in interface Service
Overrides:
processCommand in class BasicService

processDataOut

public boolean processDataOut(APDU apdu)
Specified by:
processDataOut in interface Service
Overrides:
processDataOut in class BasicService

isChannelSecure

public boolean isChannelSecure(byte prop)
Specified by:
isChannelSecure in interface SecurityService