• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to solve exception java.lang.SecurityException: JCE cannot authenticate the provider BC

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I have developed an application in which I have used the Cryptography with the help of BountyCastle.jar.

I also had a line Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());

Everything works fine when I execute the program from Eclipse.

But when I made executable jar for my application which internally has BouncyCastle jar and execute the jar,

I am getting exception

JCE cannot authenticate the provider BC
java.lang.SecurityException: JCE cannot authenticate the provider BC
at javax.crypto.Cipher.getInstance(DashoA13*..)

Can anybody please guide me how can I solve this problem?

Thanks in Advance,
Jenish
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

But when I made executable jar for my application which internally has BouncyCastle jar


Does this mean that you un-jar'ed the BC jar, and then added the resulting classes to your jar file? If so, that will remove the digital signature that's present in the BC jar file. You need to keep that file intact.
 
Shah Jenish
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nope I did not un-jared anything..

I am using Eclipse IDE. I added BC jar in my class path of the Eclipse Project because my class uses BC jar classes.

Now when I create runnable jar in eclipse, it automatically un-jared BC jar and add classes in executable jar.

Can you please suggest a way to keep application and BC jar separate?

Thanks in Advance,
Jenish
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'd need to distribute the BC jar separately from your application jar. Not sure how that would be done in Eclipse, but I'm sure it can be set not to include the BC classes in the final application jar.
 
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You realize that cross-posting the same question in multiple forums is considered anti-social?
 
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please help, I am facing the same issue, I am using Maven 2.0 to build my application jar and I put the bouncy castle jars in my project dependencies, while making the final jar, the bouncy castle jars get extracted and they loose the signatures... (I assume this is what happens)

becaue I get the same error.... while decryption....

JCE cannot authenticate the provider BC
javax.crypto.Cipher.getInstance(DashoA12275),
org.bouncycastle.openpgp.PGPSecretKey.extractKeyData(Unknown Source), org.bouncycastle.openpgp.PGPSecretKey.extractPrivateKey(........

I use this code to see if BC gets installed and it does->



Output




Please help how do I pact the signed jar into my application jar without extracting the bouncy castle jars. : (
Thanks a lot in advance... !

 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why can't you just ship several jar files? That's how many (most?) applications work.
 
Robin John
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, will try that and one more question, if I change the name of the signed jar to a different name than which it is published in the website, will it affect the signature / authentication ?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

if I change the name of the signed jar to a different name than which it is published in the website, will it affect the signature / authentication ?


That's easy enough to test, but I don't think it will affect it - the signature is about the file contents, not its name.
 
Robin John
Ranch Hand
Posts: 281
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yup, everything's working fine if I ship the jars separately from my application jars and yes changing the name doesn't matter, thanks : ).
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I am having the same Problem.
I tried shipping jar externally but then i am getting NoClassDefFound Error for SunJCE_b class.
Can you please tell me how can i ship the jar successfully.

Thanks,
Tarun Khandelwal
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting this message when trying to install a program called pharos (  accounting prorgram) during installation
 
If I had asked people what they wanted, they would have said faster horses - Ford. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic