/*
 * Part of the CCNx Java Library.
 *
 * Copyright (C) 2010 Palo Alto Research Center, Inc.
 *
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License version 2.1
 * as published by the Free Software Foundation. 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details. You should have received
 * a copy of the GNU Lesser General Public License along with this library;
 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
 * Fifth Floor, Boston, MA 02110-1301 USA.
 */

package org.ccnx.ccn.config;

import java.security.Provider;
import java.security.Security;

import org.bouncycastle.jce.provider.BouncyCastleProvider;

import org.ccnx.ccn.impl.support.Log;

/**
 * Determine any platform-specific flags
 */
public final class PlatformConfiguration {

	// ==============================================
	// Public interface
	public final static boolean needSignatureLock() {
		return _needSignatureLock;
	}

	// ==============================================
	// Internal methods
	private final static boolean _needSignatureLock;

	static {
		// Default is not to lock signature operations unless we're using
		// BC 1.34 (as seen on Android)
		boolean needLock = false;
		
		try {
			Log.info("BC provider: " + BouncyCastleProvider.PROVIDER_NAME);

			Security.addProvider(new BouncyCastleProvider());

			Provider prov = Security.getProvider(BouncyCastleProvider.PROVIDER_NAME);
			Log.severe("Provider info: " + prov.getInfo());
			Log.severe("Provider ver : " + prov.getVersion());

			// The unix/mac code uses "BouncyCastle Security Provider v1.43"
			// The Android code uses "BouncyCastle Security Provider v1.34"

			if( prov.getVersion() == 1.34 ) {
				needLock = true;
			}
		} catch(Exception e) {
			e.printStackTrace();
		}

		_needSignatureLock = needLock;
	}
}

@@ -855,16 +855,48 @@
 ecurity;
+%0Aimport java.util.logging.Level;
 %0A%0Aimport
@@ -1500,18 +1500,16 @@
  false;%0A
-%09%09
 %0A%09%09try %7B
@@ -1707,38 +1707,36 @@
 R_NAME);%0A%09%09%09Log.
-severe
+info
 (%22Provider info:
@@ -1740,62 +1740,42 @@
 fo: 
-%22 + prov.getInfo());%0A%09%09%09Log.severe(%22Provider ver : %22 +
+%7B0%7D version: %7B1%7D%22, prov.getInfo(),
  pro

Change severe logging to info in security provider startup. Refs #100269