Adding Built-In Crypto Library

This commit is contained in:
Brock Whitten
2010-02-24 16:18:35 -08:00
parent c4ac7e5383
commit cb90852dfc
3 changed files with 138 additions and 3 deletions
@@ -0,0 +1,37 @@
package com.phonegap;
import android.webkit.WebView;
public class CryptoHandler {
WebView mView;
CryptoHandler(WebView view)
{
mView = view;
}
public void encrypt(String pass, String text)
{
try {
String encrypted = SimpleCrypto.encrypt(pass,text);
mView.loadUrl("javascript:Crypto.gotCryptedString('" + text + "')");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void decrypt(String pass, String text)
{
try {
String decrypted = SimpleCrypto.decrypt(pass,text);
mView.loadUrl("javascript:Crypto.gotPlainString('" + text + "')");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}