Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Member
sreekanth_sk
Posts: 1
Registered: ‎09-01-2010
My Device: Not Specified

Re: C/C++ support?

I have developed few applications for iphone and i would like to port those to Blackberry phones .

 

Could you please provide more details in using 'cibyl" to port to BB phones ?

 

Thanks in advance

 

-sk

Developer
mayureshg
Posts: 31
Registered: ‎08-05-2011
My Device: 9550

Re: C/C++ support?

Hi..

 

I want to integrate 3rd party libraries(Chilkat http://www.chilkatsoft.com) in my Blackberry application targeting OS 5 and 6. The libraries are for Encrypting and Decrypting my response with the server (HttpConnection).

 

But there is a problem the Chilkat libraries are only developed in C++. So is there any way that i can used this in my application.

Please guide me througn this.


/*********************************************************************/
Please press the like button on the right side to thank me if my reply helped you and please mark posts as solved if you found a solution.
Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: C/C++ support?

Sorry your only option is to rewrite them in Java.....

Developer
mayureshg
Posts: 31
Registered: ‎08-05-2011
My Device: 9550

Re: C/C++ support?

Thanks Peter..

 

But i just found out that these libraries are available for use in plain java(may be for Java Web based projects). They include some dll's that are to be loaded in to the system to access the .JAR libraries. But i cant find a way to use such dll's for my Blackberry applications for OS-5 & 6.

 

Also importing the .JAR's in my eclipse environment for BB is of no use as dey are not recognized.( I guess dey were build to work on JAVA web applications and not BB JAVA.


/*********************************************************************/
Please press the like button on the right side to thank me if my reply helped you and please mark posts as solved if you found a solution.
Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: C/C++ support?

[ Edited ]

Yes I should have said your only option is to rewrite these in J2ME Java.....

 

I would encourage you to review the encryption library code that is built in to the BlackBerry.  It would surprise me if there is not already code on the device, 'baked in' for performance, that will not do what you need. 

Developer
mayureshg
Posts: 31
Registered: ‎08-05-2011
My Device: 9550

Re: C/C++ support?

Yes Peter.....The Crypto libraries in-built in Blackberry work fine. I even have used it to sucessfully Encrypt and Decrypt the responses that i sent from my application.

 

It just dat i was told to use a 3rd party tool (Chilkat libraries) for the same, dats the reason i was looking for some help in these.

 

Anyways thanks for your reply Peter.


/*********************************************************************/
Please press the like button on the right side to thank me if my reply helped you and please mark posts as solved if you found a solution.
Developer
mayureshg
Posts: 31
Registered: ‎08-05-2011
My Device: 9550

Re: C/C++ support?

Hi,

 

No i get the public key from the webservice its like this

-----BEGIN PUBLIC KEY-----


// the key goes here


-----END PUBLIC KEY-----

 

I remove the other tags to get the Public key form the rest of the string so as to retrive the public key.

 

 

    public static RSAPublicKey readPublicKey(String strPEMKey) {

        RSAPublicKey publicKey = null;
        X509Certificate clientCert = null;

        byte[] certBuf = null;

        try {

            certBuf = Base64InputStream.decode(strPEMKey);

        } catch (Exception ex) {

            ex.printStackTrace();
        }
        try {

            clientCert = new X509Certificate(certBuf);
            publicKey = (RSAPublicKey) clientCert.getPublicKey();

 

//But i get the public key as NULL always

 

        } catch (CertificateParsingException ex) {
            ex.printStackTrace();
        } catch (InvalidCryptoSystemException ex) {
            ex.printStackTrace();
        }
        return publicKey;
    }

 

 

 

My signature verification function is as follows

 

    public static boolean verify(RSAPublicKey publicKey, byte[] data,
            byte[] signature) throws CryptoException {
        PKCS1SignatureVerifier verifier = new PKCS1SignatureVerifier(publicKey,
                signature, 0);
        verifier.update(data);
        return verifier.verify();
    }

 

This method is from the AdvancedCryptoDeveloperLab.java class that i found on the Developers forum and it is dhared by many users in other thread also.

 

I want to verify the RSA signature that is sent by other webservice using the verify() function above. I have the the "RSA Signature" stored in a string and the "Plaintext" in other string that i converted to bytes to Verify the signature. But the Public Key is always giving me as NULL.

Can any one help me here...Please.


/*********************************************************************/
Please press the like button on the right side to thank me if my reply helped you and please mark posts as solved if you found a solution.