Integrated TUV r2034,2035,2036: Added bouncycastle JCE provider
Added second part of r2038 previously forgotten. git-svn-id: https://svn.libreccm.org/ccm/trunk@309 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
d63b3d60c9
commit
0414a7e266
Binary file not shown.
|
|
@ -0,0 +1,13 @@
|
||||||
|
Copyright (c) 2000 - 2009 The Legion Of The Bouncy Castle (http://www.bouncycastle.org)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Copyright (c) 2000 - 2009 The Legion Of The Bouncy Castle (http://www.bouncycastle.org)
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
@ -18,8 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.kernel.security;
|
package com.arsdigita.kernel.security;
|
||||||
|
|
||||||
import com.arsdigita.util.UncheckedWrapperException;
|
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
|
|
@ -31,6 +29,7 @@ import java.security.Security;
|
||||||
import java.security.spec.AlgorithmParameterSpec;
|
import java.security.spec.AlgorithmParameterSpec;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.crypto.Cipher;
|
import javax.crypto.Cipher;
|
||||||
import javax.crypto.Mac;
|
import javax.crypto.Mac;
|
||||||
import javax.crypto.SecretKey;
|
import javax.crypto.SecretKey;
|
||||||
|
|
@ -41,16 +40,19 @@ import javax.crypto.spec.SecretKeySpec;
|
||||||
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||||
|
|
||||||
|
import com.arsdigita.util.UncheckedWrapperException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides cryptographic functions and stores the server's secret key.
|
* Provides cryptographic functions and stores the server's secret key.
|
||||||
*
|
*
|
||||||
* @author Sameer Ajmani
|
* @author Sameer Ajmani
|
||||||
* @since ACS 4.5
|
* @since ACS 4.5
|
||||||
|
* @version $Id: Crypto.java 738 2005-09-01 12:36:52Z sskracic $
|
||||||
**/
|
**/
|
||||||
public class Crypto {
|
public class Crypto {
|
||||||
|
|
||||||
public static final String versionId = "$Id: Crypto.java 738 2005-09-01 12:36:52Z sskracic $ by $Author: sskracic $, $DateTime: 2004/08/16 18:10:38 $";
|
|
||||||
private static final Logger s_log =
|
private static final Logger s_log =
|
||||||
Logger.getLogger(Crypto.class);
|
Logger.getLogger(Crypto.class);
|
||||||
private static int PBE_SALT_BYTES = 8; // required by SunJCE
|
private static int PBE_SALT_BYTES = 8; // required by SunJCE
|
||||||
|
|
@ -64,6 +66,10 @@ public class Crypto {
|
||||||
|
|
||||||
public static final String CHARACTER_ENCODING = "UTF-8";
|
public static final String CHARACTER_ENCODING = "UTF-8";
|
||||||
|
|
||||||
|
static {
|
||||||
|
Security.addProvider(new BouncyCastleProvider());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Message Authentication Code (MAC) calculator that uses
|
* Creates a new Message Authentication Code (MAC) calculator that uses
|
||||||
* the server's secret key.
|
* the server's secret key.
|
||||||
|
|
@ -103,7 +109,7 @@ public class Crypto {
|
||||||
} catch (NoSuchAlgorithmException ex) {
|
} catch (NoSuchAlgorithmException ex) {
|
||||||
String msg =
|
String msg =
|
||||||
"Couldn't find " + PREFERRED_MAC_ALGO + ". Make sure you have the right" +
|
"Couldn't find " + PREFERRED_MAC_ALGO + ". Make sure you have the right" +
|
||||||
"provider(s) installed. Check $JAVA_HOME/jre/lib/java.security";
|
"provider(s) installed. Check $JAVA_HOME/jre/lib/security/java.security";
|
||||||
s_log.error(msg, ex);
|
s_log.error(msg, ex);
|
||||||
throw new KernelLoginException(msg, ex);
|
throw new KernelLoginException(msg, ex);
|
||||||
}
|
}
|
||||||
|
|
@ -348,10 +354,18 @@ public class Crypto {
|
||||||
|
|
||||||
Provider[] jceProviders = Security.getProviders();
|
Provider[] jceProviders = Security.getProviders();
|
||||||
for (int i = 0 ; i < jceProviders.length ; i++) {
|
for (int i = 0 ; i < jceProviders.length ; i++) {
|
||||||
|
|
||||||
|
if (s_log.isDebugEnabled()) {
|
||||||
|
s_log.info("Security provider: " + jceProviders[i].getName());
|
||||||
|
}
|
||||||
Set e = jceProviders[i].entrySet();
|
Set e = jceProviders[i].entrySet();
|
||||||
Iterator iterator = e.iterator();
|
Iterator iterator = e.iterator();
|
||||||
while ( iterator.hasNext() ) {
|
while ( iterator.hasNext() ) {
|
||||||
String current = iterator.next().toString();
|
String current = iterator.next().toString();
|
||||||
|
|
||||||
|
if (s_log.isDebugEnabled()) {
|
||||||
|
s_log.info("\t" + current);
|
||||||
|
}
|
||||||
if ( current.startsWith("Mac") ) {
|
if ( current.startsWith("Mac") ) {
|
||||||
algorithm = current.substring(4,current.indexOf("="));
|
algorithm = current.substring(4,current.indexOf("="));
|
||||||
if ( algorithm.indexOf("ImplementedIn") == -1 &&
|
if ( algorithm.indexOf("ImplementedIn") == -1 &&
|
||||||
|
|
|
||||||
|
|
@ -172,5 +172,6 @@
|
||||||
<classpathentry kind="lib" path="ccm-ldn-terms/lib/jena.jar"/>
|
<classpathentry kind="lib" path="ccm-ldn-terms/lib/jena.jar"/>
|
||||||
<classpathentry kind="lib" path="ccm-ldn-terms/lib/xpp3-1.1.4c.jar"/>
|
<classpathentry kind="lib" path="ccm-ldn-terms/lib/xpp3-1.1.4c.jar"/>
|
||||||
<classpathentry kind="lib" path="ccm-ldn-terms/lib/xstream-1.3.1.jar"/>
|
<classpathentry kind="lib" path="ccm-ldn-terms/lib/xstream-1.3.1.jar"/>
|
||||||
|
<classpathentry kind="lib" path="ccm-core/lib/bcprov-jdk16-144.jar"/>
|
||||||
<classpathentry kind="output" path="build/eclipse/classes"/>
|
<classpathentry kind="output" path="build/eclipse/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
-- Usage: psql --username=postgres --file=create_db.sql
|
||||||
|
-- createlang --username=ccm -d ccm plpgsql
|
||||||
|
|
||||||
|
CREATE USER ccm PASSWORD 'ccm';
|
||||||
|
CREATE DATABASE ccm WITH ENCODING='UTF8' OWNER=ccm;
|
||||||
Loading…
Reference in New Issue