Hi All,
I'm trying to encrypt/decrypt a bunch of data using DESede (triple
DES). I'm using the javax.crypto APIs, which seem to be implemented by
the pure-java code found in the package
org.bouncycastle.crypto.engines.
Is there an SDK API for DESede which is implemented internally by
native code? The openssl libs are part of Android, it would be nice to
be able take advantage of their native speed. Is there any way?
Here's a rough outline of my current approach:
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
class Decrypter {
private Cipher _cipher;
public Decrypter() {
try {
_cipher = Cipher.getInstance("DESede");
}
catch(Exception exception) {
throw new RuntimeException(exception);
}
}
//
// decrypt gets called many times -- needs to be faster
//
public byte[] decrypt(byte[] keyBytes, byte[] encryptedBytes)
throws Exception {
Key key = new SecretKeySpec(keyBytes, "DESede");
_cipher.init(Cipher.DECRYPT_MODE, key);
return _cipher.doFinal(encryptedBytes);
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---