Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Which elliptic curves are supported #47

Closed
PythEsc opened this issue Jul 29, 2019 · 5 comments
Closed

Which elliptic curves are supported #47

PythEsc opened this issue Jul 29, 2019 · 5 comments
Assignees

Comments

@PythEsc
Copy link

PythEsc commented Jul 29, 2019

Hi,

from your README I have seen that ACCP supports elliptical curves. Unfortunately it does not describe which curves exactly are supported. For my application I need support for the NIST and Brainpool curves. NIST is usually supported, but what about Brainpool?

I would also like to know if the provider offers an X509 CertificateFactory implementation and if it is planned to release a Windows 64-bit version of the provider on maven.

Best,

Florian

@SalusaSecondus SalusaSecondus self-assigned this Jul 29, 2019
@SalusaSecondus
Copy link
Contributor

For curves I'll need a bit more time to dig up the answer to make sure I get you fully accurate information. It's a little complicated because it has to do with the interactions between the native and the Java code.

For the other two:

  • No, ACCP does not currently offer a CertificateFactory (for X509 or other types). Right now it only implements cryptographic algorithms and doesn't have any *FactorySpi implementations. Both ACCP and your application will use the highest priority implementations of these components. On most systems this will be either the Java default or BouncyCastle.
  • Yes, there is a plan to support 64-bit Windows (just cut issue Support Windows 64 #48 to track this), however this work hasn't yet been scheduled or fully investigated by the core ACCP team.

@SalusaSecondus
Copy link
Contributor

SalusaSecondus commented Jul 29, 2019

The curves question is (as I mentioned) a tad complicated. We support the intersection of the curves supported by OpenSSL 1.0.2 and the Java environment we are using. This is because we need OpenSSL to actually do the math but we need Java to manage the keys, curves, appropriate KeyFactorys and similar. This means that on a standard Java install we only support those curves listed in the EcGenTest because the default providers which come with Java do not support other curves.

BouncyCastle, however, does support more curves (including the Brainpool curves). This means that if BouncyCastle is a sufficiently high priority provider on your system that ACCP can use it to parse and handle the keys. Specifically, if ACCP is the highest priority provider and BouncyCastle is the second highest priority provider, then ACCP can use libcrypto to do the cryptography using Brainpool curves and leverage BouncyCastle for the key handling in java.

public class BPTest {
    public static void main(String args[]) throws Exception {
        // Inserts BouncyCastle at the highest priority
        Security.insertProviderAt(new BouncyCastleProvider(), 1);
        // Inserts ACCP at the highest priority, bumping down the others (including BouncyCastle)
        AmazonCorrettoCryptoProvider.install();
        System.out.println(Arrays.toString(Security.getProviders()));

        KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC");

        kpg.initialize(new ECGenParameterSpec("brainpoolp192t1"));
        System.out.println(kpg.generateKeyPair().getPublic());
        System.out.println("KeyPairGenerator Provider: " + kpg.getProvider());
    }
}

Please let me know if this answers your questions.

@PythEsc
Copy link
Author

PythEsc commented Jul 30, 2019

Hello @SalusaSecondus,

thank you so much. This information is really useful. We're already using the Bouncycastle provider, so it shouldn't be a problem for us to go the way you suggested. We expect to see improved performance in TLS handshake with the addition of ACCP. Especially the SHAwithECDSA verification is still very slow at the moment and could be significantly faster with an OpenSSL based implementation.

I think we'll have to evaluate this a bit more, but it sounds pretty promising.

If I understood your first answer correctly, then I should continue to use Sun/Bouncycastle implementations to generate the keys and certificate objects, but can pass the Bouncycastle X509 implementation to your provider?

@SalusaSecondus
Copy link
Contributor

My recommendation is that you configure your providers as follows and then (whenever possible) don't use an explicit provider for any calls to getInstance(), but rather let the system just figure out which implementation to use.

  1. AmazonCorrettoCryptoProvider
  2. BouncyCastleCryptoProvider
  3. (And lower) All standard Java providers in the standard order.

So, this means you wouldn't explicitly use BouncyCastle (or Sun) for key generation or parsing certificates. Rather Java would figure out that those are the highest priority providers which implement certificate parsing (and would use ACCP for key generation). It isn't that ACCP cannot generate Brainpool keys, it just cannot (currently) generate them without the assistance of BouncyCastle for parsing them.

@PythEsc
Copy link
Author

PythEsc commented Jul 31, 2019

Okay, thanks for clearing up the final details. I think we can close this ticket. Unfortunately we can't use ACCP up to Windows 64 bit support anyway. I follow your issue on this topic and as soon as something happens and there are first releases, we will do an evaluation with ACCP.

@PythEsc PythEsc closed this as completed Jul 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants