回复: Question: How to using cert files on Android platform?

2021-03-03 Thread Yang Rong
Hello Viktor,

Thanks for your reply. The reason that I am trying to use the OpenSSL instead 
of using a library like Volley on Android is:  The original environment of the 
project is in a private network. Our network provider shells all threats for 
us. So our app is installed on devices that are only required unsecured 
connections between devices and servers. Now we need some features from the 
original firmware for a new android app. The app users are going to use the 
internet. So the secured connections are required. If we can use OpenSSL to 
handle handshake and certificate verification the same code can be reused on 
firmware and potentially allowing our devices to use the internet in the future.

> Almost certainly, but your question is rather oddly phrased and notcompletely 
> clear.  PEM files don't establish connections.
Instead of using all certs in the trust store, I was trying to use as few cert 
files as possible. And you are right PEM files do not establish connections. I 
need cert file to verify the server's certs before establishing connections.

Currently, I know the URL of our web service. I created a client then I tried 
to copy some certs from the Ubuntu trust store. Found the cert `09789157.0` is 
able to verify our test servers' certs. Then, I copied the text from the file 
09789157.0, hard-coded the content of the file in the code, created an X509 
object based on the text, and using `X509_STORE_add_cert` to add the cert to a 
store in a SSL_CTX.  It works on Android. But I am thinking I might just do 
what you mentioned:
"If you just extract the certificates, without the
associated trust settings, you may well end up undermining some of the
expected security properties, because some restricted use certificates
may then lose their associated restrictions."

So, my question is what should I do to find out the "associated trust settings" 
and include those settings?


Thanks for your help

r0nG

Auckland, New Zealand


发件人: openssl-users  代表 Viktor Dukhovni 

发送时间: 2021年3月3日 5:34
收件人: openssl-users@openssl.org 
主题: Re: Question: How to using cert files on Android platform?

On Wed, Mar 03, 2021 at 01:56:31AM +, Yang Rong wrote:

> I am new to OpenSSL. I am working on a project using JNI+ OpenSSL on
> an Android App.

Can you briefly explain your motivation for using OpenSSL via JNI,
rather than just use the native android TLS APIs, which then just use
the Android trust store?

> The OpenSSL is not able to use certs in the Android trust store.

The Android trust store is likely more fine-grained than you'd naively
expect.  Not all the trusted certificates are necessarily trusted for
the same purposes.  If you just extract the certificates, without the
associated trust settings, you may well end up undermining some of the
expected security properties, because some restricted use certificates
may then lose their associated restrictions.

> Do we have a way to use the Android trust store in 2021?

The simplest and generally most appropriate answer is: via the Android
APIs, and without JNI into OpenSSL.

If you have a compelling reason to use OpenSSL, you'll probably need
to provision a dedicated trust store of known to be appropriate trust
anchors.

> The target API level of the Android App is 28. If OpenSSL is
> still not able to use the Android default trust stores nowadays. I
> would like to copy the certs from Ubuntu to the Android app.

If it is appropriate to trust the same root CAs (something probably
along the lines of the Mozilla cert bundle), then you could do that,
but why is this necessary?

> But I need to figure out which pem file is used to establish
> connections.

Now it seems that you're not well versed in OpenSSL, which strongly
suggests that it is really best to stick to the provided APIs, and
not roll your own security toolkit.

> Is there a way any OpenSSL command line cmd is able to do
> that?

Almost certainly, but your question is rather oddly phrased and not
completely clear.  PEM files don't establish connections.

Are you looking to capture the entire Ubuntu trust store, or just
the specific trust-anchor that is *currently* the ultimate issuer
of the server's certificate chain?  Do you have good reason to
believe that the server will continue to use the same root CAs
indefinitely? ...

If your reasons for not using the Android APIs are not absolutely
compelling, your best bet is to use those, despite whatever non-critical
disadvantages are driving you to consider OpenSSL instead.

--
Viktor.


Re: Fwd: Requesting to share OpenSSL commands to increase G Pramaeter length in DHE Cipher.

2021-03-03 Thread Kurt Roeckx
On Wed, Mar 03, 2021 at 04:14:17PM +0530, Vadivel P wrote:
> Hi OpenSSL team,
> 
> We are looking for the command line option or any other way to increase the
> DHE G Parameter length to 256 bytes, by default it's 2 now, we need to
> modify it as 256 byte on the server side for our testing either by command
> line or with any other option.we need it for our local server bring up.
> Please support us.

The default generator is the value 2, not 2 bytes. And if you
really need to generate your own DHE keys, using the generator 2
makes perfect sense. Using a larger generator does not add any
security, it just makes it slower.

But I really suggest that you use standardized parameters like the
ones from RFC7919. Note that all the generators in that RFC also
use 2 as the generator.

OpenSSL has no support for generating safe primes with a 256
byte/2048 bit generator.


Re: Fwd: Requesting to share OpenSSL commands to increase G Pramaeter length in DHE Cipher.

2021-03-03 Thread Hubert Kario

On Wednesday, 3 March 2021 11:44:17 CET, Vadivel P wrote:

Hi OpenSSL team,

We are looking for the command line option or any other way to increase the
DHE G Parameter length to 256 bytes, by default it's 2 now, we need to
modify it as 256 byte on the server side for our testing either by command
line or with any other option.we need it for our local server bring up.
Please support us.


why?
size of g has no impact on security of the DHE key agreement what so
ever...

you really should use parameters defined in RFC 7919 and not some custom 
ones

--
Regards,
Hubert Kario
Senior Quality Engineer, QE BaseOS Security team
Web: www.cz.redhat.com
Red Hat Czech s.r.o., Purkyňova 115, 612 00  Brno, Czech Republic



Fwd: Requesting to share OpenSSL commands to increase G Pramaeter length in DHE Cipher.

2021-03-03 Thread Vadivel P
Hi OpenSSL team,

We are looking for the command line option or any other way to increase the
DHE G Parameter length to 256 bytes, by default it's 2 now, we need to
modify it as 256 byte on the server side for our testing either by command
line or with any other option.we need it for our local server bring up.
Please support us.

Example:

[image: image.png]

Regards,
Vadivel