Skip to content
This repository was archived by the owner on Dec 23, 2025. It is now read-only.
This repository was archived by the owner on Dec 23, 2025. It is now read-only.

cannot be used in android #10

@AndreiD

Description

@AndreiD

upon importing it into an android project I get the following error:

2019-02-25 11:43:28.299 6546-6546/wallet.zilliqa E/System: ******** DEPRECATED FUNCTIONALITY ******** 2019-02-25 11:43:28.299 6546-6546/wallet.zilliqa E/System: * The implementation of the KeyPairGenerator.EC algorithm from 2019-02-25 11:43:28.299 6546-6546/wallet.zilliqa E/System: * the BC provider is deprecated in this version of Android. 2019-02-25 11:43:28.299 6546-6546/wallet.zilliqa E/System: * It will be removed in a future version of Android and your 2019-02-25 11:43:28.299 6546-6546/wallet.zilliqa E/System: * application will no longer be able to request it. Please see 2019-02-25 11:43:28.299 6546-6546/wallet.zilliqa E/System: * https://android-developers.googleblog.com/2018/03/cryptography-changes-in-android-p.html 2019-02-25 11:43:28.299 6546-6546/wallet.zilliqa E/System: * for more details. 2019-02-25 11:43:28.304 6546-6546/wallet.zilliqa W/System.err: java.security.InvalidAlgorithmParameterException: parameter object not a ECParameterSpec 2019-02-25 11:43:28.305 6546-6546/wallet.zilliqa W/System.err: at com.android.org.bouncycastle.jcajce.provider.asymmetric.ec.KeyPairGeneratorSpi$EC.initialize(KeyPairGeneratorSpi.java:156) 2019-02-25 11:43:28.305 6546-6546/wallet.zilliqa W/System.err: at java.security.KeyPairGenerator.initialize(KeyPairGenerator.java:438) 2019-02-25 11:43:28.305 6546-6546/wallet.zilliqa W/System.err: at com.firestack.laksaj.crypto.Schnorr.generateKeyPair(Schnorr.java:39) 2019-02-25 11:43:28.305 6546-6546/wallet.zilliqa W/System.err: at com.firestack.laksaj.crypto.KeyTools.generateKeyPair(KeyTools.java:38)

searching some fixes I came across

Android included a shortened version of Bouncycastle, and there is no full support for ECDSA. You can see in the link that algorithm KeyPairGenerator/ECDSA is not supported, which is the required one to generate ethereum keys.

You can not include directly the bouncycastle library because there is a conflict with the package name org.bouncycastle. I suggest to include spongycastle in your project, which it is a repackaged version of bouncycastle for Android org.spongycastle.

so in android

KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("EC", "BC");

is not supported.

so the way to transform this into "android" is to

import org.spongycastle.jce.provider.BouncyCastleProvider;
  static {
    Security.addProvider(new BouncyCastleProvider());
  }

but it gives me the same error

any ideas how to make it work in android ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions