Installing BC provider

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

Installing BC provider

Chamila Wijayarathna
Hi all,

I am trying to learn basics of bouncycastle and came up with some issues. I hope someone from here can help me out.

I am running on Java 9 and tried to execute a program with following line.

Security.getProvider("BC");
However, this returns null. As a solution I tried following line.

Security.addProvider(new BouncyCastleProvider());
But it gives me an error saying, 
java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider
I have added "bcprov-jdk15on-156" jar file to my idea project with scope:provided. Furthermore I have set  crypto.policy to unlimited.

I tried to add provider statically also by adding "security.provider.14=org.bouncycastle.jce.provider.BouncyCastleProvider" to java.security file in both jdk-9.0.4/conf/security folder and  jdk-9.0.4/conf/security folder. But i am still receiving same error with no provider installing.

What am I missing here? Can someone please help me out?

Regards,
--
Chamila Dilshan Wijayarathna,
PhD Research Student
The University of New South Wales (UNSW Canberra)
PO Box 7916, Canberra BA ACT 2610
Australia
Mobile:(+61)416895795

Reply | Threaded
Open this post in threaded view
|

Re: Installing BC provider

Chamila Wijayarathna
Hi,

I actually did this also. But I'm bit confused here. I have 3 folders inside my JAVA_HOME. 

Inline image 1

jre1.8.0_161 folder has a lib/ext folder. I copied jar file there. But jre-9.0.4 doesn't. But I think that is the JRE I am using. Do you know where should I copy it there?

Regards,
Chamila

On Wed, Feb 28, 2018 at 11:55 PM, ODonnell, Laura <[hidden email]> wrote:

Put the bouncy castle jar in <JDK_HOME>/jre/lib/ext folder if it’s not there already.

 

From: Chamila Wijayarathna [mailto:[hidden email]]
Sent: Wednesday, February 28, 2018 6:35 AM
To: [hidden email]
Subject: [dev-crypto] Installing BC provider

 

Hi all,

 

I am trying to learn basics of bouncycastle and came up with some issues. I hope someone from here can help me out.

 

I am running on Java 9 and tried to execute a program with following line.

 

Security.getProvider("BC");

However, this returns null. As a solution I tried following line.

 

Security.addProvider(new BouncyCastleProvider());

But it gives me an error saying, 

java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider

I have added "bcprov-jdk15on-156" jar file to my idea project with scope:provided. Furthermore I have set  crypto.policy to unlimited.

 

I tried to add provider statically also by adding "security.provider.14=org.bouncycastle.jce.provider.BouncyCastleProvider" to java.security file in both jdk-9.0.4/conf/security folder and  jdk-9.0.4/conf/security folder. But i am still receiving same error with no provider installing.

 

What am I missing here? Can someone please help me out?

 

Regards,

--

Chamila Dilshan Wijayarathna,

PhD Research Student

The University of New South Wales (UNSW Canberra)

PO Box 7916, Canberra BA ACT 2610

Australia

Mobile:<a href="tel:+61%20416%20895%20795" value="+61416895795" target="_blank">(+61)416895795

 




--
Chamila Dilshan Wijayarathna,
PhD Research Student
The University of New South Wales (UNSW Canberra)
Australian Centre for Cyber Security
Australian Defence Force Academy
PO Box 7916, Canberra BA ACT 2610
Australia
Mobile:(+61)416895795

Reply | Threaded
Open this post in threaded view
|

Re: Installing BC provider

Chamila Wijayarathna
sunjce_provider is only there in jre1.8.0_161/lib/ext folder and I have put bc jar to that folder. But still I am getting the same error.

On Thu, Mar 1, 2018 at 12:02 AM, ODonnell, Laura <[hidden email]> wrote:

Are you sure you’re not running from the jdk?  I haven’t installed java 9 so don’t know if/how the structure changed.  But if you don’t have jdk-9.0.4/jre/lib/ext, then I’d probably search for sunjce_provider.jar and put your BC jar wherever that is.

 

From: Chamila Wijayarathna [mailto:[hidden email]]
Sent: Wednesday, February 28, 2018 7:59 AM
To: ODonnell, Laura <[hidden email]>
Cc: [hidden email]
Subject: Re: [dev-crypto] Installing BC provider

 

Hi,

 

I actually did this also. But I'm bit confused here. I have 3 folders inside my JAVA_HOME. 

 

Inline image 1

 

jre1.8.0_161 folder has a lib/ext folder. I copied jar file there. But jre-9.0.4 doesn't. But I think that is the JRE I am using. Do you know where should I copy it there?

 

Regards,

Chamila

 

On Wed, Feb 28, 2018 at 11:55 PM, ODonnell, Laura <[hidden email]> wrote:

Put the bouncy castle jar in <JDK_HOME>/jre/lib/ext folder if it’s not there already.

 

From: Chamila Wijayarathna [mailto:[hidden email]]
Sent: Wednesday, February 28, 2018 6:35 AM
To: [hidden email]
Subject: [dev-crypto] Installing BC provider

 

Hi all,

 

I am trying to learn basics of bouncycastle and came up with some issues. I hope someone from here can help me out.

 

I am running on Java 9 and tried to execute a program with following line.

 

Security.getProvider("BC");

However, this returns null. As a solution I tried following line.

 

Security.addProvider(new BouncyCastleProvider());

But it gives me an error saying, 

java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider

I have added "bcprov-jdk15on-156" jar file to my idea project with scope:provided. Furthermore I have set  crypto.policy to unlimited.

 

I tried to add provider statically also by adding "security.provider.14=org.bouncycastle.jce.provider.BouncyCastleProvider" to java.security file in both jdk-9.0.4/conf/security folder and  jdk-9.0.4/conf/security folder. But i am still receiving same error with no provider installing.

 

What am I missing here? Can someone please help me out?

 

Regards,

--

Chamila Dilshan Wijayarathna,

PhD Research Student

The University of New South Wales (UNSW Canberra)

PO Box 7916, Canberra BA ACT 2610

Australia

Mobile:<a href="tel:+61%20416%20895%20795" target="_blank">(+61)416895795

 



 

--

Chamila Dilshan Wijayarathna,

PhD Research Student

The University of New South Wales (UNSW Canberra)

Australian Centre for Cyber Security

Australian Defence Force Academy

PO Box 7916, Canberra BA ACT 2610

Australia

Mobile:<a href="tel:+61%20416%20895%20795" value="+61416895795" target="_blank">(+61)416895795

 




--
Chamila Dilshan Wijayarathna,
PhD Research Student
The University of New South Wales (UNSW Canberra)
Australian Centre for Cyber Security
Australian Defence Force Academy
PO Box 7916, Canberra BA ACT 2610
Australia
Mobile:(+61)416895795

Reply | Threaded
Open this post in threaded view
|

Re: Installing BC provider

Chamila Wijayarathna
Thanks, I will read on that. By the way, do you have any idea about why it is not working when adding provider from java code dynamically? Is that also due to the same reason?

On Thu, Mar 1, 2018 at 12:11 AM, ODonnell, Laura <[hidden email]> wrote:

Quick lookup on java 9.  They’ve removed the extension mechanism and added modules.  You’ll have to create a module for you jar.  I’d read up on what the new way to do it is. 

 

From: Chamila Wijayarathna [mailto:[hidden email]]
Sent: Wednesday, February 28, 2018 8:05 AM


To: ODonnell, Laura <[hidden email]>
Cc: [hidden email]
Subject: Re: [dev-crypto] Installing BC provider

 

sunjce_provider is only there in jre1.8.0_161/lib/ext folder and I have put bc jar to that folder. But still I am getting the same error.

 

On Thu, Mar 1, 2018 at 12:02 AM, ODonnell, Laura <[hidden email]> wrote:

Are you sure you’re not running from the jdk?  I haven’t installed java 9 so don’t know if/how the structure changed.  But if you don’t have jdk-9.0.4/jre/lib/ext, then I’d probably search for sunjce_provider.jar and put your BC jar wherever that is.

 

From: Chamila Wijayarathna [mailto:[hidden email]]
Sent: Wednesday, February 28, 2018 7:59 AM
To: ODonnell, Laura <[hidden email]>
Cc: [hidden email]
Subject: Re: [dev-crypto] Installing BC provider

 

Hi,

 

I actually did this also. But I'm bit confused here. I have 3 folders inside my JAVA_HOME. 

 

Inline image 1

 

jre1.8.0_161 folder has a lib/ext folder. I copied jar file there. But jre-9.0.4 doesn't. But I think that is the JRE I am using. Do you know where should I copy it there?

 

Regards,

Chamila

 

On Wed, Feb 28, 2018 at 11:55 PM, ODonnell, Laura <[hidden email]> wrote:

Put the bouncy castle jar in <JDK_HOME>/jre/lib/ext folder if it’s not there already.

 

From: Chamila Wijayarathna [mailto:[hidden email]]
Sent: Wednesday, February 28, 2018 6:35 AM
To: [hidden email]
Subject: [dev-crypto] Installing BC provider

 

Hi all,

 

I am trying to learn basics of bouncycastle and came up with some issues. I hope someone from here can help me out.

 

I am running on Java 9 and tried to execute a program with following line.

 

Security.getProvider("BC");

However, this returns null. As a solution I tried following line.

 

Security.addProvider(new BouncyCastleProvider());

But it gives me an error saying, 

java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider

I have added "bcprov-jdk15on-156" jar file to my idea project with scope:provided. Furthermore I have set  crypto.policy to unlimited.

 

I tried to add provider statically also by adding "security.provider.14=org.bouncycastle.jce.provider.BouncyCastleProvider" to java.security file in both jdk-9.0.4/conf/security folder and  jdk-9.0.4/conf/security folder. But i am still receiving same error with no provider installing.

 

What am I missing here? Can someone please help me out?

 

Regards,

--

Chamila Dilshan Wijayarathna,

PhD Research Student

The University of New South Wales (UNSW Canberra)

PO Box 7916, Canberra BA ACT 2610

Australia

Mobile:<a href="tel:+61%20416%20895%20795" target="_blank">(+61)416895795

 



 

--

Chamila Dilshan Wijayarathna,

PhD Research Student

The University of New South Wales (UNSW Canberra)

Australian Centre for Cyber Security

Australian Defence Force Academy

PO Box 7916, Canberra BA ACT 2610

Australia

Mobile:<a href="tel:+61%20416%20895%20795" target="_blank">(+61)416895795

 



 

--

Chamila Dilshan Wijayarathna,

PhD Research Student

The University of New South Wales (UNSW Canberra)

Australian Centre for Cyber Security

Australian Defence Force Academy

PO Box 7916, Canberra BA ACT 2610

Australia

Mobile:<a href="tel:+61%20416%20895%20795" value="+61416895795" target="_blank">(+61)416895795

 




--
Chamila Dilshan Wijayarathna,
PhD Research Student
The University of New South Wales (UNSW Canberra)
Australian Centre for Cyber Security
Australian Defence Force Academy
PO Box 7916, Canberra BA ACT 2610
Australia
Mobile:(+61)416895795

Reply | Threaded
Open this post in threaded view
|

Re: Installing BC provider

Uri Blumenthal
It would be great if some kind soul would post her an example of how to load BC provider in Java 9. I read most of what's available on Java 9 at the Oracle site, and still couldn't get this to work.

I personally think that Java 9 is a design screw-up, but that doesn't change the fact that Java 9 is the future. 

Sent from my test iPhone

On Feb 28, 2018, at 08:20, Chamila Wijayarathna <[hidden email]> wrote:

Thanks, I will read on that. By the way, do you have any idea about why it is not working when adding provider from java code dynamically? Is that also due to the same reason?

On Thu, Mar 1, 2018 at 12:11 AM, ODonnell, Laura <[hidden email]> wrote:

Quick lookup on java 9.  They’ve removed the extension mechanism and added modules.  You’ll have to create a module for you jar.  I’d read up on what the new way to do it is. 

 

From: Chamila Wijayarathna [mailto:[hidden email]]
Sent: Wednesday, February 28, 2018 8:05 AM


To: ODonnell, Laura <[hidden email]>
Cc: [hidden email]
Subject: Re: [dev-crypto] Installing BC provider

 

sunjce_provider is only there in jre1.8.0_161/lib/ext folder and I have put bc jar to that folder. But still I am getting the same error.

 

On Thu, Mar 1, 2018 at 12:02 AM, ODonnell, Laura <[hidden email]> wrote:

Are you sure you’re not running from the jdk?  I haven’t installed java 9 so don’t know if/how the structure changed.  But if you don’t have jdk-9.0.4/jre/lib/ext, then I’d probably search for sunjce_provider.jar and put your BC jar wherever that is.

 

From: Chamila Wijayarathna [mailto:[hidden email]]
Sent: Wednesday, February 28, 2018 7:59 AM
To: ODonnell, Laura <[hidden email]>
Cc: [hidden email]
Subject: Re: [dev-crypto] Installing BC provider

 

Hi,

 

I actually did this also. But I'm bit confused here. I have 3 folders inside my JAVA_HOME. 

 

<image001.png>

 

jre1.8.0_161 folder has a lib/ext folder. I copied jar file there. But jre-9.0.4 doesn't. But I think that is the JRE I am using. Do you know where should I copy it there?

 

Regards,

Chamila

 

On Wed, Feb 28, 2018 at 11:55 PM, ODonnell, Laura <[hidden email]> wrote:

Put the bouncy castle jar in <JDK_HOME>/jre/lib/ext folder if it’s not there already.

 

From: Chamila Wijayarathna [mailto:[hidden email]]
Sent: Wednesday, February 28, 2018 6:35 AM
To: [hidden email]
Subject: [dev-crypto] Installing BC provider

 

Hi all,

 

I am trying to learn basics of bouncycastle and came up with some issues. I hope someone from here can help me out.

 

I am running on Java 9 and tried to execute a program with following line.

 

Security.getProvider("BC");

However, this returns null. As a solution I tried following line.

 

Security.addProvider(new BouncyCastleProvider());

But it gives me an error saying, 

java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider

I have added "bcprov-jdk15on-156" jar file to my idea project with scope:provided. Furthermore I have set  crypto.policy to unlimited.

 

I tried to add provider statically also by adding "security.provider.14=org.bouncycastle.jce.provider.BouncyCastleProvider" to java.security file in both jdk-9.0.4/conf/security folder and  jdk-9.0.4/conf/security folder. But i am still receiving same error with no provider installing.

 

What am I missing here? Can someone please help me out?

 

Regards,

--

Chamila Dilshan Wijayarathna,

PhD Research Student

The University of New South Wales (UNSW Canberra)

PO Box 7916, Canberra BA ACT 2610

Australia

Mobile:<a href="tel:+61%20416%20895%20795" target="_blank">(+61)416895795

 



 

--

Chamila Dilshan Wijayarathna,

PhD Research Student

The University of New South Wales (UNSW Canberra)

Australian Centre for Cyber Security

Australian Defence Force Academy

PO Box 7916, Canberra BA ACT 2610

Australia

Mobile:<a href="tel:+61%20416%20895%20795" target="_blank">(+61)416895795

 



 

--

Chamila Dilshan Wijayarathna,

PhD Research Student

The University of New South Wales (UNSW Canberra)

Australian Centre for Cyber Security

Australian Defence Force Academy

PO Box 7916, Canberra BA ACT 2610

Australia

Mobile:<a href="tel:+61%20416%20895%20795" value="+61416895795" target="_blank">(+61)416895795

 




--
Chamila Dilshan Wijayarathna,
PhD Research Student
The University of New South Wales (UNSW Canberra)
Australian Centre for Cyber Security
Australian Defence Force Academy
PO Box 7916, Canberra BA ACT 2610
Australia
Mobile:(+61)416895795


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Installing BC provider

Chamila Wijayarathna
It looks like things are bit complicated in Java 9, I tried with changing to JDK8 and got it to work there. So I can go ahead with Java 8 for now.

Thanks for helping.

I would suggest to add some details about installing providers for Java 9 into docs. I will update the thread if I could get it to work,

Cheers,
Chamila

On Thu, Mar 1, 2018 at 12:28 AM, Uri Blumenthal <[hidden email]> wrote:
It would be great if some kind soul would post her an example of how to load BC provider in Java 9. I read most of what's available on Java 9 at the Oracle site, and still couldn't get this to work.

I personally think that Java 9 is a design screw-up, but that doesn't change the fact that Java 9 is the future. 

Sent from my test iPhone

On Feb 28, 2018, at 08:20, Chamila Wijayarathna <[hidden email]> wrote:

Thanks, I will read on that. By the way, do you have any idea about why it is not working when adding provider from java code dynamically? Is that also due to the same reason?

On Thu, Mar 1, 2018 at 12:11 AM, ODonnell, Laura <[hidden email]> wrote:

Quick lookup on java 9.  They’ve removed the extension mechanism and added modules.  You’ll have to create a module for you jar.  I’d read up on what the new way to do it is. 

 

From: Chamila Wijayarathna [mailto:[hidden email]]
Sent: Wednesday, February 28, 2018 8:05 AM


To: ODonnell, Laura <[hidden email]>
Cc: [hidden email]
Subject: Re: [dev-crypto] Installing BC provider

 

sunjce_provider is only there in jre1.8.0_161/lib/ext folder and I have put bc jar to that folder. But still I am getting the same error.

 

On Thu, Mar 1, 2018 at 12:02 AM, ODonnell, Laura <[hidden email]> wrote:

Are you sure you’re not running from the jdk?  I haven’t installed java 9 so don’t know if/how the structure changed.  But if you don’t have jdk-9.0.4/jre/lib/ext, then I’d probably search for sunjce_provider.jar and put your BC jar wherever that is.

 

From: Chamila Wijayarathna [mailto:[hidden email]]
Sent: Wednesday, February 28, 2018 7:59 AM
To: ODonnell, Laura <[hidden email]>
Cc: [hidden email]
Subject: Re: [dev-crypto] Installing BC provider

 

Hi,

 

I actually did this also. But I'm bit confused here. I have 3 folders inside my JAVA_HOME. 

 

<image001.png>

 

jre1.8.0_161 folder has a lib/ext folder. I copied jar file there. But jre-9.0.4 doesn't. But I think that is the JRE I am using. Do you know where should I copy it there?

 

Regards,

Chamila

 

On Wed, Feb 28, 2018 at 11:55 PM, ODonnell, Laura <[hidden email]> wrote:

Put the bouncy castle jar in <JDK_HOME>/jre/lib/ext folder if it’s not there already.

 

From: Chamila Wijayarathna [mailto:[hidden email]]
Sent: Wednesday, February 28, 2018 6:35 AM
To: [hidden email]
Subject: [dev-crypto] Installing BC provider

 

Hi all,

 

I am trying to learn basics of bouncycastle and came up with some issues. I hope someone from here can help me out.

 

I am running on Java 9 and tried to execute a program with following line.

 

Security.getProvider("BC");

However, this returns null. As a solution I tried following line.

 

Security.addProvider(new BouncyCastleProvider());

But it gives me an error saying, 

java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider

I have added "bcprov-jdk15on-156" jar file to my idea project with scope:provided. Furthermore I have set  crypto.policy to unlimited.

 

I tried to add provider statically also by adding "security.provider.14=org.bouncycastle.jce.provider.BouncyCastleProvider" to java.security file in both jdk-9.0.4/conf/security folder and  jdk-9.0.4/conf/security folder. But i am still receiving same error with no provider installing.

 

What am I missing here? Can someone please help me out?

 

Regards,

--

Chamila Dilshan Wijayarathna,

PhD Research Student

The University of New South Wales (UNSW Canberra)

PO Box 7916, Canberra BA ACT 2610

Australia

Mobile:<a href="tel:+61%20416%20895%20795" target="_blank">(+61)416895795

 



 

--

Chamila Dilshan Wijayarathna,

PhD Research Student

The University of New South Wales (UNSW Canberra)

Australian Centre for Cyber Security

Australian Defence Force Academy

PO Box 7916, Canberra BA ACT 2610

Australia

Mobile:<a href="tel:+61%20416%20895%20795" target="_blank">(+61)416895795

 



 

--

Chamila Dilshan Wijayarathna,

PhD Research Student

The University of New South Wales (UNSW Canberra)

Australian Centre for Cyber Security

Australian Defence Force Academy

PO Box 7916, Canberra BA ACT 2610

Australia

Mobile:<a href="tel:+61%20416%20895%20795" value="+61416895795" target="_blank">(+61)416895795

 




--
Chamila Dilshan Wijayarathna,
PhD Research Student
The University of New South Wales (UNSW Canberra)
Australian Centre for Cyber Security
Australian Defence Force Academy
PO Box 7916, Canberra BA ACT 2610
Australia
Mobile:<a href="tel:+61%20416%20895%20795" value="+61416895795" target="_blank">(+61)416895795




--
Chamila Dilshan Wijayarathna,
PhD Research Student
The University of New South Wales (UNSW Canberra)
Australian Centre for Cyber Security
Australian Defence Force Academy
PO Box 7916, Canberra BA ACT 2610
Australia
Mobile:(+61)416895795

Reply | Threaded
Open this post in threaded view
|

Re: Installing BC provider

Uri Blumenthal
On Feb 28, 2018, at 9:07 , ODonnell, Laura <[hidden email]> wrote:
I don’t work for bouncy castle. 

I don’t think BouncyCastle offers paying jobs, anyway.

I just am using bcfips provider for my application so am familiar with setup from that perspective so shared what I knew.

The question was about Java 9, and you shared Java 8 solution (which is the same as for Java 7, 6, 5, etc.). The problem with that is - Java 9 radically changed things, the old solution doesn’t work any more, and we are trying to figure how to address it. Unfortunately, your answer did not help.

This is open source, so you tend to have to figure things out for yourself. 


They don’t have time or money to provide documentation for everything. That’s the nature of the beast. 

The nature of the beast is such that Dave is doing his best to document as much as he can. Other participants on this list are doing their best to fill the gaps. Because it’s silly to expect that everybody would be able to find all the answers on her own - that’s why this list exists, and that’s the true nature of the beast.



From: Chamila Wijayarathna [[hidden email]] 
Sent: Wednesday, February 28, 2018 8:39 AM
To: Uri Blumenthal <[hidden email]>
Cc: [hidden email]; ODonnell, Laura <[hidden email]>
Subject: Re: [dev-crypto] Installing BC provider
 
It looks like things are bit complicated in Java 9, I tried with changing to JDK8 and got it to work there. So I can go ahead with Java 8 for now.
 
Thanks for helping.
 
I would suggest to add some details about installing providers for Java 9 into docs. I will update the thread if I could get it to work,
 
Cheers,
Chamila
 
On Thu, Mar 1, 2018 at 12:28 AM, Uri Blumenthal <[hidden email]> wrote:
It would be great if some kind soul would post her an example of how to load BC provider in Java 9. I read most of what's available on Java 9 at the Oracle site, and still couldn't get this to work.
 

I personally think that Java 9 is a design screw-up, but that doesn't change the fact that Java 9 is the future. 

Sent from my test iPhone


On Feb 28, 2018, at 08:20, Chamila Wijayarathna <[hidden email]> wrote:

Thanks, I will read on that. By the way, do you have any idea about why it is not working when adding provider from java code dynamically? Is that also due to the same reason?
 
On Thu, Mar 1, 2018 at 12:11 AM, ODonnell, Laura <[hidden email]> wrote:
Quick lookup on java 9.  They’ve removed the extension mechanism and added modules.  You’ll have to create a module for you jar.  I’d read up on what the new way to do it is.  
 
From: Chamila Wijayarathna [mailto:[hidden email]] 
Sent: Wednesday, February 28, 2018 8:05 AM

To: ODonnell, Laura <[hidden email]>
Cc: [hidden email]
Subject: Re: [dev-crypto] Installing BC provider
 
sunjce_provider is only there in jre1.8.0_161/lib/ext folder and I have put bc jar to that folder. But still I am getting the same error.
 
On Thu, Mar 1, 2018 at 12:02 AM, ODonnell, Laura <[hidden email]> wrote:
Are you sure you’re not running from the jdk?  I haven’t installed java 9 so don’t know if/how the structure changed.  But if you don’t have jdk-9.0.4/jre/lib/ext, then I’d probably search for sunjce_provider.jar and put your BC jar wherever that is.
 
From: Chamila Wijayarathna [mailto:[hidden email]] 
Sent: Wednesday, February 28, 2018 7:59 AM
To: ODonnell, Laura <[hidden email]>
Cc: [hidden email]
Subject: Re: [dev-crypto] Installing BC provider
 
Hi,
 
I actually did this also. But I'm bit confused here. I have 3 folders inside my JAVA_HOME. 
 
<image001.png>
 
jre1.8.0_161 folder has a lib/ext folder. I copied jar file there. But jre-9.0.4 doesn't. But I think that is the JRE I am using. Do you know where should I copy it there?
 
Regards,
Chamila
 
On Wed, Feb 28, 2018 at 11:55 PM, ODonnell, Laura <[hidden email]> wrote:
Put the bouncy castle jar in <JDK_HOME>/jre/lib/ext folder if it’s not there already.
 
From: Chamila Wijayarathna [mailto:[hidden email]] 
Sent: Wednesday, February 28, 2018 6:35 AM
To: [hidden email]
Subject: [dev-crypto] Installing BC provider
 
Hi all,
 
I am trying to learn basics of bouncycastle and came up with some issues. I hope someone from here can help me out.
 
I am running on Java 9 and tried to execute a program with following line.
 
Security.getProvider("BC");
However, this returns null. As a solution I tried following line.
 
Security.addProvider(new BouncyCastleProvider());
But it gives me an error saying, 
java.lang.NoClassDefFoundError: org/bouncycastle/jce/provider/BouncyCastleProvider
I have added "bcprov-jdk15on-156" jar file to my idea project with scope:provided. Furthermore I have set  crypto.policy to unlimited.
 
I tried to add provider statically also by adding "security.provider.14=org.bouncycastle.jce.provider.BouncyCastleProvider" to java.security file in both jdk-9.0.4/conf/security folder and  jdk-9.0.4/conf/security folder. But i am still receiving same error with no provider installing.
 
What am I missing here? Can someone please help me out?
 
Regards,
--
Chamila Dilshan Wijayarathna,
PhD Research Student
The University of New South Wales (UNSW Canberra)
PO Box 7916, Canberra BA ACT 2610
Australia
Mobile:<a href="tel:+61%20416%20895%20795" target="_blank" style="color: purple; text-decoration: underline;" class="">(+61)416895795
 


 
--
Chamila Dilshan Wijayarathna,
PhD Research Student
The University of New South Wales (UNSW Canberra)
Australian Centre for Cyber Security
Australian Defence Force Academy
PO Box 7916, Canberra BA ACT 2610
Australia
Mobile:<a href="tel:+61%20416%20895%20795" target="_blank" style="color: purple; text-decoration: underline;" class="">(+61)416895795
 


 
--
Chamila Dilshan Wijayarathna,
PhD Research Student
The University of New South Wales (UNSW Canberra)
Australian Centre for Cyber Security
Australian Defence Force Academy
PO Box 7916, Canberra BA ACT 2610
Australia
Mobile:<a href="tel:+61%20416%20895%20795" target="_blank" style="color: purple; text-decoration: underline;" class="">(+61)416895795
 


 
-- 
Chamila Dilshan Wijayarathna,
PhD Research Student
The University of New South Wales (UNSW Canberra)
Australian Centre for Cyber Security
Australian Defence Force Academy
PO Box 7916, Canberra BA ACT 2610
Australia
Mobile:<a href="tel:+61%20416%20895%20795" target="_blank" style="color: purple; text-decoration: underline;" class="">(+61)416895795
 


 
-- 
Chamila Dilshan Wijayarathna,
PhD Research Student
The University of New South Wales (UNSW Canberra)
Australian Centre for Cyber Security
Australian Defence Force Academy
PO Box 7916, Canberra BA ACT 2610
Australia
Mobile:(+61)416895795


smime.p7s (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Installing BC provider

Eckenfels. Bernd
In reply to this post by Uri Blumenthal

You use BC in Java9 exactly as you would use it in Java 8, put it on the classpath:

 

http://www.bouncycastle.org/wiki/display/JA1/Provider+Installation

 

Example:

 

C: >type temp\Main.java

package temp;

 

public class Main {

        public static void main(String... arg) {

                java.security.Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());

                java.security.Provider p = java.security.Security.getProvider("BC");

                System.out.println("hello provider: " + p);

        }

}

 

C:>”\Program Files\Java\jdk1.8.0_152\bin\java” -cp .; bcprov-jdk15on-1.59.jar temp.Main

hello provider: BC version 1.59

 

C:>”\Program Files\Java\jre-9.0.4\bin\java” -cp .; bcprov-jdk15on-1.59.jar temp.Main

hello provider: BC version 1.59

 

Gruss

Bernd

 






     


SEEBURGER AG   Vorstand/SEEBURGER Executive Board:
Sitz der Gesellschaft/Registered Office:   Axel Haas, Michael Kleeberg, Friedemann Heinz, Dr. Martin Kuntz, Matthias Feßenbecker
Edisonstr. 1  
D-75015 Bretten Vorsitzende des Aufsichtsrats/Chairperson of the SEEBURGER Supervisory Board:
Tel.: 07252 / 96 - 0 Prof. Dr. Simone Zeuchner
Fax: 07252 / 96 - 2222
Internet: http://www.seeburger.de Registergericht/Commercial Register:
e-mail: [hidden email] HRB 240708 Mannheim


Dieses E-Mail ist nur für den Empfänger bestimmt, an den es gerichtet ist und kann vertrauliches bzw. unter das Berufsgeheimnis fallendes Material enthalten. Jegliche darin enthaltene Ansicht oder Meinungsäußerung ist die des Autors und stellt nicht notwendigerweise die Ansicht oder Meinung der SEEBURGER AG dar. Sind Sie nicht der Empfänger, so haben Sie diese E-Mail irrtümlich erhalten und jegliche Verwendung, Veröffentlichung, Weiterleitung, Abschrift oder jeglicher Druck dieser E-Mail ist strengstens untersagt. Weder die SEEBURGER AG noch der Absender (Eckenfels. Bernd) übernehmen die Haftung für Viren; es obliegt Ihrer Verantwortung, die E-Mail und deren Anhänge auf Viren zu prüfen.

This email is intended only for the recipient(s) to whom it is addressed. This email may contain confidential material that may be protected by professional secrecy. Any fact or opinion contained, or expression of the material herein, does not necessarily reflect that of SEEBURGER AG. If you are not the addressee or if you have received this email in error, any use, publication or distribution including forwarding, copying or printing is strictly prohibited. Neither SEEBURGER AG, nor the sender (Eckenfels. Bernd) accept liability for viruses; it is your responsibility to check this email and its attachments for viruses.

Reply | Threaded
Open this post in threaded view
|

Re: Installing BC provider

Uri Blumenthal
Bernd,

Thank you! I understand now how to add BC as a dynamic provider.

I have to explicitly include all the JARs I need in the CLASSPATH that I pass to my Java app?

Also, do you happen to know if it's possible to configure Java 9 to consider BC a static provider? In Java 8 we would add the provider definition to the lib/security/java.security file, as the Wiki page you referred to shows. I don't think it works any longer, or at the very least the provider definition format has changed. Would you know what that line should look like in Java 9?

Thanks!

Sent from my test iPhone

On Feb 28, 2018, at 11:07, Eckenfels. Bernd <[hidden email]> wrote:

You use BC in Java9 exactly as you would use it in Java 8, put it on the classpath:

 

http://www.bouncycastle.org/wiki/display/JA1/Provider+Installation

 

Example:

 

C: >type temp\Main.java

package temp;

 

public class Main {

        public static void main(String... arg) {

                java.security.Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());

                java.security.Provider p = java.security.Security.getProvider("BC");

                System.out.println("hello provider: " + p);

        }

}

 

C:>”\Program Files\Java\jdk1.8.0_152\bin\java” -cp .; bcprov-jdk15on-1.59.jar temp.Main

hello provider: BC version 1.59

 

C:>”\Program Files\Java\jre-9.0.4\bin\java” -cp .; bcprov-jdk15on-1.59.jar temp.Main

hello provider: BC version 1.59

 

Gruss

Bernd

 






     


SEEBURGER AG   Vorstand/SEEBURGER Executive Board:
Sitz der Gesellschaft/Registered Office:   Axel Haas, Michael Kleeberg, Friedemann Heinz, Dr. Martin Kuntz, Matthias Feßenbecker
Edisonstr. 1  
D-75015 Bretten Vorsitzende des Aufsichtsrats/Chairperson of the SEEBURGER Supervisory Board:
Tel.: 07252 / 96 - 0 Prof. Dr. Simone Zeuchner
Fax: 07252 / 96 - 2222
Internet: http://www.seeburger.de Registergericht/Commercial Register:
e-mail: [hidden email] HRB 240708 Mannheim


Dieses E-Mail ist nur für den Empfänger bestimmt, an den es gerichtet ist und kann vertrauliches bzw. unter das Berufsgeheimnis fallendes Material enthalten. Jegliche darin enthaltene Ansicht oder Meinungsäußerung ist die des Autors und stellt nicht notwendigerweise die Ansicht oder Meinung der SEEBURGER AG dar. Sind Sie nicht der Empfänger, so haben Sie diese E-Mail irrtümlich erhalten und jegliche Verwendung, Veröffentlichung, Weiterleitung, Abschrift oder jeglicher Druck dieser E-Mail ist strengstens untersagt. Weder die SEEBURGER AG noch der Absender (Eckenfels. Bernd) übernehmen die Haftung für Viren; es obliegt Ihrer Verantwortung, die E-Mail und deren Anhänge auf Viren zu prüfen.

This email is intended only for the recipient(s) to whom it is addressed. This email may contain confidential material that may be protected by professional secrecy. Any fact or opinion contained, or expression of the material herein, does not necessarily reflect that of SEEBURGER AG. If you are not the addressee or if you have received this email in error, any use, publication or distribution including forwarding, copying or printing is strictly prohibited. Neither SEEBURGER AG, nor the sender (Eckenfels. Bernd) accept liability for viruses; it is your responsibility to check this email and its attachments for viruses.


smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

RE: Installing BC provider

Eckenfels. Bernd
I think registration is independent from extending module/classpath and the official way is to use service loader. But I am running a inquiry here: http://mail.openjdk.java.net/pipermail/security-dev/2018-February/016854.html

BC probably should add a module info (within a multi release JAR?) and provide a service loader declaration like documented here:
https://docs.oracle.com/javase/9/security/howtoimplaprovider.htm#JSSEC-GUID-B30F5AA2-6517-4107-9FFF-F6BBE57A7A5F

--
http://www.seeburger.com
________________________________________
From: Uri Blumenthal [[hidden email]]
Sent: Thursday, March 01, 2018 05:48
To: Eckenfels. Bernd
Cc: [hidden email]
Subject: Re: [dev-crypto] Installing BC provider

Bernd,

Thank you! I understand now how to add BC as a dynamic provider.

I have to explicitly include all the JARs I need in the CLASSPATH that I pass to my Java app?

Also, do you happen to know if it's possible to configure Java 9 to consider BC a static provider? In Java 8 we would add the provider definition to the lib/security/java.security file, as the Wiki page you referred to shows. I don't think it works any longer, or at the very least the provider definition format has changed. Would you know what that line should look like in Java 9?

Thanks!

Sent from my test iPhone

On Feb 28, 2018, at 11:07, Eckenfels. Bernd <[hidden email]<mailto:[hidden email]>> wrote:

You use BC in Java9 exactly as you would use it in Java 8, put it on the classpath:

http://www.bouncycastle.org/wiki/display/JA1/Provider+Installation

Example:

C: >type temp\Main.java
package temp;

public class Main {
        public static void main(String... arg) {
                java.security.Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
                java.security.Provider p = java.security.Security.getProvider("BC");
                System.out.println("hello provider: " + p);
        }
}

C:>”\Program Files\Java\jdk1.8.0_152\bin\java” -cp .; bcprov-jdk15on-1.59.jar temp.Main
hello provider: BC version 1.59

C:>”\Program Files\Java\jre-9.0.4\bin\java” -cp .; bcprov-jdk15on-1.59.jar temp.Main
hello provider: BC version 1.59

Gruss
Bernd









SEEBURGER AG            Vorstand/SEEBURGER Executive Board:
Sitz der Gesellschaft/Registered Office:                Axel Haas, Michael Kleeberg, Friedemann Heinz, Dr. Martin Kuntz, Matthias Feßenbecker
Edisonstr. 1
D-75015 Bretten         Vorsitzende des Aufsichtsrats/Chairperson of the SEEBURGER Supervisory Board:
Tel.: 07252 / 96 - 0            Prof. Dr. Simone Zeuchner
Fax: 07252 / 96 - 2222
Internet: http://www.seeburger.de               Registergericht/Commercial Register:
e-mail: [hidden email]<mailto:[hidden email]>             HRB 240708 Mannheim


Dieses E-Mail ist nur für den Empfänger bestimmt, an den es gerichtet ist und kann vertrauliches bzw. unter das Berufsgeheimnis fallendes Material enthalten. Jegliche darin enthaltene Ansicht oder Meinungsäußerung ist die des Autors und stellt nicht notwendigerweise die Ansicht oder Meinung der SEEBURGER AG dar. Sind Sie nicht der Empfänger, so haben Sie diese E-Mail irrtümlich erhalten und jegliche Verwendung, Veröffentlichung, Weiterleitung, Abschrift oder jeglicher Druck dieser E-Mail ist strengstens untersagt. Weder die SEEBURGER AG noch der Absender (Eckenfels. Bernd) übernehmen die Haftung für Viren; es obliegt Ihrer Verantwortung, die E-Mail und deren Anhänge auf Viren zu prüfen.


This email is intended only for the recipient(s) to whom it is addressed. This email may contain confidential material that may be protected by professional secrecy. Any fact or opinion contained, or expression of the material herein, does not necessarily reflect that of SEEBURGER AG. If you are not the addressee or if you have received this email in error, any use, publication or distribution including forwarding, copying or printing is strictly prohibited. Neither SEEBURGER AG, nor the sender (Eckenfels. Bernd) accept liability for viruses; it is your responsibility to check this email and its attachments for viruses.









SEEBURGER AG            Vorstand/SEEBURGER Executive Board:
Sitz der Gesellschaft/Registered Office:                Axel Haas, Michael Kleeberg, Friedemann Heinz, Dr. Martin Kuntz, Matthias Feßenbecker
Edisonstr. 1
D-75015 Bretten         Vorsitzende des Aufsichtsrats/Chairperson of the SEEBURGER Supervisory Board:
Tel.: 07252 / 96 - 0            Prof. Dr. Simone Zeuchner
Fax: 07252 / 96 - 2222
Internet: http://www.seeburger.de               Registergericht/Commercial Register:
e-mail: [hidden email]               HRB 240708 Mannheim


Dieses E-Mail ist nur für den Empfänger bestimmt, an den es gerichtet ist und kann vertrauliches bzw. unter das Berufsgeheimnis fallendes Material enthalten. Jegliche darin enthaltene Ansicht oder Meinungsäußerung ist die des Autors und stellt nicht notwendigerweise die Ansicht oder Meinung der SEEBURGER AG dar. Sind Sie nicht der Empfänger, so haben Sie diese E-Mail irrtümlich erhalten und jegliche Verwendung, Veröffentlichung, Weiterleitung, Abschrift oder jeglicher Druck dieser E-Mail ist strengstens untersagt. Weder die SEEBURGER AG noch der Absender (Eckenfels. Bernd) übernehmen die Haftung für Viren; es obliegt Ihrer Verantwortung, die E-Mail und deren Anhänge auf Viren zu prüfen.


This email is intended only for the recipient(s) to whom it is addressed. This email may contain confidential material that may be protected by professional secrecy. Any fact or opinion contained, or expression of the material herein, does not necessarily reflect that of SEEBURGER AG. If you are not the addressee or if you have received this email in error, any use, publication or distribution including forwarding, copying or printing is strictly prohibited. Neither SEEBURGER AG, nor the sender (Eckenfels. Bernd) accept liability for viruses; it is your responsibility to check this email and its attachments for viruses.