I ran into a problem while trying to create X509Certificate using 
bouncycastle Provider.
I added bouncycastle provider jar which caused GC overlimit and Java Heap 
Space Problem.

Here is my code which is just from BouncyCastle example.

    public static X509Certificate createMasterCert(
        PublicKey pubKey,
        PrivateKey privKey)
        throws Exception
    {
        //
        // signers name
        //
        String issuer = "C=AU, O=The Legion of the Bouncy Castle, OU=Bouncy 
Primary Certificate";

        //
        // subjects name - the same as we are self signed.
        //
        String subject = "C=AU, O=The Legion of the Bouncy Castle, 
OU=Bouncy Primary Certificate";

        //
        // create the certificate - version 1
        //
        X509v1CertificateBuilder v1CertBuilder = new 
JcaX509v1CertificateBuilder(
            new X500Name(issuer),
            BigInteger.valueOf(1),
            new Date(System.currentTimeMillis() - 1000L * 60 * 60 * 24 * 
30),
            new Date(System.currentTimeMillis() + (1000L * 60 * 60 * 24 * 
30)),
            new X500Name(subject),
            pubKey);

        X509CertificateHolder cert = v1CertBuilder.build(new 
JcaContentSignerBuilder("SHA1withRSA").setProvider(BC).build(privKey));

        return new 
JcaX509CertificateConverter().setProvider(BC).getCertificate(cert);
    }

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to