Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9207557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:24:49+00:00 2026-06-18T00:24:49+00:00

I’m now on developing digital signature app on android. however, I failed to make

  • 0

I’m now on developing digital signature app on android.

however, I failed to make a apk file because eclipse show following message

[2013-01-27 20:43:25 – BlowfishCipher] Dx
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lorg/bouncycastle/mozilla/SignedPublicKeyAndChallenge;

[2013-01-27 20:43:25 – BlowfishCipher] Dx at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
[2013-01-27 20:43:25 – BlowfishCipher] Dx at com.android.dx.dex.file.DexFile.add(DexFile.java:163)

I know that the error message indicates that duplicated jar files but I don’t know how to
solve it since the duplicated jar (Lorg/bouncycastle/mozilla/SignedPublicKeyAndChallenge;) is the core file of the bouncy caslte library.

and follwing java code shows no syntax error but it cause java.lang.IllegalArgumentException: already added exception

package exam.blowfishcipher;

import java.io.FileWriter;
import java.io.OutputStreamWriter;
import java.security.KeyPair;
import java.security.SecureRandom;
import javax.security.auth.x500.X500Principal;
import org.bouncycastle.jce.PKCS10CertificationRequest;
import org.bouncycastle.openssl.PEMWriter;
import android.os.Environment;
import chapter6.PKCS10ExtensionExample;



public class PKCS10Generater
{
    public static PKCS10CertificationRequest generateRequest(
            KeyPair pair)
            throws Exception

            {           
             return new PKCS10CertificationRequest(
                     "SHA256withRSA",
                     new X500Principal("CN=Test CA Certificate"),
                     //new X500Principal("CN=end"),
                     pair.getPublic(),
                     null,
                     pair.getPrivate());
            }

    public static void pemEncodeToFile(String filename, Object obj, char[] password)     throws Exception{
        PEMWriter pw = new PEMWriter(new FileWriter(filename));
           if (password != null && password.length > 0) {
               pw.writeObject(obj, "DESEDE", password, new SecureRandom());
           } else {
               pw.writeObject(obj);
           }
           pw.flush();
           pw.close();
    }

    public static void reqGen() throws Exception
    {
        //create the keys
        /*
        KeyPairGenerator kpGen = KeyPairGenerator.getInstance("RSA", "BC");
        //KeyPairGenerator kpGen = KeyPairGenerator.getInstance()

        kpGen.initialize(512, chapter4.Utils.createFixedRandom());

        KeyPair pair=kpGen.generateKeyPair();
        */
        //PKCS10CertificationRequest request = generateRequest(pair);

        KeyPair pair = chapter8.Utils.generateRSAKeyPair();
        PKCS10CertificationRequest request = PKCS    10ExtensionExample.generateRequest(pair);


        pemEncodeToFile(Environment.getExternalStorageDirectory()+"pkcs10.req",     request, null);
        PEMWriter pemWrt = new PEMWriter( new OutputStreamWriter(System.out));
        pemWrt.writeObject(request);
        pemWrt.close();     
    }


}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:24:51+00:00Added an answer on June 18, 2026 at 12:24 am

    Android already includes BouncyCastle in the system, that is why you are getting the error when trying to add it again (on recent versions it is actually in com.android.org.bouncycastle or some such so you shouldn’t get the error, in theory). You have to rename the package of BC if you want to include it in your project (with jarjar, etc.). One project that already does this for you is SpongyCastle. Try using that instead of the regular BC jar.

    https://github.com/rtyley/spongycastle

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have a jquery bug and I've been looking for hours now, I can't
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:
I want use html5's new tag to play a wav file (currently only supported
In my XML file chapters tag has more chapter tag.i need to display chapters
I want to show the soap response to UIWebview.. my soap response is, <p><img
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.