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
Contributor
bsyonline
Posts: 11
Registered: ‎09-26-2011
My Device: a
Accepted Solution

How to use 3DES and RAS

Hi all i need write encryption and decryption using 3DES and RSA .can any one please tell me how to write this .  

Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to use 3DES and RAS

Have a look at the API, there are many crypto samples included. 

 

You could start looking at theese classes:

RSAEncryptorEngine
DESEncryptorEngine 

Contributor
bsyonline
Posts: 11
Registered: ‎09-26-2011
My Device: a

Re: How to use 3DES and RAS

yes,I checked these,but i donot understand how to ues these method ,such as encrypt(byte[] plaintext, int plaintextOffset, byte[] ciphertext, int ciphertextOffset)

can you give me an example?
Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to use 3DES and RAS

[ Edited ]

I thought the examples given were pretty clear.  For example, the method you have given

encrypt(byte[] plaintext, int plaintextOffset, byte[] ciphertext, int ciphertextOffset)
just encrypts bytes from plaintext into ciphertext, starting at plaintextOffset putting the encrypted bytes starting at ciphertextOffset.  Pretty much exactly what the JavaDoc says!

 

If you don't understand how to use a specific encryption algorithm, then the code will be confusing.  In which case, I suggest that you review external documentation on these algorithms and they way they should be used, before looking at the code.  Search the internet, there is plenty of information about these algorithms out there.  And there is quite a lot to understand, with padding, and the various block approaches, that complicates the basic encryption code.  And that is just 3DES!

 

But if you are struggling with a specific piece of code, please feel free to paste it in here and ask about it. 

 

BTW, the code samples are linked to from each of the class pages, read the documentation at the start for links. 

Contributor
bsyonline
Posts: 11
Registered: ‎09-26-2011
My Device: a

Re: How to use 3DES and RAS

oh!