Top Description Fields Constructors Methods
javax.crypto

pack-priv final Class CryptoPermissions

Additional top-level class in compilation unit: PermissionsEnumerator.

extends PermissionCollection
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.security.*, java.util.ArrayList, .Enumeration, .Hashtable, .NoSuchElementException, java.util.concurrent.ConcurrentHashMap, java.io.Serializable, .InputStream, .InputStreamReader, .BufferedReader, .ObjectStreamField, .ObjectInputStream, .ObjectOutputStream, .IOException

This class contains CryptoPermission objects, organized into PermissionCollection objects according to algorithm names.

When the add method is called to add a CryptoPermission, the CryptoPermission is stored in the appropriate PermissionCollection. If no such collection exists yet, the algorithm name associated with the CryptoPermission object is determined and the newPermissionCollection method is called on the CryptoPermission or CryptoAllPermission class to create the PermissionCollection and add it to the Permissions object.

Author
Sharon Liu
Since
1.4
See Also
javax.crypto.CryptoPermission, java.security.PermissionCollection, java.security.Permissions

Field Summary

Modifier and TypeField and Description
private transient ConcurrentHashMap<String, PermissionCollection>
private static final ObjectStreamField[]
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv
CryptoPermissions()

Creates a new CryptoPermissions object containing no CryptoPermissionCollection objects.

Method Summary

Modifier and TypeMethod and Description
public void
add(Permission
the Permission object to add.
permission
)

Implements abstract java.security.PermissionCollection.add.

Adds a permission object to the PermissionCollection for the algorithm returned by (CryptoPermission)permission.getAlgorithm().

public Enumeration<Permission>

Returns:

an enumeration of all the Permission objects.
elements
()

Implements abstract java.security.PermissionCollection.elements.

Returns an enumeration of all the Permission objects in this CryptoPermissions object.

pack-priv CryptoPermissions
getMinimum(CryptoPermissions
the CryptoPermission object to compare with this object.
other
)

Returns a CryptoPermissions object which represents the minimum of the specified CryptoPermissions object and this CryptoPermissions object.

private CryptoPermission[]
getMinimum(PermissionCollection
the first given PermissionCollection object.
thisPc
,
PermissionCollection
the second given PermissionCollection object.
thatPc
)

Get the minimum of the two given PermissionCollection thisPc and thatPc.

private CryptoPermission[]
getMinimum(int
the given maximum key size.
maxKeySize
,
PermissionCollection
the given PermissionCollection object.
pc
)

Returns all the CryptoPermission objects in the given PermissionCollection object whose maximum keysize no greater than maxKeySize.

pack-priv PermissionCollection
getPermissionCollection(String
the algorithm name.
alg
)

Returns the PermissionCollection for the specified algorithm.

private PermissionCollection
getPermissionCollection(CryptoPermission
the CryptoPermission object.
cryptoPerm
)

Returns the PermissionCollection for the algorithm associated with the specified CryptoPermission object.

public boolean

Returns:

true if permission is implied by the permissions in the PermissionCollection it belongs to, false if not.
implies
(Permission
the Permission object to check.
permission
)

Implements abstract java.security.PermissionCollection.implies.

Checks if this object's PermissionCollection for permissions of the specified permission's algorithm implies the specified permission.

pack-priv boolean
isEmpty()

Returns true if this CryptoPermissions object doesn't contain any CryptoPermission objects; otherwise, returns false.

pack-priv void
load(InputStream
the InputStream to load from.
in
)

Populates the crypto policy from the specified InputStream into this CryptoPermissions object.

private void
private void
Inherited from java.security.PermissionCollection:
elementsAsStreamisReadOnlysetReadOnlytoString

Field Detail

permsback to summary
private transient ConcurrentHashMap<String, PermissionCollection> perms
serialPersistentFieldsback to summary
private static final ObjectStreamField[] serialPersistentFields
Annotations
@Serial
Serial Fields:
perms:Hashtable
serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.security.PermissionCollection.serialVersionUID.

Annotations
@Serial

Constructor Detail

CryptoPermissionsback to summary
pack-priv CryptoPermissions()

Creates a new CryptoPermissions object containing no CryptoPermissionCollection objects.

Method Detail

addback to summary
public void add(Permission permission)

Implements abstract java.security.PermissionCollection.add.

Adds a permission object to the PermissionCollection for the algorithm returned by (CryptoPermission)permission.getAlgorithm(). This method creates a new PermissionCollection object (and adds the permission to it) if an appropriate collection does not yet exist.

Parameters
permission:Permission

the Permission object to add.

Annotations
@Override
Exceptions
SecurityException:
if this CryptoPermissions object is marked as readonly.
See Also
PermissionCollection#isReadOnly
elementsback to summary
public Enumeration<Permission> elements()

Implements abstract java.security.PermissionCollection.elements.

Returns an enumeration of all the Permission objects in this CryptoPermissions object.

Returns:Enumeration<Permission>

an enumeration of all the Permission objects.

Annotations
@Override
getMinimumback to summary
pack-priv CryptoPermissions getMinimum(CryptoPermissions other)

Returns a CryptoPermissions object which represents the minimum of the specified CryptoPermissions object and this CryptoPermissions object.

Parameters
other:CryptoPermissions

the CryptoPermission object to compare with this object.

getMinimumback to summary
private CryptoPermission[] getMinimum(PermissionCollection thisPc, PermissionCollection thatPc)

Get the minimum of the two given PermissionCollection thisPc and thatPc.

Parameters
thisPc:PermissionCollection

the first given PermissionCollection object.

thatPc:PermissionCollection

the second given PermissionCollection object.

getMinimumback to summary
private CryptoPermission[] getMinimum(int maxKeySize, PermissionCollection pc)

Returns all the CryptoPermission objects in the given PermissionCollection object whose maximum keysize no greater than maxKeySize. For all CryptoPermission objects with a maximum keysize greater than maxKeySize, this method constructs a corresponding CryptoPermission object whose maximum keysize is set to maxKeySize, and includes that in the result.

Parameters
maxKeySize:int

the given maximum key size.

pc:PermissionCollection

the given PermissionCollection object.

getPermissionCollectionback to summary
pack-priv PermissionCollection getPermissionCollection(String alg)

Returns the PermissionCollection for the specified algorithm. Returns null if there isn't such a PermissionCollection.

Parameters
alg:String

the algorithm name.

getPermissionCollectionback to summary
private PermissionCollection getPermissionCollection(CryptoPermission cryptoPerm)

Returns the PermissionCollection for the algorithm associated with the specified CryptoPermission object. Creates such a PermissionCollection if such a PermissionCollection does not exist yet.

Parameters
cryptoPerm:CryptoPermission

the CryptoPermission object.

impliesback to summary
public boolean implies(Permission permission)

Implements abstract java.security.PermissionCollection.implies.

Checks if this object's PermissionCollection for permissions of the specified permission's algorithm implies the specified permission. Returns true if the checking succeeded.

Parameters
permission:Permission

the Permission object to check.

Returns:boolean

true if permission is implied by the permissions in the PermissionCollection it belongs to, false if not.

Annotations
@Override
isEmptyback to summary
pack-priv boolean isEmpty()

Returns true if this CryptoPermissions object doesn't contain any CryptoPermission objects; otherwise, returns false.

loadback to summary
pack-priv void load(InputStream in) throws IOException, ParsingException

Populates the crypto policy from the specified InputStream into this CryptoPermissions object.

Parameters
in:InputStream

the InputStream to load from.

Exceptions
SecurityException:
if cannot load successfully.
readObjectback to summary
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException
Annotations
@Serial
writeObjectback to summary
private void writeObject(ObjectOutputStream s) throws IOException
Annotations
@Serial