APIdia Launch Partner
Top Description Inners Fields Constructors Methods
javax.crypto

pack-priv final Class CryptoPolicyParser

extends Object
Class Inheritance
Imports
java.io.*, java.util.ArrayList, .Enumeration, .Hashtable, .Objects, .Vector, java.security.GeneralSecurityException, java.security.spec.AlgorithmParameterSpec, java.lang.reflect.*

JCE has two pairs of jurisdiction policy files: one represents U.S. export laws, and the other represents the local laws of the country where the JCE will be used. The jurisdiction policy file has the same syntax as JDK policy files except that JCE has new permission classes called javax.crypto.CryptoPermission and javax.crypto.CryptoAllPermission. The format of a permission entry in the jurisdiction policy file is:
permission <crypto permission class name>[, <algorithm name>
             [[, <exemption mechanism name>][, <maxKeySize>
             [, <AlgorithmParameterSpec class name>, <parameters
             for constructing an AlgorithmParameterSpec object>]]]];
Author
Sharon Liu
Since
1.4
See Also
java.security.Permissions, java.security.spec.AlgorithmParameterSpec, javax.crypto.CryptoPermission, javax.crypto.CryptoAllPermission, javax.crypto.CryptoPermissions

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
CryptoPolicyParser.CryptoPermissionEntry

Each crypto permission entry in the policy configuration file is represented by a CryptoPermissionEntry object.

private static class
CryptoPolicyParser.GrantEntry

Each grant entry in the policy configuration file is represented by a GrantEntry object.

pack-priv static class

Field Summary

Modifier and TypeField and Description
private boolean
private final Vector<CryptoPolicyParser.GrantEntry>
private int
private StreamTokenizer

Constructor Summary

AccessConstructor and Description
pack-priv
CryptoPolicyParser()

Creates a CryptoPolicyParser object.

Method Summary

Modifier and TypeMethod and Description
private static AlgorithmParameterSpec
getInstance(String type, Integer[] params)

pack-priv CryptoPermission[]
private boolean
isConsistent(String alg, String exemptionMechanism, Hashtable<String, Vector<String>> processedPermissions)

private int
match()

Excepts to match a non-negative number.

private String
match(String expect)

private CryptoPolicyParser.GrantEntry
parseGrantEntry(Hashtable<String, Vector<String>> processedPermissions)

parse a Grant entry

private CryptoPolicyParser.CryptoPermissionEntry
parsePermissionEntry(Hashtable<String, Vector<String>> processedPermissions)

parse a CryptoPermission entry

private boolean
peek(String expect)

private boolean
pack-priv void
read(Reader
the policy Reader object.
policy
)

Reads a policy configuration using a Reader object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

allPermEntryFoundback to summary
private boolean allPermEntryFound
grantEntriesback to summary
private final Vector<CryptoPolicyParser.GrantEntry> grantEntries
lookaheadback to summary
private int lookahead
stback to summary
private StreamTokenizer st

Constructor Detail

CryptoPolicyParserback to summary
pack-priv CryptoPolicyParser()

Creates a CryptoPolicyParser object.

Method Detail

getInstanceback to summary
private static AlgorithmParameterSpec getInstance(String type, Integer[] params) throws ParsingException
getPermissionsback to summary
pack-priv CryptoPermission[] getPermissions()
isConsistentback to summary
private boolean isConsistent(String alg, String exemptionMechanism, Hashtable<String, Vector<String>> processedPermissions)
matchback to summary
private int match() throws ParsingException, IOException

Excepts to match a non-negative number.

matchback to summary
private String match(String expect) throws ParsingException, IOException
parseGrantEntryback to summary
private CryptoPolicyParser.GrantEntry parseGrantEntry(Hashtable<String, Vector<String>> processedPermissions) throws ParsingException, IOException

parse a Grant entry

parsePermissionEntryback to summary
private CryptoPolicyParser.CryptoPermissionEntry parsePermissionEntry(Hashtable<String, Vector<String>> processedPermissions) throws ParsingException, IOException

parse a CryptoPermission entry

peekback to summary
private boolean peek(String expect)
peekAndMatchback to summary
private boolean peekAndMatch(String expect) throws ParsingException, IOException
readback to summary
pack-priv void read(Reader policy) throws ParsingException, IOException

Reads a policy configuration using a Reader object.

Parameters
policy:Reader

the policy Reader object.

Exceptions
ParsingException:
if the policy configuration contains a syntax error.
IOException:
if an error occurs while reading the policy configuration.
javax.crypto back to summary

private Class CryptoPolicyParser.CryptoPermissionEntry

extends Object
Class Inheritance

Each crypto permission entry in the policy configuration file is represented by a CryptoPermissionEntry object.

For example, the entry

    permission javax.crypto.CryptoPermission "DES", 56;
is represented internally

pe = new CryptoPermissionEntry("javax.crypto.cryptoPermission",
                          "DES", 56);
See Also
java.security.Permissions, javax.crypto.CryptoPermission, javax.crypto.CryptoAllPermission

Field Summary

Modifier and TypeField and Description
pack-priv String
pack-priv AlgorithmParameterSpec
pack-priv boolean
pack-priv String
pack-priv String
pack-priv int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object obj)

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Calculates a hash code value for the object.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

algback to summary
pack-priv String alg
algParamSpecback to summary
pack-priv AlgorithmParameterSpec algParamSpec
checkParamback to summary
pack-priv boolean checkParam
cryptoPermissionback to summary
pack-priv String cryptoPermission
exemptionMechanismback to summary
pack-priv String exemptionMechanism
maxKeySizeback to summary
pack-priv int maxKeySize

Constructor Detail

CryptoPermissionEntryback to summary
pack-priv CryptoPermissionEntry()

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Calculates a hash code value for the object. Objects which are equal will also have the same hashcode.

Annotations
@Override
javax.crypto back to summary

private Class CryptoPolicyParser.GrantEntry

extends Object
Class Inheritance

Each grant entry in the policy configuration file is represented by a GrantEntry object.

For example, the entry

     grant {
      permission javax.crypto.CryptoPermission "DES", 56;
     };

is represented internally

pe = new CryptoPermissionEntry("javax.crypto.CryptoPermission",
                          "DES", 56);

ge = new GrantEntry();

ge.add(pe);

See Also
java.security.Permission, javax.crypto.CryptoPermission, javax.crypto.CryptoPermissions

Field Summary

Modifier and TypeField and Description
private final Vector<CryptoPolicyParser.CryptoPermissionEntry>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

permissionEntriesback to summary
private final Vector<CryptoPolicyParser.CryptoPermissionEntry> permissionEntries

Constructor Detail

GrantEntryback to summary
pack-priv GrantEntry()

Method Detail

addback to summary
pack-priv void add(CryptoPolicyParser.CryptoPermissionEntry pe)
javax.crypto back to summary

pack-priv final Class CryptoPolicyParser.ParsingException

extends GeneralSecurityException
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final long

Constructor Summary

AccessConstructor and Description
pack-priv
ParsingException(String
the detail message.
msg
)

Constructs a ParsingException with the specified detail message.

pack-priv
ParsingException(int line, String msg)

pack-priv
ParsingException(int line, String expect, String actual)

Field Detail

serialVersionUIDback to summary
private static final long serialVersionUID

Hides java.security.GeneralSecurityException.serialVersionUID.

Annotations
@Serial

Constructor Detail

ParsingExceptionback to summary
pack-priv ParsingException(String msg)

Constructs a ParsingException with the specified detail message.

Parameters
msg:String

the detail message.

ParsingExceptionback to summary
pack-priv ParsingException(int line, String msg)
ParsingExceptionback to summary
pack-priv ParsingException(int line, String expect, String actual)