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

ACList

public class ACList extends Object
This class represents access control list (ACL).

Fields Summary
private byte[]
AID
AID for this ACL.
private Vector
ACEntries
The list of ACEs.
private PINData[]
PINInfo
PIN information for APDU connection.
Constructors Summary
ACList(ACLFileReader r)
Constructs ACL object.

param
r reader for permissions file.
throws
IOException if I/O error occurs.


                        
        

        byte [] aid = new byte[16];

        int count = 0;
        String s = r.readWord();
        while (! s.equals("{")) {
            aid[count++] = (byte) Short.parseShort(s, 16);
            s = r.readWord();
        }

        if (count > 0) {
            AID = new byte[count];
            System.arraycopy(aid, 0, AID,  0, count);
        }

        Vector pin_info = new Vector();

        while (true) {

            s = r.readWord();

            if (s.equals("}")) {
                break;
            }

            if (! s.equals("ace")) {
                throw new IOException();
            }

            ACEntries.addElement(new ACEntry(r, pin_info));
        }

        PINInfo = new PINData[pin_info.size()];
        pin_info.copyInto(PINInfo);
    
Methods Summary
public java.util.VectorgetACEntries()
Returns the list of ACEs.

return
the list of ACEs.

        return ACEntries;
    
voidgetPINs(boolean isAPDU, java.util.Vector result)
Places information about PINs into the vector.

param
isAPDU if true, place APDU PIN data, otherwise - JCRMI PIN data.
param
result the vector for results

        for (int i = 0; i < PINInfo.length; i++) {
            if (isAPDU == (PINInfo[i].commands instanceof Integer[])) {
                result.addElement(PINInfo[i]);
            }
        }
    
public booleanmatch(byte[] selectAPDU)
Verifies if this ACL describes permissions for AID in SELECT APDU.

param
selectAPDU SELECT APDU command data.
return
true if this ACL describes permissions for AID in SELECT APDU.

        return (AID == null) ||
            (AID.length == selectAPDU[4] &&
             Utils.byteMatch(AID, 0, AID.length,
                             selectAPDU, 5, AID.length));