All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jpedal.io.security.SetSecurity Maven / Gradle / Ivy

There is a newer version: 7.15.25
Show newest version
/*
 * ===========================================
 * Java Pdf Extraction Decoding Access Library
 * ===========================================
 *
 * Project Info:  http://www.idrsolutions.com
 * Help section for developers at http://www.idrsolutions.com/support/
 *
 * (C) Copyright 1997-2017 IDRsolutions and Contributors.
 *
 * This file is part of JPedal/JPDF2HTML5
 *
 @LICENSE@
 *
 * ---------------
 * SetSecurity.java
 * ---------------
 */
package org.jpedal.io.security;

import java.security.Security;

import org.jpedal.utils.LogWriter;

public class SetSecurity {

    private static String altSP;
    public static boolean useBouncyCastle;

    public static void init() {

        //allow user to over-ride
        altSP = System.getProperty("org.jpedal.securityprovider");

        if (altSP == null) {
            altSP = "org.bouncycastle.jce.provider.BouncyCastleProvider";
        }

        try {

            final Class c = Class.forName(altSP);
            final java.security.Provider provider = (java.security.Provider) c.newInstance();

            Security.addProvider(provider);
            useBouncyCastle = true;
        } catch (final Exception e) {
            LogWriter.writeLog("Running default JCA security provider because no other provider found or supplied.");
            e.getMessage();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy