Save This Page
Home » openjdk-7 » javax » crypto » [javadoc | source]
javax.crypto
class: CryptoPermission [javadoc | source]
java.lang.Object
   java.security.Permission
      javax.crypto.CryptoPermission

All Implemented Interfaces:
    Guard, Serializable

Direct Known Subclasses:
    CryptoAllPermission

The CryptoPermission class extends the java.security.Permission class. A CryptoPermission object is used to represent the ability of an application/applet to use certain algorithms with certain key sizes and other restrictions in certain environments.

Field Summary
static final  String ALG_NAME_WILDCARD     
Constructor:
 CryptoPermission(String alg) 
    Constructor that takes an algorithm name. This constructor implies that the given algorithm can be used without any restrictions.
    Parameters:
    alg - the algorithm name.
 CryptoPermission(String alg,
    int maxKeySize) 
    Constructor that takes an algorithm name and a maximum key size. This constructor implies that the given algorithm can be used with a key size up to maxKeySize.
    Parameters:
    alg - the algorithm name.
    maxKeySize - the maximum allowable key size, specified in number of bits.
 CryptoPermission(String alg,
    String exemptionMechanism) 
    Constructor that takes an algorithm name and the name of an exemption mechanism. This constructor implies that the given algorithm can be used without any key size or algorithm parameter restrictions provided that the specified exemption mechanism is enforced.
    Parameters:
    alg - the algorithm name.
    exemptionMechanism - the name of the exemption mechanism.
 CryptoPermission(String alg,
    int maxKeySize,
    AlgorithmParameterSpec algParamSpec) 
    Constructor that takes an algorithm name, a maximum key size, and an AlgorithmParameterSpec object. This constructor implies that the given algorithm can be used with a key size up to maxKeySize, and algorithm parameters up to the limits set in algParamSpec.
    Parameters:
    alg - the algorithm name.
    maxKeySize - the maximum allowable key size, specified in number of bits.
    algParamSpec - the limits for allowable algorithm parameters.
 CryptoPermission(String alg,
    int maxKeySize,
    String exemptionMechanism) 
    Constructor that takes an algorithm name, a maximum key size, and the name of an exemption mechanism. This constructor implies that the given algorithm can be used with a key size up to maxKeySize provided that the specified exemption mechanism is enforced.
    Parameters:
    alg - the algorithm name.
    maxKeySize - the maximum allowable key size, specified in number of bits.
    exemptionMechanism - the name of the exemption mechanism.
 CryptoPermission(String alg,
    int maxKeySize,
    AlgorithmParameterSpec algParamSpec,
    String exemptionMechanism) 
    Constructor that takes an algorithm name, a maximum key size, the name of an exemption mechanism, and an AlgorithmParameterSpec object. This constructor implies that the given algorithm can be used with a key size up to maxKeySize and algorithm parameters up to the limits set in algParamSpec provided that the specified exemption mechanism is enforced.
    Parameters:
    alg - the algorithm name.
    maxKeySize - the maximum allowable key size, specified in number of bits.
    algParamSpec - the limit for allowable algorithm parameter spec.
    exemptionMechanism - the name of the exemption mechanism.
Method from javax.crypto.CryptoPermission Summary:
equals,   getActions,   getAlgorithm,   getAlgorithmParameterSpec,   getCheckParam,   getExemptionMechanism,   getMaxKeySize,   hashCode,   implies,   newPermissionCollection,   toString
Methods from java.security.Permission:
checkGuard,   equals,   getActions,   getName,   hashCode,   implies,   newPermissionCollection,   toString
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.crypto.CryptoPermission Detail:
 public boolean equals(Object obj) 
    Checks two CryptoPermission objects for equality. Checks that obj is a CryptoPermission, and has the same algorithm name, exemption mechanism name, maximum allowable key size and algorithm parameter spec as this object.

 public String getActions() 
    There is no action defined for a CryptoPermission onject.
 final String getAlgorithm() 
    Returns the algorithm name associated with this CryptoPermission object.
 final AlgorithmParameterSpec getAlgorithmParameterSpec() 
    Returns the AlgorithmParameterSpec associated with this CryptoPermission object.
 final boolean getCheckParam() 
    Returns true if there is a limitation on the AlgorithmParameterSpec associated with this CryptoPermission object and false if otherwise.
 final String getExemptionMechanism() 
    Returns the exemption mechanism name associated with this CryptoPermission object.
 final int getMaxKeySize() 
    Returns the maximum allowable key size associated with this CryptoPermission object.
 public int hashCode() 
    Returns the hash code value for this object.
 public boolean implies(Permission p) 
    Checks if the specified permission is "implied" by this object.

    More specifically, this method returns true if:

    • p is an instance of CryptoPermission, and

    • p's algorithm name equals or (in the case of wildcards) is implied by this permission's algorithm name, and

    • p's maximum allowable key size is less or equal to this permission's maximum allowable key size, and

    • p's algorithm parameter spec equals or is implied by this permission's algorithm parameter spec, and

    • p's exemptionMechanism equals or is implied by this permission's exemptionMechanism (a null exemption mechanism implies any other exemption mechanism).
 public PermissionCollection newPermissionCollection() 
    Returns a new PermissionCollection object for storing CryptoPermission objects.
 public String toString() 
    Returns a string describing this CryptoPermission. The convention is to specify the class name, the algorithm name, the maximum allowable key size, and the name of the exemption mechanism, in the following format: '("ClassName" "algorithm" "keysize" "exemption_mechanism")'.