org.jpedal.io.security.SetSecurity Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of OpenViewerFX Show documentation
Show all versions of OpenViewerFX Show documentation
Open Source (LGPL) JavaFX PDF Viewer for NetBeans plugin
/*
* ===========================================
* 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();
}
}
}