Quantcast

HOW CAN I ADD BOUNCY CASTLE AS A PROVIDER

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

HOW CAN I ADD BOUNCY CASTLE AS A PROVIDER

M.Schilling

Is there any other way ( than this:                 http://www.bouncycastle.org/wiki/display/JA1/Provider+Installation )
to install bouncy castle as a java security provider?

Because I can't  change the file $JAVA_HOME/jre/lib/security/java.security
and if I install the Provider dynamically I get this Exception:

Exception in thread "main" org.bouncycastle.openpgp.PGPException: Exception creating cipher
        at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
        at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
        at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
        at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
        at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
        at crypt.RSAKeyPairGenerator.exportKeyPair(RSAKeyPairGenerator.java:42)
        at crypt.RSAKeyPairGenerator.main(RSAKeyPairGenerator.java:96)
        at crypt.CryptData.createKey(CryptData.java:52)
        at crypt.CryptData.main(CryptData.java:38)
Caused by: java.lang.SecurityException: JCE cannot authenticate the provider BC
        at javax.crypto.Cipher.getInstance(DashoA13*..)
        ... 9 more

Thank you!
Yours sincerely,
Marc Schilling


-------------------------------------
Software Development
[hidden email]

SSC-Services GmbH
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: HOW CAN I ADD BOUNCY CASTLE AS A PROVIDER

psai

Yes, you can add the provider programmatically with the following line:

Security.addProvider(new BouncyCastleProvider());

Normally, you do this once during your application startup.

Hope this helps.

Sai Pullabhotla
Phone: (402) 408-5753
Fax: (402) 408-6861
www.jMethods.com




On Tue, Nov 25, 2008 at 8:38 AM,  <[hidden email]> wrote:

>
> Is there any other way ( than this:
> http://www.bouncycastle.org/wiki/display/JA1/Provider+Installation )
> to install bouncy castle as a java security provider?
>
> Because I can't  change the file $JAVA_HOME/jre/lib/security/java.security
> and if I install the Provider dynamically I get this Exception:
>
> Exception in thread "main" org.bouncycastle.openpgp.PGPException: Exception
> creating cipher
>         at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
>         at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
>         at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
>         at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
>         at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
>         at
> crypt.RSAKeyPairGenerator.exportKeyPair(RSAKeyPairGenerator.java:42)
>         at crypt.RSAKeyPairGenerator.main(RSAKeyPairGenerator.java:96)
>         at crypt.CryptData.createKey(CryptData.java:52)
>         at crypt.CryptData.main(CryptData.java:38)
> Caused by: java.lang.SecurityException: JCE cannot authenticate the provider
> BC
>         at javax.crypto.Cipher.getInstance(DashoA13*..)
>         ... 9 more
>
> Thank you!
> Yours sincerely,
> Marc Schilling
>
>
> -------------------------------------
> Software Development
> [hidden email]
>
> SSC-Services GmbH

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Re: HOW CAN I ADD BOUNCY CASTLE AS A PROVIDER

psai
Can you make sure you are using the same version of Java when running
it from Eclipse and Command line?

Sai Pullabhotla
Phone: (402) 408-5753
Fax: (402) 408-6861
www.jMethods.com




On Tue, Nov 25, 2008 at 8:51 AM,  <[hidden email]> wrote:

>
> Hi, Thank you!
> Yes I have done this,
> I use Eclipse and there it works.
>
> But if I start this now from windows cmd, I get the Exception:
>
> Exception in thread "main" org.bouncycastle.openpgp.PGPException: Exception
> creating cipher
>         at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
>         at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
>         at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
>         at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
>         at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
>         at
> crypt.RSAKeyPairGenerator.exportKeyPair(RSAKeyPairGenerator.java:42)
>         at crypt.RSAKeyPairGenerator.main(RSAKeyPairGenerator.java:96)
>         at crypt.CryptData.createKey(CryptData.java:51)
>         at crypt.CryptData.main(CryptData.java:37)
> Caused by: java.lang.SecurityException: JCE cannot authenticate the provider
> BC
>         at javax.crypto.Cipher.getInstance(DashoA13*..)
>         ... 9 more
> Caused by: java.util.jar.JarException: Cannot parse
> file:/C:/Dokumente%20und%20Einstellungen/mschilling/Desktop/CryptData.jar
>         at javax.crypto.SunJCE_c.a(DashoA13*..)
>         at javax.crypto.SunJCE_b.b(DashoA13*..)
>         at javax.crypto.SunJCE_b.a(DashoA13*..)
>         ... 10 more
>
> Marc Schilling
> -------------------------------------
> Software Development
>
> phone +49-711-782608
> [hidden email]
> http://www.ssc-services.de
>
> SSC-Services GmbH
> Gewerbestr. 42
> 70565 Stuttgart
>
> Geschäftsführer/Managing Directors: Karl Strecker, Matthias Stroezel
> Sitz und Registergericht/Domicile and Court of Registry: Stuttgart
> HRB-Nr./ Commercial Register No. 21439
>
>
> Von: "Sai Pullabhotla" <[hidden email]>
> An: [hidden email]
> Datum: 25.11.2008 15:45
> Betreff: Re: [dev-crypto] HOW CAN I ADD BOUNCY CASTLE AS A PROVIDER
> ________________________________
>
>
> Yes, you can add the provider programmatically with the following line:
>
> Security.addProvider(new BouncyCastleProvider());
>
> Normally, you do this once during your application startup.
>
> Hope this helps.
>
> Sai Pullabhotla
> Phone: (402) 408-5753
> Fax: (402) 408-6861
> www.jMethods.com
>
>
>
>
> On Tue, Nov 25, 2008 at 8:38 AM,  <[hidden email]> wrote:
>>
>> Is there any other way ( than this:
>> http://www.bouncycastle.org/wiki/display/JA1/Provider+Installation )
>> to install bouncy castle as a java security provider?
>>
>> Because I can't  change the file $JAVA_HOME/jre/lib/security/java.security
>> and if I install the Provider dynamically I get this Exception:
>>
>> Exception in thread "main" org.bouncycastle.openpgp.PGPException:
>> Exception
>> creating cipher
>>         at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
>>         at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
>>         at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
>>         at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
>>         at org.bouncycastle.openpgp.PGPSecretKey.<init>(Unknown Source)
>>         at
>> crypt.RSAKeyPairGenerator.exportKeyPair(RSAKeyPairGenerator.java:42)
>>         at crypt.RSAKeyPairGenerator.main(RSAKeyPairGenerator.java:96)
>>         at crypt.CryptData.createKey(CryptData.java:52)
>>         at crypt.CryptData.main(CryptData.java:38)
>> Caused by: java.lang.SecurityException: JCE cannot authenticate the
>> provider
>> BC
>>         at javax.crypto.Cipher.getInstance(DashoA13*..)
>>         ... 9 more
>>
>> Thank you!
>> Yours sincerely,
>> Marc Schilling
>>
>>
>> -------------------------------------
>> Software Development
>> [hidden email]
>>
>> SSC-Services GmbH
>
>
>
>

Loading...