2362N/A * Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * This class verifies JAR files (and any supporting JAR files), and 0N/A * determines whether they may be used in this implementation. 0N/A * The JCE in OpenJDK has an open cryptographic interface, meaning it 0N/A * does not restrict which providers can be used. Compliance with 0N/A * United States export controls and with local law governing the 0N/A * the responsibility of the licensee. 0N/A // The URL for the JAR file we want to verify. 0N/A * Creates a JarVerifier object to verify the given URL. 0N/A * @param jarURL the JAR file to be verified. 0N/A * @param savePerms if true, save the permissions allowed by the 0N/A * exemption mechanism 0N/A * Verify the JAR file is signed by an entity which has a certificate 0N/A * issued by a trusted CA. 0N/A * In OpenJDK, we just need to examine the "cryptoperms" file to see 0N/A * if any permissions were bundled together with this jar file. 0N/A // Short-circuit. If we weren't asked to save any, we're done. 0N/A // If the protocol of jarURL isn't "jar", we should 0N/A // construct a JAR URL so we can open a JarURLConnection 0N/A // for verifying this provider. 0N/A // Get a link to the Jarfile to search. 0N/A // You could do some caching here as 0N/A "Can not find cryptoPerms");
0N/A // Only call close() when caching is not enabled. 0N/A // Otherwise, exceptions will be thrown for all 0N/A // subsequent accesses of this cached jar. 0N/A * Verify that the provided certs include the 0N/A * framework signing certificate. 0N/A * @param certs the list of certs to be checked. 0N/A * @throws Exception if the list of certs did not contain 0N/A * the framework signing certificate 0N/A * Returns the permissions which are bundled with the JAR file, 0N/A * aka the "cryptoperms" file. 0N/A * NOTE: if this JarVerifier instance is constructed with "savePerms" 0N/A * equal to false, then this method would always return null.