[ 
https://issues.apache.org/jira/browse/KARAF-4062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14958676#comment-14958676
 ] 

Freeman Fang commented on KARAF-4062:
-------------------------------------

Something like
{code}
--- a/client/src/main/java/org/apache/karaf/client/Main.java
+++ b/client/src/main/java/org/apache/karaf/client/Main.java
@@ -20,6 +20,8 @@ import java.io.*;
 import java.net.URL;
 import java.nio.charset.Charset;
 import java.security.KeyPair;
+import java.security.Provider;
+import java.security.Security;
 import java.util.Iterator;
 import java.util.Locale;
 import java.util.Properties;
@@ -52,6 +54,7 @@ public class Main {
     private static final String GROUP_PREFIX = "_g_";
 
     public static void main(String[] args) throws Exception {
+        addProvider("org.bouncycastle.jce.provider.BouncyCastleProvider");
         Properties shellCfg = loadProps(new 
File(System.getProperty("karaf.etc"), "org.apache.karaf.shell.cfg"));
 
         String host = shellCfg.getProperty("sshHost", "localhost");
@@ -316,6 +319,13 @@ public class Main {
         System.exit(exitStatus);
     }
 
+    private static void addProvider(String provider) {
+        try {
+            Security.addProvider((Provider) 
Class.forName(provider).newInstance());
+        } catch (Throwable t) {
+            System.err.println("Unable to register security provider: " + t);
+        }
+    }
{code}

and add BouncyCastle into CLASSPATH of bin/client.

Cheers
Freeman

> Karaf client does now work after installing BouncyCastle
> --------------------------------------------------------
>
>                 Key: KARAF-4062
>                 URL: https://issues.apache.org/jira/browse/KARAF-4062
>             Project: Karaf
>          Issue Type: Bug
>    Affects Versions: 4.0.2
>         Environment: OS X, Windows
>            Reporter: Pavlo Vasylchenko
>            Assignee: Freeman Fang
>             Fix For: 4.0.3
>
>
> Karaf client throws:
> " Exception caught
> java.security.InvalidAlgorithmParameterException: Prime size must be multiple 
> of 64, and can only ra
> nge from 512 to 2048 (inclusive)
>         at 
> com.sun.crypto.provider.DHKeyPairGenerator.initialize(DHKeyPairGenerator.java:120)"
> after installing mvn:org.bouncycastle/bcprov-jdk15on/1.52 into container



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to