Questions tagged [spongycastle]

a repackage of the Bouncy Castle Java cryptographic libraries, targeted specificlly at Android

The Android platform unfortunately ships with a cut-down version of Bouncy Castle - as well as being crippled, it also makes installing an updated version of the libraries difficult due to classloader conflicts.

Spongy Castle is the stock Bouncy Castle libraries with a couple of small changes to make it work on Android:

  • all package names have been moved from org.bouncycastle.* to org.spongycastle.* - to avoid classloader conflicts the Java Security
  • API Provider name is now SC rather than BC no class names change, so
  • the BouncyCastleProvider class remains Bouncy, not Spongy, but moves to the org.spongycastle.jce.provider package.

In general Spongy Castle should be a drop-in replacement for Bouncy Castle, but there are a couple of pain points:

  • ProGuard can often remove crucial classes from the Spongy Castle libs (internally, Bouncy Castle uses a lot of class-loading-by-name, which means ProGuard will over-aggressively remove it's classes). ProGuard config must be tweaked to keep the appropriate classes for whatever crypto algorithms you need.
  • Not all classes from Oracle Java are present on Android - for example, missing AWT classes block usage of the S/MIME API.
119 questions
0
votes
1 answer

Android : could not find org.spongycastle.util.io.pem.PemReader

I am using spongycastle in my android code. code is working fine in android 5 and android 6 but in android 4 its showing the error : java.lang.NoClassDefFoundError: org.spongycastle.util.io.pem.PemReader Its failing at the time of initialization…
MHSN
  • 29
  • 8
0
votes
2 answers

Verify ECDSA signature using SpongyCastle

I'm trying to verify an ECDSA digital signature on Android using SpongyCastle. I have a X509Certificate that contains the public key that I need to use to verify it but I can't quite figure out how to get the PublicKey (down cast ECPublicKey) for…
Jason X
  • 51
  • 5
0
votes
2 answers

Using Java SDK in Android app

So the app I'm building has to use a specific library. Unfortunately this library uses bouncycastle in it. As is known this will not work with Android. Are there any ways to get around this? I was suggested to build a service layer to interact with…
Adrian Le Roy Devezin
  • 672
  • 1
  • 13
  • 41
0
votes
1 answer

ECC algorithm key mismatch

I am trying to implement ECC algorithm on Android. I am currently using spongy castle to implement it. The key generation cone snippet is as follows : KeyPairGenerator kpg = null; try { kpg = KeyPairGenerator.getInstance("ECIES");// Do i have…
0
votes
1 answer

SpongyCastle: how to generate signed data?

I have a message and I want to sign that data with a digital certificate, in ANDROID, with android-studio. This my code: List certList = new ArrayList(); //CMSTypedData msg = new CMSProcessableByteArray("Hello…
0
votes
1 answer

C# encryption realization in java

I am developing an android application in which i need to implement some encryption. At the same time i have to keep compatibility with other versions of application (e.g. for the WP platform), which are already in production. This is C#…
Johnny Doe
  • 3,280
  • 4
  • 29
  • 45
0
votes
1 answer

"package org.spongycastle.crypto does not exist" on one project, but works fine on another

I have downloaded both of these projects, with bitcoinj being rebased to the correct v0.11.3 tag: https://github.com/schildbach/bitcoin-wallet/ https://github.com/bitcoinj/bitcoinj The bitcoin-wallet project gets bitcoinj 0.11.3 as a dependency on a…
Matthew Mitchell
  • 5,293
  • 14
  • 70
  • 122
0
votes
0 answers

Java DES decryption exception in first try

In my project, secure communication is used between android client and server so all messages between them are encrypted as DES algorithm. I have used default Java Provider and also SpongyCastle but in first try of decryption, it gives the below…
firstthumb
  • 4,627
  • 6
  • 35
  • 45
0
votes
0 answers

SpongyCastle and iText errors

I'm trying to add SpongyCastle and iText to my android project for signing pdf file. I used several types of iText(itextg and itextpdf) and SpongyCastle(sc-light-jdk15on-1.47.0.2, scpkix-jdk15on-1.47.0.2, scprov-jdk15on-1.47.0.2).But I always get…
nasroazro
  • 23
  • 1
  • 1
  • 9
0
votes
0 answers

How to get Projective coordinates using spongy castle in Android

I am able to generate Public key and Private key using spongy castle in Android by using the following code KeyPairGenerator keyGen = KeyPairGenerator.getInstance("ECDH", "SC"); ECGenParameterSpec ecSpecCurve163k1 = new…
student
  • 53
  • 1
  • 7
0
votes
1 answer

java.io.IOException: Can't process class when running ProGuard in Maven build of Android project

I use a library called iText to write new information to existing PDFs. In order to encrypt PDFs, iText (for Android) uses a library called SpongyCastle which is an Android port of BouncyCastle. Unfortunately, both iText and Spongycastle contain a…
Matt Wear
  • 1,211
  • 2
  • 15
  • 24
0
votes
1 answer

Implementing SpongyCastle BouncyCastle JCEIESCipher

i've been messing around with Spongy and Bouncycastle, yet cannot find a way to implement the Bouncycastle/Spongycastle JCEIESCipher to encrypt/decrypt a message. Does anyone know how to use it in a basic manner? It would be greatly appreciated.…
user824015
  • 89
  • 3
  • 12
-1
votes
1 answer

How do I construct an ECFieldElement object with the F2m constructors?

X9ECParameters params = SECNamedCurves.getByName("secp256k1"); ECDomainParameters CURVE = new ECDomainParameters(params.getCurve(), params.getG(), params.getN(), params.getH()); ECCurve.Fp curve = (ECCurve.Fp) CURVE.getCurve(); …
user299648
  • 2,769
  • 6
  • 34
  • 43
-1
votes
1 answer

Format issue while decrypting text (Spongycastle)

I have a problem while encrypting/decrypting with RSA in spongycastle on android. enctext contains encrypted text while dectext contains the text after decryption. In debugger, dectext matches plain text message "test" but when passed to…
Eshaal
  • 125
  • 2
  • 13
1 2 3 4 5 6 7
8