PageRenderTime 41ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 1ms

/src/share/classes/sun/security/tools/policytool/PolicyTool.java

https://bitbucket.org/weijun/jdk8-tl-jdk
Java | 4148 lines | 3439 code | 297 blank | 412 comment | 166 complexity | ee17d302bfef0f4bff93cb773d700a3d MD5 | raw file
Possible License(s): GPL-2.0, BSD-3-Clause-No-Nuclear-License-2014, LGPL-3.0

Large files files are truncated, but you can click here to view the full file

  1. /*
  2. * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  3. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4. *
  5. * This code is free software; you can redistribute it and/or modify it
  6. * under the terms of the GNU General Public License version 2 only, as
  7. * published by the Free Software Foundation. Oracle designates this
  8. * particular file as subject to the "Classpath" exception as provided
  9. * by Oracle in the LICENSE file that accompanied this code.
  10. *
  11. * This code is distributed in the hope that it will be useful, but WITHOUT
  12. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  14. * version 2 for more details (a copy is included in the LICENSE file that
  15. * accompanied this code).
  16. *
  17. * You should have received a copy of the GNU General Public License version
  18. * 2 along with this work; if not, write to the Free Software Foundation,
  19. * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20. *
  21. * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22. * or visit www.oracle.com if you need additional information or have any
  23. * questions.
  24. */
  25. package sun.security.tools.policytool;
  26. import java.io.*;
  27. import java.util.LinkedList;
  28. import java.util.ListIterator;
  29. import java.util.Vector;
  30. import java.util.Enumeration;
  31. import java.net.URL;
  32. import java.net.MalformedURLException;
  33. import java.lang.reflect.*;
  34. import java.text.Collator;
  35. import java.text.MessageFormat;
  36. import sun.security.util.PropertyExpander;
  37. import sun.security.util.PropertyExpander.ExpandException;
  38. import java.awt.*;
  39. import java.awt.event.*;
  40. import java.security.cert.Certificate;
  41. import java.security.cert.CertificateException;
  42. import java.security.*;
  43. import sun.security.provider.*;
  44. import sun.security.util.PolicyUtil;
  45. import javax.security.auth.x500.X500Principal;
  46. /**
  47. * PolicyTool may be used by users and administrators to configure the
  48. * overall java security policy (currently stored in the policy file).
  49. * Using PolicyTool administrators may add and remove policies from
  50. * the policy file. <p>
  51. *
  52. * @see java.security.Policy
  53. * @since 1.2
  54. */
  55. public class PolicyTool {
  56. // for i18n
  57. static final java.util.ResourceBundle rb =
  58. java.util.ResourceBundle.getBundle("sun.security.util.Resources");
  59. static final Collator collator = Collator.getInstance();
  60. static {
  61. // this is for case insensitive string comparisons
  62. collator.setStrength(Collator.PRIMARY);
  63. };
  64. // anyone can add warnings
  65. Vector<String> warnings;
  66. boolean newWarning = false;
  67. // set to true if policy modified.
  68. // this way upon exit we know if to ask the user to save changes
  69. boolean modified = false;
  70. private static final boolean testing = false;
  71. private static final Class[] TWOPARAMS = { String.class, String.class };
  72. private static final Class[] ONEPARAMS = { String.class };
  73. private static final Class[] NOPARAMS = {};
  74. /*
  75. * All of the policy entries are read in from the
  76. * policy file and stored here. Updates to the policy entries
  77. * using addEntry() and removeEntry() are made here. To ultimately save
  78. * the policy entries back to the policy file, the SavePolicy button
  79. * must be clicked.
  80. **/
  81. private static String policyFileName = null;
  82. private Vector<PolicyEntry> policyEntries = null;
  83. private PolicyParser parser = null;
  84. /* The public key alias information is stored here. */
  85. private KeyStore keyStore = null;
  86. private String keyStoreName = " ";
  87. private String keyStoreType = " ";
  88. private String keyStoreProvider = " ";
  89. private String keyStorePwdURL = " ";
  90. /* standard PKCS11 KeyStore type */
  91. private static final String P11KEYSTORE = "PKCS11";
  92. /* reserved word for PKCS11 KeyStores */
  93. private static final String NONE = "NONE";
  94. /**
  95. * default constructor
  96. */
  97. private PolicyTool() {
  98. policyEntries = new Vector<PolicyEntry>();
  99. parser = new PolicyParser();
  100. warnings = new Vector<String>();
  101. }
  102. /**
  103. * get the PolicyFileName
  104. */
  105. String getPolicyFileName() {
  106. return policyFileName;
  107. }
  108. /**
  109. * set the PolicyFileName
  110. */
  111. void setPolicyFileName(String policyFileName) {
  112. PolicyTool.policyFileName = policyFileName;
  113. }
  114. /**
  115. * clear keyStore info
  116. */
  117. void clearKeyStoreInfo() {
  118. this.keyStoreName = null;
  119. this.keyStoreType = null;
  120. this.keyStoreProvider = null;
  121. this.keyStorePwdURL = null;
  122. this.keyStore = null;
  123. }
  124. /**
  125. * get the keyStore URL name
  126. */
  127. String getKeyStoreName() {
  128. return keyStoreName;
  129. }
  130. /**
  131. * get the keyStore Type
  132. */
  133. String getKeyStoreType() {
  134. return keyStoreType;
  135. }
  136. /**
  137. * get the keyStore Provider
  138. */
  139. String getKeyStoreProvider() {
  140. return keyStoreProvider;
  141. }
  142. /**
  143. * get the keyStore password URL
  144. */
  145. String getKeyStorePwdURL() {
  146. return keyStorePwdURL;
  147. }
  148. /**
  149. * Open and read a policy file
  150. */
  151. void openPolicy(String filename) throws FileNotFoundException,
  152. PolicyParser.ParsingException,
  153. KeyStoreException,
  154. CertificateException,
  155. InstantiationException,
  156. MalformedURLException,
  157. IOException,
  158. NoSuchAlgorithmException,
  159. IllegalAccessException,
  160. NoSuchMethodException,
  161. UnrecoverableKeyException,
  162. NoSuchProviderException,
  163. ClassNotFoundException,
  164. PropertyExpander.ExpandException,
  165. InvocationTargetException {
  166. newWarning = false;
  167. // start fresh - blow away the current state
  168. policyEntries = new Vector<PolicyEntry>();
  169. parser = new PolicyParser();
  170. warnings = new Vector<String>();
  171. setPolicyFileName(null);
  172. clearKeyStoreInfo();
  173. // see if user is opening a NEW policy file
  174. if (filename == null) {
  175. modified = false;
  176. return;
  177. }
  178. // Read in the policy entries from the file and
  179. // populate the parser vector table. The parser vector
  180. // table only holds the entries as strings, so it only
  181. // guarantees that the policies are syntactically
  182. // correct.
  183. setPolicyFileName(filename);
  184. parser.read(new FileReader(filename));
  185. // open the keystore
  186. openKeyStore(parser.getKeyStoreUrl(), parser.getKeyStoreType(),
  187. parser.getKeyStoreProvider(), parser.getStorePassURL());
  188. // Update the local vector with the same policy entries.
  189. // This guarantees that the policy entries are not only
  190. // syntactically correct, but semantically valid as well.
  191. Enumeration<PolicyParser.GrantEntry> enum_ = parser.grantElements();
  192. while (enum_.hasMoreElements()) {
  193. PolicyParser.GrantEntry ge = enum_.nextElement();
  194. // see if all the signers have public keys
  195. if (ge.signedBy != null) {
  196. String signers[] = parseSigners(ge.signedBy);
  197. for (int i = 0; i < signers.length; i++) {
  198. PublicKey pubKey = getPublicKeyAlias(signers[i]);
  199. if (pubKey == null) {
  200. newWarning = true;
  201. MessageFormat form = new MessageFormat(rb.getString
  202. ("Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured."));
  203. Object[] source = {signers[i]};
  204. warnings.addElement(form.format(source));
  205. }
  206. }
  207. }
  208. // check to see if the Principals are valid
  209. ListIterator<PolicyParser.PrincipalEntry> prinList =
  210. ge.principals.listIterator(0);
  211. while (prinList.hasNext()) {
  212. PolicyParser.PrincipalEntry pe = prinList.next();
  213. try {
  214. verifyPrincipal(pe.getPrincipalClass(),
  215. pe.getPrincipalName());
  216. } catch (ClassNotFoundException fnfe) {
  217. newWarning = true;
  218. MessageFormat form = new MessageFormat(rb.getString
  219. ("Warning.Class.not.found.class"));
  220. Object[] source = {pe.getPrincipalClass()};
  221. warnings.addElement(form.format(source));
  222. }
  223. }
  224. // check to see if the Permissions are valid
  225. Enumeration<PolicyParser.PermissionEntry> perms =
  226. ge.permissionElements();
  227. while (perms.hasMoreElements()) {
  228. PolicyParser.PermissionEntry pe = perms.nextElement();
  229. try {
  230. verifyPermission(pe.permission, pe.name, pe.action);
  231. } catch (ClassNotFoundException fnfe) {
  232. newWarning = true;
  233. MessageFormat form = new MessageFormat(rb.getString
  234. ("Warning.Class.not.found.class"));
  235. Object[] source = {pe.permission};
  236. warnings.addElement(form.format(source));
  237. } catch (InvocationTargetException ite) {
  238. newWarning = true;
  239. MessageFormat form = new MessageFormat(rb.getString
  240. ("Warning.Invalid.argument.s.for.constructor.arg"));
  241. Object[] source = {pe.permission};
  242. warnings.addElement(form.format(source));
  243. }
  244. // see if all the permission signers have public keys
  245. if (pe.signedBy != null) {
  246. String signers[] = parseSigners(pe.signedBy);
  247. for (int i = 0; i < signers.length; i++) {
  248. PublicKey pubKey = getPublicKeyAlias(signers[i]);
  249. if (pubKey == null) {
  250. newWarning = true;
  251. MessageFormat form = new MessageFormat(rb.getString
  252. ("Warning.A.public.key.for.alias.signers.i.does.not.exist.Make.sure.a.KeyStore.is.properly.configured."));
  253. Object[] source = {signers[i]};
  254. warnings.addElement(form.format(source));
  255. }
  256. }
  257. }
  258. }
  259. PolicyEntry pEntry = new PolicyEntry(this, ge);
  260. policyEntries.addElement(pEntry);
  261. }
  262. // just read in the policy -- nothing has been modified yet
  263. modified = false;
  264. }
  265. /**
  266. * Save a policy to a file
  267. */
  268. void savePolicy(String filename)
  269. throws FileNotFoundException, IOException {
  270. // save the policy entries to a file
  271. parser.setKeyStoreUrl(keyStoreName);
  272. parser.setKeyStoreType(keyStoreType);
  273. parser.setKeyStoreProvider(keyStoreProvider);
  274. parser.setStorePassURL(keyStorePwdURL);
  275. parser.write(new FileWriter(filename));
  276. modified = false;
  277. }
  278. /**
  279. * Open the KeyStore
  280. */
  281. void openKeyStore(String name,
  282. String type,
  283. String provider,
  284. String pwdURL) throws KeyStoreException,
  285. NoSuchAlgorithmException,
  286. UnrecoverableKeyException,
  287. IOException,
  288. CertificateException,
  289. NoSuchProviderException,
  290. ExpandException {
  291. if (name == null && type == null &&
  292. provider == null && pwdURL == null) {
  293. // policy did not specify a keystore during open
  294. // or use wants to reset keystore values
  295. this.keyStoreName = null;
  296. this.keyStoreType = null;
  297. this.keyStoreProvider = null;
  298. this.keyStorePwdURL = null;
  299. // caller will set (tool.modified = true) if appropriate
  300. return;
  301. }
  302. URL policyURL = null;
  303. if (policyFileName != null) {
  304. File pfile = new File(policyFileName);
  305. policyURL = new URL("file:" + pfile.getCanonicalPath());
  306. }
  307. // although PolicyUtil.getKeyStore may properly handle
  308. // defaults and property expansion, we do it here so that
  309. // if the call is successful, we can set the proper values
  310. // (PolicyUtil.getKeyStore does not return expanded values)
  311. if (name != null && name.length() > 0) {
  312. name = PropertyExpander.expand(name).replace
  313. (File.separatorChar, '/');
  314. }
  315. if (type == null || type.length() == 0) {
  316. type = KeyStore.getDefaultType();
  317. }
  318. if (pwdURL != null && pwdURL.length() > 0) {
  319. pwdURL = PropertyExpander.expand(pwdURL).replace
  320. (File.separatorChar, '/');
  321. }
  322. try {
  323. this.keyStore = PolicyUtil.getKeyStore(policyURL,
  324. name,
  325. type,
  326. provider,
  327. pwdURL,
  328. null);
  329. } catch (IOException ioe) {
  330. // copied from sun.security.pkcs11.SunPKCS11
  331. String MSG = "no password provided, and no callback handler " +
  332. "available for retrieving password";
  333. Throwable cause = ioe.getCause();
  334. if (cause != null &&
  335. cause instanceof javax.security.auth.login.LoginException &&
  336. MSG.equals(cause.getMessage())) {
  337. // throw a more friendly exception message
  338. throw new IOException(MSG);
  339. } else {
  340. throw ioe;
  341. }
  342. }
  343. this.keyStoreName = name;
  344. this.keyStoreType = type;
  345. this.keyStoreProvider = provider;
  346. this.keyStorePwdURL = pwdURL;
  347. // caller will set (tool.modified = true)
  348. }
  349. /**
  350. * Add a Grant entry to the overall policy at the specified index.
  351. * A policy entry consists of a CodeSource.
  352. */
  353. boolean addEntry(PolicyEntry pe, int index) {
  354. if (index < 0) {
  355. // new entry -- just add it to the end
  356. policyEntries.addElement(pe);
  357. parser.add(pe.getGrantEntry());
  358. } else {
  359. // existing entry -- replace old one
  360. PolicyEntry origPe = policyEntries.elementAt(index);
  361. parser.replace(origPe.getGrantEntry(), pe.getGrantEntry());
  362. policyEntries.setElementAt(pe, index);
  363. }
  364. return true;
  365. }
  366. /**
  367. * Add a Principal entry to an existing PolicyEntry at the specified index.
  368. * A Principal entry consists of a class, and name.
  369. *
  370. * If the principal already exists, it is not added again.
  371. */
  372. boolean addPrinEntry(PolicyEntry pe,
  373. PolicyParser.PrincipalEntry newPrin,
  374. int index) {
  375. // first add the principal to the Policy Parser entry
  376. PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
  377. if (grantEntry.contains(newPrin) == true)
  378. return false;
  379. LinkedList<PolicyParser.PrincipalEntry> prinList =
  380. grantEntry.principals;
  381. if (index != -1)
  382. prinList.set(index, newPrin);
  383. else
  384. prinList.add(newPrin);
  385. modified = true;
  386. return true;
  387. }
  388. /**
  389. * Add a Permission entry to an existing PolicyEntry at the specified index.
  390. * A Permission entry consists of a permission, name, and actions.
  391. *
  392. * If the permission already exists, it is not added again.
  393. */
  394. boolean addPermEntry(PolicyEntry pe,
  395. PolicyParser.PermissionEntry newPerm,
  396. int index) {
  397. // first add the permission to the Policy Parser Vector
  398. PolicyParser.GrantEntry grantEntry = pe.getGrantEntry();
  399. if (grantEntry.contains(newPerm) == true)
  400. return false;
  401. Vector<PolicyParser.PermissionEntry> permList =
  402. grantEntry.permissionEntries;
  403. if (index != -1)
  404. permList.setElementAt(newPerm, index);
  405. else
  406. permList.addElement(newPerm);
  407. modified = true;
  408. return true;
  409. }
  410. /**
  411. * Remove a Permission entry from an existing PolicyEntry.
  412. */
  413. boolean removePermEntry(PolicyEntry pe,
  414. PolicyParser.PermissionEntry perm) {
  415. // remove the Permission from the GrantEntry
  416. PolicyParser.GrantEntry ppge = pe.getGrantEntry();
  417. modified = ppge.remove(perm);
  418. return modified;
  419. }
  420. /**
  421. * remove an entry from the overall policy
  422. */
  423. boolean removeEntry(PolicyEntry pe) {
  424. parser.remove(pe.getGrantEntry());
  425. modified = true;
  426. return (policyEntries.removeElement(pe));
  427. }
  428. /**
  429. * retrieve all Policy Entries
  430. */
  431. PolicyEntry[] getEntry() {
  432. if (policyEntries.size() > 0) {
  433. PolicyEntry entries[] = new PolicyEntry[policyEntries.size()];
  434. for (int i = 0; i < policyEntries.size(); i++)
  435. entries[i] = policyEntries.elementAt(i);
  436. return entries;
  437. }
  438. return null;
  439. }
  440. /**
  441. * Retrieve the public key mapped to a particular name.
  442. * If the key has expired, a KeyException is thrown.
  443. */
  444. PublicKey getPublicKeyAlias(String name) throws KeyStoreException {
  445. if (keyStore == null) {
  446. return null;
  447. }
  448. Certificate cert = keyStore.getCertificate(name);
  449. if (cert == null) {
  450. return null;
  451. }
  452. PublicKey pubKey = cert.getPublicKey();
  453. return pubKey;
  454. }
  455. /**
  456. * Retrieve all the alias names stored in the certificate database
  457. */
  458. String[] getPublicKeyAlias() throws KeyStoreException {
  459. int numAliases = 0;
  460. String aliases[] = null;
  461. if (keyStore == null) {
  462. return null;
  463. }
  464. Enumeration<String> enum_ = keyStore.aliases();
  465. // first count the number of elements
  466. while (enum_.hasMoreElements()) {
  467. enum_.nextElement();
  468. numAliases++;
  469. }
  470. if (numAliases > 0) {
  471. // now copy them into an array
  472. aliases = new String[numAliases];
  473. numAliases = 0;
  474. enum_ = keyStore.aliases();
  475. while (enum_.hasMoreElements()) {
  476. aliases[numAliases] = new String(enum_.nextElement());
  477. numAliases++;
  478. }
  479. }
  480. return aliases;
  481. }
  482. /**
  483. * This method parses a single string of signers separated by commas
  484. * ("jordan, duke, pippen") into an array of individual strings.
  485. */
  486. String[] parseSigners(String signedBy) {
  487. String signers[] = null;
  488. int numSigners = 1;
  489. int signedByIndex = 0;
  490. int commaIndex = 0;
  491. int signerNum = 0;
  492. // first pass thru "signedBy" counts the number of signers
  493. while (commaIndex >= 0) {
  494. commaIndex = signedBy.indexOf(',', signedByIndex);
  495. if (commaIndex >= 0) {
  496. numSigners++;
  497. signedByIndex = commaIndex + 1;
  498. }
  499. }
  500. signers = new String[numSigners];
  501. // second pass thru "signedBy" transfers signers to array
  502. commaIndex = 0;
  503. signedByIndex = 0;
  504. while (commaIndex >= 0) {
  505. if ((commaIndex = signedBy.indexOf(',', signedByIndex)) >= 0) {
  506. // transfer signer and ignore trailing part of the string
  507. signers[signerNum] =
  508. signedBy.substring(signedByIndex, commaIndex).trim();
  509. signerNum++;
  510. signedByIndex = commaIndex + 1;
  511. } else {
  512. // we are at the end of the string -- transfer signer
  513. signers[signerNum] = signedBy.substring(signedByIndex).trim();
  514. }
  515. }
  516. return signers;
  517. }
  518. /**
  519. * Check to see if the Principal contents are OK
  520. */
  521. void verifyPrincipal(String type, String name)
  522. throws ClassNotFoundException,
  523. InstantiationException
  524. {
  525. if (type.equals(PolicyParser.PrincipalEntry.WILDCARD_CLASS) ||
  526. type.equals(PolicyParser.REPLACE_NAME)) {
  527. return;
  528. }
  529. Class<?> PRIN = Class.forName("java.security.Principal");
  530. Class<?> pc = Class.forName(type, true,
  531. Thread.currentThread().getContextClassLoader());
  532. if (!PRIN.isAssignableFrom(pc)) {
  533. MessageFormat form = new MessageFormat(rb.getString
  534. ("Illegal.Principal.Type.type"));
  535. Object[] source = {type};
  536. throw new InstantiationException(form.format(source));
  537. }
  538. if (ToolDialog.X500_PRIN_CLASS.equals(pc.getName())) {
  539. // PolicyParser checks validity of X500Principal name
  540. // - PolicyTool needs to as well so that it doesn't store
  541. // an invalid name that can't be read in later
  542. //
  543. // this can throw an IllegalArgumentException
  544. X500Principal newP = new X500Principal(name);
  545. }
  546. }
  547. /**
  548. * Check to see if the Permission contents are OK
  549. */
  550. @SuppressWarnings("fallthrough")
  551. void verifyPermission(String type,
  552. String name,
  553. String actions)
  554. throws ClassNotFoundException,
  555. InstantiationException,
  556. IllegalAccessException,
  557. NoSuchMethodException,
  558. InvocationTargetException
  559. {
  560. //XXX we might want to keep a hash of created factories...
  561. Class<?> pc = Class.forName(type, true,
  562. Thread.currentThread().getContextClassLoader());
  563. Constructor<?> c = null;
  564. Vector<String> objects = new Vector<>(2);
  565. if (name != null) objects.add(name);
  566. if (actions != null) objects.add(actions);
  567. switch (objects.size()) {
  568. case 0:
  569. try {
  570. c = pc.getConstructor(NOPARAMS);
  571. break;
  572. } catch (NoSuchMethodException ex) {
  573. // proceed to the one-param constructor
  574. objects.add(null);
  575. }
  576. /* fall through */
  577. case 1:
  578. try {
  579. c = pc.getConstructor(ONEPARAMS);
  580. break;
  581. } catch (NoSuchMethodException ex) {
  582. // proceed to the two-param constructor
  583. objects.add(null);
  584. }
  585. /* fall through */
  586. case 2:
  587. c = pc.getConstructor(TWOPARAMS);
  588. break;
  589. }
  590. Object parameters[] = objects.toArray();
  591. Permission p = (Permission)c.newInstance(parameters);
  592. }
  593. /*
  594. * Parse command line arguments.
  595. */
  596. static void parseArgs(String args[]) {
  597. /* parse flags */
  598. int n = 0;
  599. for (n=0; (n < args.length) && args[n].startsWith("-"); n++) {
  600. String flags = args[n];
  601. if (collator.compare(flags, "-file") == 0) {
  602. if (++n == args.length) usage();
  603. policyFileName = args[n];
  604. } else {
  605. MessageFormat form = new MessageFormat(rb.getString
  606. ("Illegal.option.option"));
  607. Object[] source = { flags };
  608. System.err.println(form.format(source));
  609. usage();
  610. }
  611. }
  612. }
  613. static void usage() {
  614. System.out.println(rb.getString("Usage.policytool.options."));
  615. System.out.println();
  616. System.out.println(rb.getString
  617. (".file.file.policy.file.location"));
  618. System.out.println();
  619. System.exit(1);
  620. }
  621. /**
  622. * run the PolicyTool
  623. */
  624. public static void main(String args[]) {
  625. parseArgs(args);
  626. ToolWindow tw = new ToolWindow(new PolicyTool());
  627. tw.displayToolWindow(args);
  628. }
  629. // split instr to words according to capitalization,
  630. // like, AWTControl -> A W T Control
  631. // this method is for easy pronounciation
  632. static String splitToWords(String instr) {
  633. return instr.replaceAll("([A-Z])", " $1");
  634. }
  635. }
  636. /**
  637. * Each entry in the policy configuration file is represented by a
  638. * PolicyEntry object.
  639. *
  640. * A PolicyEntry is a (CodeSource,Permission) pair. The
  641. * CodeSource contains the (URL, PublicKey) that together identify
  642. * where the Java bytecodes come from and who (if anyone) signed
  643. * them. The URL could refer to localhost. The URL could also be
  644. * null, meaning that this policy entry is given to all comers, as
  645. * long as they match the signer field. The signer could be null,
  646. * meaning the code is not signed.
  647. *
  648. * The Permission contains the (Type, Name, Action) triplet.
  649. *
  650. */
  651. class PolicyEntry {
  652. private CodeSource codesource;
  653. private PolicyTool tool;
  654. private PolicyParser.GrantEntry grantEntry;
  655. private boolean testing = false;
  656. /**
  657. * Create a PolicyEntry object from the information read in
  658. * from a policy file.
  659. */
  660. PolicyEntry(PolicyTool tool, PolicyParser.GrantEntry ge)
  661. throws MalformedURLException, NoSuchMethodException,
  662. ClassNotFoundException, InstantiationException, IllegalAccessException,
  663. InvocationTargetException, CertificateException,
  664. IOException, NoSuchAlgorithmException, UnrecoverableKeyException {
  665. this.tool = tool;
  666. URL location = null;
  667. // construct the CodeSource
  668. if (ge.codeBase != null)
  669. location = new URL(ge.codeBase);
  670. this.codesource = new CodeSource(location,
  671. (java.security.cert.Certificate[]) null);
  672. if (testing) {
  673. System.out.println("Adding Policy Entry:");
  674. System.out.println(" CodeBase = " + location);
  675. System.out.println(" Signers = " + ge.signedBy);
  676. System.out.println(" with " + ge.principals.size() +
  677. " Principals");
  678. }
  679. this.grantEntry = ge;
  680. }
  681. /**
  682. * get the codesource associated with this PolicyEntry
  683. */
  684. CodeSource getCodeSource() {
  685. return codesource;
  686. }
  687. /**
  688. * get the GrantEntry associated with this PolicyEntry
  689. */
  690. PolicyParser.GrantEntry getGrantEntry() {
  691. return grantEntry;
  692. }
  693. /**
  694. * convert the header portion, i.e. codebase, signer, principals, of
  695. * this policy entry into a string
  696. */
  697. String headerToString() {
  698. String pString = principalsToString();
  699. if (pString.length() == 0) {
  700. return codebaseToString();
  701. } else {
  702. return codebaseToString() + ", " + pString;
  703. }
  704. }
  705. /**
  706. * convert the Codebase/signer portion of this policy entry into a string
  707. */
  708. String codebaseToString() {
  709. String stringEntry = new String();
  710. if (grantEntry.codeBase != null &&
  711. grantEntry.codeBase.equals("") == false)
  712. stringEntry = stringEntry.concat
  713. ("CodeBase \"" +
  714. grantEntry.codeBase +
  715. "\"");
  716. if (grantEntry.signedBy != null &&
  717. grantEntry.signedBy.equals("") == false)
  718. stringEntry = ((stringEntry.length() > 0) ?
  719. stringEntry.concat(", SignedBy \"" +
  720. grantEntry.signedBy +
  721. "\"") :
  722. stringEntry.concat("SignedBy \"" +
  723. grantEntry.signedBy +
  724. "\""));
  725. if (stringEntry.length() == 0)
  726. return new String("CodeBase <ALL>");
  727. return stringEntry;
  728. }
  729. /**
  730. * convert the Principals portion of this policy entry into a string
  731. */
  732. String principalsToString() {
  733. String result = "";
  734. if ((grantEntry.principals != null) &&
  735. (!grantEntry.principals.isEmpty())) {
  736. StringBuffer buffer = new StringBuffer(200);
  737. ListIterator<PolicyParser.PrincipalEntry> list =
  738. grantEntry.principals.listIterator();
  739. while (list.hasNext()) {
  740. PolicyParser.PrincipalEntry pppe = list.next();
  741. buffer.append(" Principal " + pppe.getDisplayClass() + " " +
  742. pppe.getDisplayName(true));
  743. if (list.hasNext()) buffer.append(", ");
  744. }
  745. result = buffer.toString();
  746. }
  747. return result;
  748. }
  749. /**
  750. * convert this policy entry into a PolicyParser.PermissionEntry
  751. */
  752. PolicyParser.PermissionEntry toPermissionEntry(Permission perm) {
  753. String actions = null;
  754. // get the actions
  755. if (perm.getActions() != null &&
  756. perm.getActions().trim() != "")
  757. actions = perm.getActions();
  758. PolicyParser.PermissionEntry pe = new PolicyParser.PermissionEntry
  759. (perm.getClass().getName(),
  760. perm.getName(),
  761. actions);
  762. return pe;
  763. }
  764. }
  765. /**
  766. * The main window for the PolicyTool
  767. */
  768. class ToolWindow extends Frame {
  769. // use serialVersionUID from JDK 1.2.2 for interoperability
  770. private static final long serialVersionUID = 5682568601210376777L;
  771. /* external paddings */
  772. public static final Insets TOP_PADDING = new Insets(25,0,0,0);
  773. public static final Insets BOTTOM_PADDING = new Insets(0,0,25,0);
  774. public static final Insets LITE_BOTTOM_PADDING = new Insets(0,0,10,0);
  775. public static final Insets LR_PADDING = new Insets(0,10,0,10);
  776. public static final Insets TOP_BOTTOM_PADDING = new Insets(15, 0, 15, 0);
  777. public static final Insets L_TOP_BOTTOM_PADDING = new Insets(5,10,15,0);
  778. public static final Insets LR_BOTTOM_PADDING = new Insets(0,10,5,10);
  779. public static final Insets L_BOTTOM_PADDING = new Insets(0,10,5,0);
  780. public static final Insets R_BOTTOM_PADDING = new Insets(0,0,5,10);
  781. /* buttons and menus */
  782. public static final String NEW_POLICY_FILE =
  783. PolicyTool.rb.getString("New");
  784. public static final String OPEN_POLICY_FILE =
  785. PolicyTool.rb.getString("Open");
  786. public static final String SAVE_POLICY_FILE =
  787. PolicyTool.rb.getString("Save");
  788. public static final String SAVE_AS_POLICY_FILE =
  789. PolicyTool.rb.getString("Save.As");
  790. public static final String VIEW_WARNINGS =
  791. PolicyTool.rb.getString("View.Warning.Log");
  792. public static final String QUIT =
  793. PolicyTool.rb.getString("Exit");
  794. public static final String ADD_POLICY_ENTRY =
  795. PolicyTool.rb.getString("Add.Policy.Entry");
  796. public static final String EDIT_POLICY_ENTRY =
  797. PolicyTool.rb.getString("Edit.Policy.Entry");
  798. public static final String REMOVE_POLICY_ENTRY =
  799. PolicyTool.rb.getString("Remove.Policy.Entry");
  800. public static final String EDIT_KEYSTORE =
  801. PolicyTool.rb.getString("Edit");
  802. public static final String ADD_PUBKEY_ALIAS =
  803. PolicyTool.rb.getString("Add.Public.Key.Alias");
  804. public static final String REMOVE_PUBKEY_ALIAS =
  805. PolicyTool.rb.getString("Remove.Public.Key.Alias");
  806. /* gridbag index for components in the main window (MW) */
  807. public static final int MW_FILENAME_LABEL = 0;
  808. public static final int MW_FILENAME_TEXTFIELD = 1;
  809. public static final int MW_PANEL = 2;
  810. public static final int MW_ADD_BUTTON = 0;
  811. public static final int MW_EDIT_BUTTON = 1;
  812. public static final int MW_REMOVE_BUTTON = 2;
  813. public static final int MW_POLICY_LIST = 3; // follows MW_PANEL
  814. private PolicyTool tool;
  815. /**
  816. * Constructor
  817. */
  818. ToolWindow(PolicyTool tool) {
  819. this.tool = tool;
  820. }
  821. /**
  822. * Initialize the PolicyTool window with the necessary components
  823. */
  824. private void initWindow() {
  825. // create the top menu bar
  826. MenuBar menuBar = new MenuBar();
  827. // create a File menu
  828. Menu menu = new Menu(PolicyTool.rb.getString("File"));
  829. menu.add(NEW_POLICY_FILE);
  830. menu.add(OPEN_POLICY_FILE);
  831. menu.add(SAVE_POLICY_FILE);
  832. menu.add(SAVE_AS_POLICY_FILE);
  833. menu.add(VIEW_WARNINGS);
  834. menu.add(QUIT);
  835. menu.addActionListener(new FileMenuListener(tool, this));
  836. menuBar.add(menu);
  837. setMenuBar(menuBar);
  838. // create a KeyStore menu
  839. menu = new Menu(PolicyTool.rb.getString("KeyStore"));
  840. menu.add(EDIT_KEYSTORE);
  841. menu.addActionListener(new MainWindowListener(tool, this));
  842. menuBar.add(menu);
  843. setMenuBar(menuBar);
  844. // policy entry listing
  845. Label label = new Label(PolicyTool.rb.getString("Policy.File."));
  846. addNewComponent(this, label, MW_FILENAME_LABEL,
  847. 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
  848. TOP_BOTTOM_PADDING);
  849. TextField tf = new TextField(50);
  850. tf.getAccessibleContext().setAccessibleName(
  851. PolicyTool.rb.getString("Policy.File."));
  852. tf.setEditable(false);
  853. addNewComponent(this, tf, MW_FILENAME_TEXTFIELD,
  854. 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
  855. TOP_BOTTOM_PADDING);
  856. // add ADD/REMOVE/EDIT buttons in a new panel
  857. Panel panel = new Panel();
  858. panel.setLayout(new GridBagLayout());
  859. Button button = new Button(ADD_POLICY_ENTRY);
  860. button.addActionListener(new MainWindowListener(tool, this));
  861. addNewComponent(panel, button, MW_ADD_BUTTON,
  862. 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
  863. LR_PADDING);
  864. button = new Button(EDIT_POLICY_ENTRY);
  865. button.addActionListener(new MainWindowListener(tool, this));
  866. addNewComponent(panel, button, MW_EDIT_BUTTON,
  867. 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
  868. LR_PADDING);
  869. button = new Button(REMOVE_POLICY_ENTRY);
  870. button.addActionListener(new MainWindowListener(tool, this));
  871. addNewComponent(panel, button, MW_REMOVE_BUTTON,
  872. 2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
  873. LR_PADDING);
  874. addNewComponent(this, panel, MW_PANEL,
  875. 0, 2, 2, 1, 0.0, 0.0, GridBagConstraints.BOTH,
  876. BOTTOM_PADDING);
  877. String policyFile = tool.getPolicyFileName();
  878. if (policyFile == null) {
  879. String userHome;
  880. userHome = java.security.AccessController.doPrivileged(
  881. new sun.security.action.GetPropertyAction("user.home"));
  882. policyFile = userHome + File.separatorChar + ".java.policy";
  883. }
  884. try {
  885. // open the policy file
  886. tool.openPolicy(policyFile);
  887. // display the policy entries via the policy list textarea
  888. List list = new List(40, false);
  889. list.addActionListener(new PolicyListListener(tool, this));
  890. PolicyEntry entries[] = tool.getEntry();
  891. if (entries != null) {
  892. for (int i = 0; i < entries.length; i++)
  893. list.add(entries[i].headerToString());
  894. }
  895. TextField newFilename = (TextField)
  896. getComponent(MW_FILENAME_TEXTFIELD);
  897. newFilename.setText(policyFile);
  898. initPolicyList(list);
  899. } catch (FileNotFoundException fnfe) {
  900. // add blank policy listing
  901. List list = new List(40, false);
  902. list.addActionListener(new PolicyListListener(tool, this));
  903. initPolicyList(list);
  904. tool.setPolicyFileName(null);
  905. tool.modified = false;
  906. setVisible(true);
  907. // just add warning
  908. tool.warnings.addElement(fnfe.toString());
  909. } catch (Exception e) {
  910. // add blank policy listing
  911. List list = new List(40, false);
  912. list.addActionListener(new PolicyListListener(tool, this));
  913. initPolicyList(list);
  914. tool.setPolicyFileName(null);
  915. tool.modified = false;
  916. setVisible(true);
  917. // display the error
  918. MessageFormat form = new MessageFormat(PolicyTool.rb.getString
  919. ("Could.not.open.policy.file.policyFile.e.toString."));
  920. Object[] source = {policyFile, e.toString()};
  921. displayErrorDialog(null, form.format(source));
  922. }
  923. }
  924. /**
  925. * Add a component to the PolicyTool window
  926. */
  927. void addNewComponent(Container container, Component component,
  928. int index, int gridx, int gridy, int gridwidth, int gridheight,
  929. double weightx, double weighty, int fill, Insets is) {
  930. // add the component at the specified gridbag index
  931. container.add(component, index);
  932. // set the constraints
  933. GridBagLayout gbl = (GridBagLayout)container.getLayout();
  934. GridBagConstraints gbc = new GridBagConstraints();
  935. gbc.gridx = gridx;
  936. gbc.gridy = gridy;
  937. gbc.gridwidth = gridwidth;
  938. gbc.gridheight = gridheight;
  939. gbc.weightx = weightx;
  940. gbc.weighty = weighty;
  941. gbc.fill = fill;
  942. if (is != null) gbc.insets = is;
  943. gbl.setConstraints(component, gbc);
  944. }
  945. /**
  946. * Add a component to the PolicyTool window without external padding
  947. */
  948. void addNewComponent(Container container, Component component,
  949. int index, int gridx, int gridy, int gridwidth, int gridheight,
  950. double weightx, double weighty, int fill) {
  951. // delegate with "null" external padding
  952. addNewComponent(container, component, index, gridx, gridy,
  953. gridwidth, gridheight, weightx, weighty,
  954. fill, null);
  955. }
  956. /**
  957. * Init the policy_entry_list TEXTAREA component in the
  958. * PolicyTool window
  959. */
  960. void initPolicyList(List policyList) {
  961. // add the policy list to the window
  962. addNewComponent(this, policyList, MW_POLICY_LIST,
  963. 0, 3, 2, 1, 1.0, 1.0, GridBagConstraints.BOTH);
  964. }
  965. /**
  966. * Replace the policy_entry_list TEXTAREA component in the
  967. * PolicyTool window with an updated one.
  968. */
  969. void replacePolicyList(List policyList) {
  970. // remove the original list of Policy Entries
  971. // and add the new list of entries
  972. List list = (List)getComponent(MW_POLICY_LIST);
  973. list.removeAll();
  974. String newItems[] = policyList.getItems();
  975. for (int i = 0; i < newItems.length; i++)
  976. list.add(newItems[i]);
  977. }
  978. /**
  979. * display the main PolicyTool window
  980. */
  981. void displayToolWindow(String args[]) {
  982. setTitle(PolicyTool.rb.getString("Policy.Tool"));
  983. setResizable(true);
  984. addWindowListener(new ToolWindowListener(this));
  985. setBounds(135, 80, 500, 500);
  986. setLayout(new GridBagLayout());
  987. initWindow();
  988. // display it
  989. setVisible(true);
  990. if (tool.newWarning == true) {
  991. displayStatusDialog(this, PolicyTool.rb.getString
  992. ("Errors.have.occurred.while.opening.the.policy.configuration.View.the.Warning.Log.for.more.information."));
  993. }
  994. }
  995. /**
  996. * displays a dialog box describing an error which occurred.
  997. */
  998. void displayErrorDialog(Window w, String error) {
  999. ToolDialog ed = new ToolDialog
  1000. (PolicyTool.rb.getString("Error"), tool, this, true);
  1001. // find where the PolicyTool gui is
  1002. Point location = ((w == null) ?
  1003. getLocationOnScreen() : w.getLocationOnScreen());
  1004. ed.setBounds(location.x + 50, location.y + 50, 600, 100);
  1005. ed.setLayout(new GridBagLayout());
  1006. Label label = new Label(error);
  1007. addNewComponent(ed, label, 0,
  1008. 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);
  1009. Button okButton = new Button(PolicyTool.rb.getString("OK"));
  1010. okButton.addActionListener(new ErrorOKButtonListener(ed));
  1011. addNewComponent(ed, okButton, 1,
  1012. 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
  1013. ed.pack();
  1014. ed.setVisible(true);
  1015. }
  1016. /**
  1017. * displays a dialog box describing an error which occurred.
  1018. */
  1019. void displayErrorDialog(Window w, Throwable t) {
  1020. if (t instanceof NoDisplayException) {
  1021. return;
  1022. }
  1023. displayErrorDialog(w, t.toString());
  1024. }
  1025. /**
  1026. * displays a dialog box describing the status of an event
  1027. */
  1028. void displayStatusDialog(Window w, String status) {
  1029. ToolDialog sd = new ToolDialog
  1030. (PolicyTool.rb.getString("Status"), tool, this, true);
  1031. // find the location of the PolicyTool gui
  1032. Point location = ((w == null) ?
  1033. getLocationOnScreen() : w.getLocationOnScreen());
  1034. sd.setBounds(location.x + 50, location.y + 50, 500, 100);
  1035. sd.setLayout(new GridBagLayout());
  1036. Label label = new Label(status);
  1037. addNewComponent(sd, label, 0,
  1038. 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);
  1039. Button okButton = new Button(PolicyTool.rb.getString("OK"));
  1040. okButton.addActionListener(new StatusOKButtonListener(sd));
  1041. addNewComponent(sd, okButton, 1,
  1042. 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
  1043. sd.pack();
  1044. sd.setVisible(true);
  1045. }
  1046. /**
  1047. * display the warning log
  1048. */
  1049. void displayWarningLog(Window w) {
  1050. ToolDialog wd = new ToolDialog
  1051. (PolicyTool.rb.getString("Warning"), tool, this, true);
  1052. // find the location of the PolicyTool gui
  1053. Point location = ((w == null) ?
  1054. getLocationOnScreen() : w.getLocationOnScreen());
  1055. wd.setBounds(location.x + 50, location.y + 50, 500, 100);
  1056. wd.setLayout(new GridBagLayout());
  1057. TextArea ta = new TextArea();
  1058. ta.setEditable(false);
  1059. for (int i = 0; i < tool.warnings.size(); i++) {
  1060. ta.append(tool.warnings.elementAt(i));
  1061. ta.append(PolicyTool.rb.getString("NEWLINE"));
  1062. }
  1063. addNewComponent(wd, ta, 0,
  1064. 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH,
  1065. BOTTOM_PADDING);
  1066. ta.setFocusable(false);
  1067. Button okButton = new Button(PolicyTool.rb.getString("OK"));
  1068. okButton.addActionListener(new CancelButtonListener(wd));
  1069. addNewComponent(wd, okButton, 1,
  1070. 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
  1071. LR_PADDING);
  1072. wd.pack();
  1073. wd.setVisible(true);
  1074. }
  1075. char displayYesNoDialog(Window w, String title, String prompt, String yes, String no) {
  1076. final ToolDialog tw = new ToolDialog
  1077. (title, tool, this, true);
  1078. Point location = ((w == null) ?
  1079. getLocationOnScreen() : w.getLocationOnScreen());
  1080. tw.setBounds(location.x + 75, location.y + 100, 400, 150);
  1081. tw.setLayout(new GridBagLayout());
  1082. TextArea ta = new TextArea(prompt, 10, 50, TextArea.SCROLLBARS_VERTICAL_ONLY);
  1083. ta.setEditable(false);
  1084. addNewComponent(tw, ta, 0,
  1085. 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.BOTH);
  1086. ta.setFocusable(false);
  1087. Panel panel = new Panel();
  1088. panel.setLayout(new GridBagLayout());
  1089. // StringBuffer to store button press. Must be final.
  1090. final StringBuffer chooseResult = new StringBuffer();
  1091. Button button = new Button(yes);
  1092. button.addActionListener(new ActionListener() {
  1093. public void actionPerformed(ActionEvent e) {
  1094. chooseResult.append('Y');
  1095. tw.setVisible(false);
  1096. tw.dispose();
  1097. }
  1098. });
  1099. addNewComponent(panel, button, 0,
  1100. 0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
  1101. LR_PADDING);
  1102. button = new Button(no);
  1103. button.addActionListener(new ActionListener() {
  1104. public void actionPerformed(ActionEvent e) {
  1105. chooseResult.append('N');
  1106. tw.setVisible(false);
  1107. tw.dispose();
  1108. }
  1109. });
  1110. addNewComponent(panel, button, 1,
  1111. 1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL,
  1112. LR_PADDING);
  1113. addNewComponent(tw, panel, 1,
  1114. 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.VERTICAL);
  1115. tw.pack();
  1116. tw.setVisible(true);
  1117. if (chooseResult.length() > 0) {
  1118. return chooseResult.charAt(0);
  1119. } else {
  1120. // I did encounter this once, don't why.
  1121. return 'N';
  1122. }
  1123. }
  1124. }
  1125. /**
  1126. * General dialog window
  1127. */
  1128. class ToolDialog extends Dialog {
  1129. // use serialVersionUID from JDK 1.2.2 for interoperability
  1130. private static final long serialVersionUID = -372244357011301190L;
  1131. /* necessary constants */
  1132. public static final int NOACTION = 0;
  1133. public static final int QUIT = 1;
  1134. public static final int NEW = 2;
  1135. public static final int OPEN = 3;
  1136. public static final String ALL_PERM_CLASS =
  1137. "java.security.AllPermission";
  1138. public static final String FILE_PERM_CLASS =
  1139. "java.io.FilePermission";
  1140. public static final String X500_PRIN_CLASS =
  1141. "javax.security.auth.x500.X500Principal";
  1142. /* popup menus */
  1143. public static final String PERM =
  1144. PolicyTool.rb.getString
  1145. ("Permission.");
  1146. public static final String PRIN_TYPE =
  1147. PolicyTool.rb.getString("Principal.Type.");
  1148. public static final String PRIN_NAME =
  1149. PolicyTool.rb.getString("Principal.Name.");
  1150. /* more popu menus */
  1151. public static final String PERM_NAME =
  1152. PolicyTool.rb.getString
  1153. ("Target.Name.");
  1154. /* and more popup menus */
  1155. public static final String PERM_ACTIONS =
  1156. PolicyTool.rb.getString
  1157. ("Actions.");
  1158. /* gridbag index for display PolicyEntry (PE) components */
  1159. public static final int PE_CODEBASE_LABEL = 0;
  1160. public static final int PE_CODEBASE_TEXTFIELD = 1;
  1161. public static final int PE_SIGNEDBY_LABEL = 2;
  1162. public static final int PE_SIGNEDBY_TEXTFIELD = 3;
  1163. public static final int PE_PANEL0 = 4;
  1164. public static final int PE_ADD_PRIN_BUTTON = 0;
  1165. public static final int PE_EDIT_PRIN_BUTTON = 1;
  1166. public static final int PE_REMOVE_PRIN_BUTTON = 2;
  1167. public static final int PE_PRIN_LABEL = 5;
  1168. public static final int PE_PRIN_LIST = 6;
  1169. public static final int PE_PANEL1 = 7;
  1170. public static final int PE_ADD_PERM_BUTTON = 0;
  1171. public static final int PE_EDIT_PERM_BUTTON = 1;
  1172. public static final int PE_REMOVE_PERM_BUTTON = 2;
  1173. public static final int PE_PERM_LIST = 8;
  1174. public static final int PE_PANEL2 = 9;
  1175. public static final int PE_CANCEL_BUTTON = 1;
  1176. public static final int PE_DONE_BUTTON = 0;
  1177. /* the gridbag index for components in the Principal Dialog (PRD) */
  1178. public static final int PRD_DESC_LABEL = 0;
  1179. public static final int PRD_PRIN_CHOICE = 1;
  1180. public static final int PRD_PRIN_TEXTFIELD = 2;
  1181. public static final int PRD_NAME_LABEL = 3;
  1182. public static final int PRD_NAME_TEXTFIELD = 4;
  1183. public static final int PRD_CANCEL_BUTTON = 6;
  1184. public static final int PRD_OK_BUTTON = 5;
  1185. /* the gridbag index for components in the Permission Dialog (PD) */
  1186. public static final int PD_DESC_LABEL = 0;
  1187. public static final int PD_PERM_CHOICE = 1;
  1188. public static final int PD_PERM_TEXTFIELD = 2;
  1189. public static final int PD_NAME_CHOICE = 3;
  1190. public static final int PD_NAME_TEXTFIELD = 4;
  1191. public static final int PD_ACTIONS_CHOICE = 5;
  1192. public static final int PD_ACTIONS_TEXTFIELD = 6;
  1193. public static final int PD_SIGNEDBY_LABEL = 7;

Large files files are truncated, but you can click here to view the full file