Top Description Fields Constructors Methods
javax.smartcardio

public Class CardPermission

extends Permission
Class Inheritance
Imports
java.io.*, java.util.StringJoiner, java.security.Permission

A permission for Smart Card operations. A CardPermission consists of the name of the card terminal the permission applies to and a set of actions that are valid for that terminal.

A CardPermission with a name of * applies to all card terminals. The actions string is a comma separated list of the actions listed below, or * to signify "all actions."

Individual actions are:

connect
connect to a card using CardTerminal.connect()
reset
reset the card using Card.disconnect(true)
exclusive
establish exclusive access to a card using Card#beginExclusive and endExclusive()
transmitControl
transmit a control command using Card.transmitControlCommand()
getBasicChannel
obtain the basic logical channel using Card#getBasicChannel
openLogicalChannel
open a new logical channel using Card#openLogicalChannel
Authors
Andreas Sterbenz, JSR 268 Expert Group
Since
1.6

Field Summary

Modifier and TypeField and Description
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private final String
private static final int[]
private static final String[]
private transient int
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final long

Constructor Summary

AccessConstructor and Description
public
CardPermission(String
the name of the card terminal, or *
terminalName
,
String
the action string (or null if the set of permitted actions is empty)
actions
)

Constructs a new CardPermission with the specified actions.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if and only if the specified object is equal to this CardPermission
equals
(Object
the object to be compared for equality with this CardPermission
obj
)

Implements abstract java.security.Permission.equals.

Compares the specified object with this CardPermission for equality.

private static String
getActions(int mask)

public String

Returns:

the canonical string representation of the actions.
getActions
()

Implements abstract java.security.Permission.getActions.

Returns the canonical string representation of the actions.

private static int
getMask(String actions)

public int

Returns:

the hash code value for this CardPermission object.
hashCode
()

Implements abstract java.security.Permission.hashCode.

Returns the hash code value for this CardPermission object.

public boolean

Returns:

true if and only if this CardPermission object implies the specified permission.
implies
(Permission
the permission to check against
permission
)

Implements abstract java.security.Permission.implies.

Checks if this CardPermission object implies the specified permission.

private void
private void
Inherited from java.security.Permission:
checkGuardgetNamenewPermissionCollectiontoString

Field Detail

A_ALLback to summary
private static final int A_ALL
A_CONNECTback to summary
private static final int A_CONNECT
A_EXCLUSIVEback to summary
private static final int A_EXCLUSIVE
A_GET_BASIC_CHANNELback to summary
private static final int A_GET_BASIC_CHANNEL
A_OPEN_LOGICAL_CHANNELback to summary
private static final int A_OPEN_LOGICAL_CHANNEL
A_RESETback to summary
private static final int A_RESET
A_TRANSMIT_CONTROLback to summary
private static final int A_TRANSMIT_CONTROL
actionsback to summary
private final String actions
ARRAY_MASKSback to summary
private static final int[] ARRAY_MASKS
ARRAY_STRINGSback to summary
private static final String[] ARRAY_STRINGS
maskback to summary
private transient int mask
S_ALLback to summary
private static final String S_ALL
S_CONNECTback to summary
private static final String S_CONNECT
S_EXCLUSIVEback to summary
private static final String S_EXCLUSIVE
S_GET_BASIC_CHANNELback to summary
private static final String S_GET_BASIC_CHANNEL
S_OPEN_LOGICAL_CHANNELback to summary
private static final String S_OPEN_LOGICAL_CHANNEL
S_RESETback to summary
private static final String S_RESET
S_TRANSMIT_CONTROLback to summary
private static final String S_TRANSMIT_CONTROL
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.security.Permission.serialVersionUID.

Constructor Detail

CardPermissionback to summary
public CardPermission(String terminalName, String actions)

Constructs a new CardPermission with the specified actions. terminalName is the name of a CardTerminal or * if this permission applies to all terminals. actions contains a comma-separated list of the individual actions or * to signify all actions. For more information, see the documentation at the top of this class.

Parameters
terminalName:String

the name of the card terminal, or *

actions:String

the action string (or null if the set of permitted actions is empty)

Exceptions
NullPointerException:
if terminalName is null
IllegalArgumentException:
if actions is an invalid actions specification

Method Detail

equalsback to summary
public boolean equals(Object obj)

Implements abstract java.security.Permission.equals.

Compares the specified object with this CardPermission for equality. This CardPermission is equal to another Object object, if and only if

  • object is an instance of CardPermission,

  • this.getName() is equal to ((CardPermission)object).getName(), and

  • this.getActions() is equal to ((CardPermission)object).getActions().

Parameters
obj:Object

the object to be compared for equality with this CardPermission

Returns:boolean

true if and only if the specified object is equal to this CardPermission

getActionsback to summary
private static String getActions(int mask)
getActionsback to summary
public String getActions()

Implements abstract java.security.Permission.getActions.

Returns the canonical string representation of the actions. It is * to signify all actions defined by this class or the string concatenation of the comma-separated, lexicographically sorted list of individual actions.

Returns:String

the canonical string representation of the actions.

getMaskback to summary
private static int getMask(String actions)
hashCodeback to summary
public int hashCode()

Implements abstract java.security.Permission.hashCode.

Returns the hash code value for this CardPermission object.

Returns:int

the hash code value for this CardPermission object.

impliesback to summary
public boolean implies(Permission permission)

Implements abstract java.security.Permission.implies.

Checks if this CardPermission object implies the specified permission. That is the case, if and only if

  • permission is an instance of CardPermission,

  • permission's actions are a proper subset of this object's actions, and

  • this object's getName() method is either * or equal to permission's name.

Parameters
permission:Permission

the permission to check against

Returns:boolean

true if and only if this CardPermission object implies the specified permission.

readObjectback to summary
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException
writeObjectback to summary
private void writeObject(ObjectOutputStream s) throws IOException