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 Developer
Posts: 21
Registered: ‎11-05-2008
My Device: Not Specified

CMSSignedDataOuputStream class

Hi folks,

Somebody has used the CMSSignedDataOuputStream class?

 

This is my problem, I have been trying to generate a document CMS with a parallel signatures.

I just can get signature over signature, (I think this schema is called "signatures in serial")

 

I have spent too much time to figure out how to get it.

Any idea?, Please Help Me.

New Developer
Posts: 21
Registered: ‎11-05-2008
My Device: Not Specified

Re: CMSSignedDataOuputStream class

Hi,

 

Does anybody have been experienced the same problem?


Or any suggestion where i can find more information about this topic?

 

Please, help me.

Thanks for your time.

ICL

 

New Developer
Posts: 21
Registered: ‎11-05-2008
My Device: Not Specified

Re: CMSSignedDataOuputStream class

Thanks to Tbilisoft Team, 

I have looked the hyperlinks that you have posted, those one have been useful to me.  

 

But I have one question. It is possible to generate an Encapsulated Signed Data using the CMS from BB APIs? 

Graphically this is what i want:

                           |-------------|

         |-----------|     | Signed-data |

Data-----|Signed-Data|     ||-----------||

         |Generator  |-----||   Data    ||

Signer---|           |     ||-----------||

         |-----------|     |             |

                           ||-----------||

                           ||Signature-1||

                           ||-----------||

                           ||Signature-2||

                           ||-----------||

                           ||Signature-n||

                           ||-----------||

                           |-------------|

 

So, each signer signs the same encapsulatedContentInfo (Data section on the graphic).

 

I have got this with Bouncy Castle, but any idea on How can I get the same approach on BB?.

 

Thanks for your time, I really appreciate it.

 

ICL

Highlighted
Developer
Posts: 5,339
Registered: ‎09-20-2008
My Device: ***
My Carrier: ***

Re: CMSSignedDataOuputStream class

I am sorry, but I have no experience in this field. So I cannot give you a useful advice.
New Developer
Posts: 21
Registered: ‎11-05-2008
My Device: Not Specified

Re: CMSSignedDataOuputStream class

Oh! Smiley Sad Thanks anyway! Tbilisoft.

 

Somebody has an idea?

 

Maybe it is a basic question for experts.

 

Could help me an expert from RIM or BlackBerry APIs, please?

 

If it is so basic, only tell me if I can reach the approach shown in the graphic (above) using the CMS package.

 

Thanks for your time.

ICL

Contributor
Posts: 10
Registered: ‎05-31-2010
My Device: Black berry curve 8530
My Carrier: programmer

Re: CMSSignedDataOuputStream class

Hi all,

 

Sorry for opening the older post. But i face a similar kind of a problem. I have signed a data using the keys in the keystore in the blackberry phone.

 

Now i need to pack the signed data into a PKCS7 format signature file. (normal signed data type, no parallel or other types of signatures). Is it possible to do it with CMS API provided by blackberry or should i go for Bouncy castle APIS.  Any sample implementations or any pointers could be of great help

 

 

 

thanks and regards

Charley

 

New Contributor
Posts: 9
Registered: ‎06-25-2010
My Device: BB 8900
My Carrier: Beeline

Re: CMSSignedDataOuputStream class

ByteArrayOutputStream baos = new ByteArrayOutputStream();
Base64OutputStream b64Os = new Base64OutputStream(baos);
CMSSignedDataOutputStream cos = new CMSSignedDataOutputStream(b64Os, CMSContentTypes.DATA, true, true, true);
SignatureSigner signer = SignatureSignerFactory.getInstance(yourPrivateKey, yourSignatureAlgorithm);
CMSSigner cmsSigner = new CMSSigner(signer, yourCertificate);

cos.addSigner(cmsSigner);

MIMEOutputStream mos = new MIMEOutputStream(cos, false, MIMEOutputStream.ENCODING_7BIT);
try {

    mos.setContentType("text/plain; charset=iso-8859-1");
    mos.write(yourData, 0, yourData.length);
} finally {

    mos.close();
}
byte[] pkcs7Bytes = baos.toByteArray();