CryptoSample
Hello
I'm new to the Blackberry development. I have the following encrypt / decrypt routines and must wear to my blackberry project. Can you please help me get started?
Concerning
Jaco
/* import javax.crypto.*; import javax.crypto.spec.*; import java.io.*; import java.util.zip.CRC32; import java.util.zip.Checksum; import java.util.zip.Inflater; import java.util.zip.InflaterInputStream; */ public String EncryptData(String data, String skey) throws Exception { String encryptedData = ""; try{ byte [] bData = data.getBytes(); String alg = "AES/ECB/NoPadding"; SecretKey key = new SecretKeySpec(skey.getBytes(), alg.replaceFirst("/.*", "")); Cipher cipher = Cipher.getInstance(alg); cipher.init(Cipher.ENCRYPT_MODE, key); byte[] encoded = cipher.doFinal(bData); encryptedData = bytesToHex(encoded); } catch(Exception e){ throw e; } return encryptedData; } public String DecryptData(String hexString, String skey) throws Exception { String decryptedData = ""; try{ byte [] bData = convToBinary(hexString); String alg = "AES/ECB/NoPadding"; SecretKey key = new SecretKeySpec(skey.getBytes(), alg.replaceFirst("/.*", "")); Cipher cipher = Cipher.getInstance(alg); cipher.init(Cipher.DECRYPT_MODE, key); byte[] decoded = cipher.doFinal(bData); decryptedData = new String(decoded); } catch(Exception e){ throw e; } return decryptedData; }
I think it's the closest example that we have.
Use basic encryption
http://supportforums.BlackBerry.com/T5/Java-development/use-basic-encryption/Ta-p/445092
Tags: BlackBerry Developers
Similar Questions
-
The native API of Blackberry has a PBKDF2 (password-based key derivation function) application available?
The answer is Yes, the native API includes an implementation of pbkdf2, which documentation can be found here: https://developer.blackberry.com/native/reference/core/com.qnx.doc.crypto.lib_ref/topic/manual/about...
In addition, samples of the community includes an example of how to use it in the cryptosample project.
Maybe you are looking for
-
Can Recycle Bin on desktop shortcut
I would like to put a shortcut to the Recycle Bin on my desktop, so I can drag files to the trash. I know there is one on the dock but it would be easier on the desk for me. How can I do?
-
Pavilian dv7: sensor position dv7
For some reason, Bing has set my default location as Seattle. I live on the coast is in New York. How can I activate the place feeling the control panal, location thingie says no no sensors. Is it a hardware problem or software? TX Sdasaro
-
I have a desktop running XP Home Edition which is connected to a router via ethernet lynksis. I shared a few records that I accessed from my laptop running Win 7. Something must of happened after I ran a scan of viruses on the desktop, because now
-
Instant ink / no new cartridge sent / Support questions
Hello I just wanted to post a message to express my discontent around the Ink Instant subscription service. I am based in the UK and signed to instant ink. Last week I ran out of ink, and I had not sent a new cartridge. I emailed HP and received an a
-
Hi allIs there a way we can start an image as hidden and change it to visible by using a cutting-edge action?I have an image of a process flow and am branching out to watch short videos on every step, but I would like to visually show the progress on