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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
New Contributor
Posts: 6
Registered: ‎12-20-2011
My Device: 9105
My Carrier: null

Raw RSA signing/decrypting

Hi everyone!

I need help, I'm implementing RSACryptoToken, and I've faced the issue, connected with 

decryptRSA and signRSA. According to the documentation, they need to perform raw RSA decrypting and signing.

 

Does BB provides such API, and how to implement this? Maybe there are any examples.

 

Thanks in advance

Developer
Posts: 204
Registered: ‎08-09-2010
My Device: 9930, PlayBook
My Carrier: Verizon Wireless

Re: Raw RSA signing/decrypting

//here is how you would use RSA to sign data:

 

byte[] dataBytes = [bytes of data to sign];

PKCS1SignatureSigner signer = (PKCS1SignatureSigner) SignatureSignerFactory.getInstance([RSA Private Key], "RSA_PKCS1_V15/SHA1");

signer.update(dataBytes, 0, dataBytes.length);
byte[] signatureBytes = new byte[signer.getLength()];
signer.sign(signatureBytes, 0);

 

 

//...and to decrypt using RSA...


ByteArrayInputStream inputStream = new ByteArrayInputStream([encrypted bytes]);
BlockDecryptor decryptor = new BlockDecryptor(new PKCS1UnformatterEngine(new RSADecryptorEngine([RSA Private Key])), inputStream);
byte[] decrypted = IOUtilities.streamToBytes(decryptor);

 

Take a look at the net.rim.device.api.crypto libraries

New Contributor
Posts: 6
Registered: ‎12-20-2011
My Device: 9105
My Carrier: null

Re: Raw RSA signing/decrypting

Thanks for reply!

But it still doesn't help me.

 

I sign S/MIME message with RSACryptoToken method signRSA, and after signing I get a message from S/MIME:

"Verification failed: invalid signature"

Developer
Posts: 246
Registered: ‎09-30-2010
My Device: Z10, Onyx2
My Carrier: IND XL

Re: Raw RSA signing/decrypting

you need to ask rim about signature for RSA.
Highlighted
New Contributor
Posts: 6
Registered: ‎12-20-2011
My Device: 9105
My Carrier: null

Re: Raw RSA signing/decrypting

Thanks for the answer. But how can I ask RIM about it? 

Is there any way to send them an ask??