sun.security.tools.PathList Java Examples

The following examples show how to use sun.security.tools.PathList. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Main.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private ContentSigner loadSigningMechanism(String signerClassName,
    String signerClassPath) throws Exception {

    // construct class loader
    String cpString = null;   // make sure env.class.path defaults to dot

    // do prepends to get correct ordering
    cpString = PathList.appendPath(System.getProperty("env.class.path"), cpString);
    cpString = PathList.appendPath(System.getProperty("java.class.path"), cpString);
    cpString = PathList.appendPath(signerClassPath, cpString);
    URL[] urls = PathList.pathToURLs(cpString);
    ClassLoader appClassLoader = new URLClassLoader(urls);

    // attempt to find signer
    Class<?> signerClass = appClassLoader.loadClass(signerClassName);

    // Check that it implements ContentSigner
    Object signer = signerClass.newInstance();
    if (!(signer instanceof ContentSigner)) {
        MessageFormat form = new MessageFormat(
            rb.getString("signerClass.is.not.a.signing.mechanism"));
        Object[] source = {signerClass.getName()};
        throw new IllegalArgumentException(form.format(source));
    }
    return (ContentSigner)signer;
}
 
Example #2
Source File: Main.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private ContentSigner loadSigningMechanism(String signerClassName,
    String signerClassPath) throws Exception {

    // construct class loader
    String cpString = null;   // make sure env.class.path defaults to dot

    // do prepends to get correct ordering
    cpString = PathList.appendPath(System.getProperty("env.class.path"), cpString);
    cpString = PathList.appendPath(System.getProperty("java.class.path"), cpString);
    cpString = PathList.appendPath(signerClassPath, cpString);
    URL[] urls = PathList.pathToURLs(cpString);
    ClassLoader appClassLoader = new URLClassLoader(urls);

    // attempt to find signer
    Class<?> signerClass = appClassLoader.loadClass(signerClassName);

    // Check that it implements ContentSigner
    Object signer = signerClass.newInstance();
    if (!(signer instanceof ContentSigner)) {
        MessageFormat form = new MessageFormat(
            rb.getString("signerClass.is.not.a.signing.mechanism"));
        Object[] source = {signerClass.getName()};
        throw new IllegalArgumentException(form.format(source));
    }
    return (ContentSigner)signer;
}
 
Example #3
Source File: Main.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private ContentSigner loadSigningMechanism(String signerClassName,
    String signerClassPath) throws Exception {

    // construct class loader
    String cpString = null;   // make sure env.class.path defaults to dot

    // do prepends to get correct ordering
    cpString = PathList.appendPath(System.getProperty("env.class.path"), cpString);
    cpString = PathList.appendPath(System.getProperty("java.class.path"), cpString);
    cpString = PathList.appendPath(signerClassPath, cpString);
    URL[] urls = PathList.pathToURLs(cpString);
    ClassLoader appClassLoader = new URLClassLoader(urls);

    // attempt to find signer
    Class<?> signerClass = appClassLoader.loadClass(signerClassName);

    // Check that it implements ContentSigner
    Object signer = signerClass.newInstance();
    if (!(signer instanceof ContentSigner)) {
        MessageFormat form = new MessageFormat(
            rb.getString("signerClass.is.not.a.signing.mechanism"));
        Object[] source = {signerClass.getName()};
        throw new IllegalArgumentException(form.format(source));
    }
    return (ContentSigner)signer;
}
 
Example #4
Source File: Main.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private ContentSigner loadSigningMechanism(String signerClassName,
    String signerClassPath) throws Exception {

    // construct class loader
    String cpString = null;   // make sure env.class.path defaults to dot

    // do prepends to get correct ordering
    cpString = PathList.appendPath(System.getProperty("env.class.path"), cpString);
    cpString = PathList.appendPath(System.getProperty("java.class.path"), cpString);
    cpString = PathList.appendPath(signerClassPath, cpString);
    URL[] urls = PathList.pathToURLs(cpString);
    ClassLoader appClassLoader = new URLClassLoader(urls);

    // attempt to find signer
    Class<?> signerClass = appClassLoader.loadClass(signerClassName);

    // Check that it implements ContentSigner
    Object signer = signerClass.newInstance();
    if (!(signer instanceof ContentSigner)) {
        MessageFormat form = new MessageFormat(
            rb.getString("signerClass.is.not.a.signing.mechanism"));
        Object[] source = {signerClass.getName()};
        throw new IllegalArgumentException(form.format(source));
    }
    return (ContentSigner)signer;
}
 
Example #5
Source File: Main.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private ContentSigner loadSigningMechanism(String signerClassName,
    String signerClassPath) throws Exception {

    // construct class loader
    String cpString = null;   // make sure env.class.path defaults to dot

    // do prepends to get correct ordering
    cpString = PathList.appendPath(System.getProperty("env.class.path"), cpString);
    cpString = PathList.appendPath(System.getProperty("java.class.path"), cpString);
    cpString = PathList.appendPath(signerClassPath, cpString);
    URL[] urls = PathList.pathToURLs(cpString);
    ClassLoader appClassLoader = new URLClassLoader(urls);

    // attempt to find signer
    Class<?> signerClass = appClassLoader.loadClass(signerClassName);

    // Check that it implements ContentSigner
    Object signer = signerClass.newInstance();
    if (!(signer instanceof ContentSigner)) {
        MessageFormat form = new MessageFormat(
            rb.getString("signerClass.is.not.a.signing.mechanism"));
        Object[] source = {signerClass.getName()};
        throw new IllegalArgumentException(form.format(source));
    }
    return (ContentSigner)signer;
}
 
Example #6
Source File: Main.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private ContentSigner loadSigningMechanism(String signerClassName,
    String signerClassPath) throws Exception {

    // construct class loader
    String cpString = null;   // make sure env.class.path defaults to dot

    // do prepends to get correct ordering
    cpString = PathList.appendPath(System.getProperty("env.class.path"), cpString);
    cpString = PathList.appendPath(System.getProperty("java.class.path"), cpString);
    cpString = PathList.appendPath(signerClassPath, cpString);
    URL[] urls = PathList.pathToURLs(cpString);
    ClassLoader appClassLoader = new URLClassLoader(urls);

    // attempt to find signer
    Class<?> signerClass = appClassLoader.loadClass(signerClassName);

    // Check that it implements ContentSigner
    Object signer = signerClass.newInstance();
    if (!(signer instanceof ContentSigner)) {
        MessageFormat form = new MessageFormat(
            rb.getString("signerClass.is.not.a.signing.mechanism"));
        Object[] source = {signerClass.getName()};
        throw new IllegalArgumentException(form.format(source));
    }
    return (ContentSigner)signer;
}
 
Example #7
Source File: Main.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private ContentSigner loadSigningMechanism(String signerClassName,
    String signerClassPath) throws Exception {

    // construct class loader
    String cpString = null;   // make sure env.class.path defaults to dot

    // do prepends to get correct ordering
    cpString = PathList.appendPath(System.getProperty("env.class.path"), cpString);
    cpString = PathList.appendPath(System.getProperty("java.class.path"), cpString);
    cpString = PathList.appendPath(signerClassPath, cpString);
    URL[] urls = PathList.pathToURLs(cpString);
    ClassLoader appClassLoader = new URLClassLoader(urls);

    // attempt to find signer
    Class<?> signerClass = appClassLoader.loadClass(signerClassName);

    // Check that it implements ContentSigner
    Object signer = signerClass.newInstance();
    if (!(signer instanceof ContentSigner)) {
        MessageFormat form = new MessageFormat(
            rb.getString("signerClass.is.not.a.signing.mechanism"));
        Object[] source = {signerClass.getName()};
        throw new IllegalArgumentException(form.format(source));
    }
    return (ContentSigner)signer;
}
 
Example #8
Source File: Main.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private ContentSigner loadSigningMechanism(String signerClassName,
    String signerClassPath) throws Exception {

    // construct class loader
    String cpString = null;   // make sure env.class.path defaults to dot

    // do prepends to get correct ordering
    cpString = PathList.appendPath(System.getProperty("env.class.path"), cpString);
    cpString = PathList.appendPath(System.getProperty("java.class.path"), cpString);
    cpString = PathList.appendPath(signerClassPath, cpString);
    URL[] urls = PathList.pathToURLs(cpString);
    ClassLoader appClassLoader = new URLClassLoader(urls);

    // attempt to find signer
    Class<?> signerClass = appClassLoader.loadClass(signerClassName);

    // Check that it implements ContentSigner
    Object signer = signerClass.newInstance();
    if (!(signer instanceof ContentSigner)) {
        MessageFormat form = new MessageFormat(
            rb.getString("signerClass.is.not.a.signing.mechanism"));
        Object[] source = {signerClass.getName()};
        throw new IllegalArgumentException(form.format(source));
    }
    return (ContentSigner)signer;
}
 
Example #9
Source File: Main.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private ContentSigner loadSigningMechanism(String signerClassName,
    String signerClassPath) throws Exception {

    // construct class loader
    String cpString = null;   // make sure env.class.path defaults to dot

    // do prepends to get correct ordering
    cpString = PathList.appendPath(System.getProperty("env.class.path"), cpString);
    cpString = PathList.appendPath(System.getProperty("java.class.path"), cpString);
    cpString = PathList.appendPath(signerClassPath, cpString);
    URL[] urls = PathList.pathToURLs(cpString);
    ClassLoader appClassLoader = new URLClassLoader(urls);

    // attempt to find signer
    Class<?> signerClass = appClassLoader.loadClass(signerClassName);

    // Check that it implements ContentSigner
    Object signer = signerClass.newInstance();
    if (!(signer instanceof ContentSigner)) {
        MessageFormat form = new MessageFormat(
            rb.getString("signerClass.is.not.a.signing.mechanism"));
        Object[] source = {signerClass.getName()};
        throw new IllegalArgumentException(form.format(source));
    }
    return (ContentSigner)signer;
}
 
Example #10
Source File: Main.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private ContentSigner loadSigningMechanism(String signerClassName,
    String signerClassPath) throws Exception {

    // construct class loader
    String cpString = null;   // make sure env.class.path defaults to dot

    // do prepends to get correct ordering
    cpString = PathList.appendPath(System.getProperty("env.class.path"), cpString);
    cpString = PathList.appendPath(System.getProperty("java.class.path"), cpString);
    cpString = PathList.appendPath(signerClassPath, cpString);
    URL[] urls = PathList.pathToURLs(cpString);
    ClassLoader appClassLoader = new URLClassLoader(urls);

    // attempt to find signer
    Class<?> signerClass = appClassLoader.loadClass(signerClassName);

    // Check that it implements ContentSigner
    Object signer = signerClass.newInstance();
    if (!(signer instanceof ContentSigner)) {
        MessageFormat form = new MessageFormat(
            rb.getString("signerClass.is.not.a.signing.mechanism"));
        Object[] source = {signerClass.getName()};
        throw new IllegalArgumentException(form.format(source));
    }
    return (ContentSigner)signer;
}
 
Example #11
Source File: Main.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private ContentSigner loadSigningMechanism(String signerClassName,
    String signerClassPath) throws Exception {

    // construct class loader
    String cpString = null;   // make sure env.class.path defaults to dot

    // do prepends to get correct ordering
    cpString = PathList.appendPath(System.getProperty("env.class.path"), cpString);
    cpString = PathList.appendPath(System.getProperty("java.class.path"), cpString);
    cpString = PathList.appendPath(signerClassPath, cpString);
    URL[] urls = PathList.pathToURLs(cpString);
    ClassLoader appClassLoader = new URLClassLoader(urls);

    // attempt to find signer
    Class<?> signerClass = appClassLoader.loadClass(signerClassName);

    // Check that it implements ContentSigner
    Object signer = signerClass.newInstance();
    if (!(signer instanceof ContentSigner)) {
        MessageFormat form = new MessageFormat(
            rb.getString("signerClass.is.not.a.signing.mechanism"));
        Object[] source = {signerClass.getName()};
        throw new IllegalArgumentException(form.format(source));
    }
    return (ContentSigner)signer;
}
 
Example #12
Source File: Main.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private ContentSigner loadSigningMechanism(String signerClassName,
    String signerClassPath) throws Exception {

    // construct class loader
    String cpString = null;   // make sure env.class.path defaults to dot

    // do prepends to get correct ordering
    cpString = PathList.appendPath(System.getProperty("env.class.path"), cpString);
    cpString = PathList.appendPath(System.getProperty("java.class.path"), cpString);
    cpString = PathList.appendPath(signerClassPath, cpString);
    URL[] urls = PathList.pathToURLs(cpString);
    ClassLoader appClassLoader = new URLClassLoader(urls);

    // attempt to find signer
    Class<?> signerClass = appClassLoader.loadClass(signerClassName);

    // Check that it implements ContentSigner
    Object signer = signerClass.newInstance();
    if (!(signer instanceof ContentSigner)) {
        MessageFormat form = new MessageFormat(
            rb.getString("signerClass.is.not.a.signing.mechanism"));
        Object[] source = {signerClass.getName()};
        throw new IllegalArgumentException(form.format(source));
    }
    return (ContentSigner)signer;
}
 
Example #13
Source File: JarSigner.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
private ContentSigner loadSigningMechanism(String signerClassName,
                                           String signerClassPath) {

    // construct class loader
    String cpString;   // make sure env.class.path defaults to dot

    // do prepends to get correct ordering
    cpString = PathList.appendPath(
            System.getProperty("env.class.path"), null);
    cpString = PathList.appendPath(
            System.getProperty("java.class.path"), cpString);
    cpString = PathList.appendPath(signerClassPath, cpString);
    URL[] urls = PathList.pathToURLs(cpString);
    ClassLoader appClassLoader = new URLClassLoader(urls);

    try {
        // attempt to find signer
        Class<?> signerClass = appClassLoader.loadClass(signerClassName);
        Object signer = signerClass.newInstance();
        return (ContentSigner) signer;
    } catch (ClassNotFoundException|InstantiationException|
            IllegalAccessException|ClassCastException e) {
        throw new IllegalArgumentException(
                "Invalid altSigner or altSignerPath", e);
    }
}