FileDocCategorySizeDatePackage
APDUPermissions.javaAPI DocphoneME MR2 API (J2ME)3217Wed May 02 18:00:38 BST 2007com.sun.satsa.acl

APDUPermissions

public class APDUPermissions extends ACLPermissions
This class represents a set of APDU permissions.

Fields Summary
private static int[]
defaultPINCommand
Contains default APDU headers for PIN operations.
Constructors Summary
public APDUPermissions(ACSlot parent)
Constructs new object.

param
parent parent ACFile object.

        super(parent);
    
Methods Summary
public voidcheckPermission(int apdu)
Verifies that the MIDlet have permission for this APDU command.

param
apdu the command header.
throws
SecurityException if access denied


        if (type == ALLOW) {
            return;
        }
        if (type == DISALLOW) {
            throw new SecurityException("Access denied");
        }

        for (int i = 0; i < permissions.size(); i++) {

            int[] data = (int[]) permissions.elementAt(i);

            for (int k = 0; k < data.length; k = k + 2) {
                if ((apdu & data[k + 1]) == data[k]) {
                    return;
                }
            }
        }
        throw new SecurityException("Access denied: " +
                                    Integer.toHexString(apdu));
    
public intpreparePIN(int id, int uid, int action)
Returns APDU header for given PIN and PIN operation. Initializes internal variables, verifies that operation is supported and permitted.

param
id PIN identifier.
param
uid unblocking PIN identifier.
param
action PIN operation code.
return
APDU header encoded as integer.
throws
java.lang.SecurityException if access denied


                                                     
            

        checkPINOperation(id, uid, action);
        Integer result = (Integer) getPINCommand(id, action);
        int command = result != null ? result.intValue() :
                defaultPINCommand[action] | (attr1.pinReference & 0xff);
        checkPermission(command);
        return command;