public String Encriptar(String str){ try { // Codificar la cadena en bytes con UTF-8 byte[] utf8 = str.getBytes("UTF8"); // Encripta byte[] enc = encrypt.doFinal(utf8); // Codificar bytes a base64 para obtener una cadena return new sun.misc.BASE64Encoder().encode(enc); } catch (javax.crypto.BadPaddingException e) { } catch (IllegalBlockSizeException e) { } catch (UnsupportedEncodingException e) { } catch (java.io.IOException e) { } return null; }
public String Desencriptar(String str) { try { // Decode base64 para obtener bytes byte[] dec = new sun.misc.BASE64Decoder().decodeBuffer(str); // Decripta byte[] utf8 = decrypt.doFinal(dec); // Decodificar con UTF-8 return new String(utf8, "UTF8"); } catch (javax.crypto.BadPaddingException e) { } catch (IllegalBlockSizeException e) { } catch (UnsupportedEncodingException e) { } catch (java.io.IOException e) { } return null; }
actions Cooking Recipes Política Digital Photography Software Forex Trading Credit Attomey Treatment Cómo hacer dinero en línea Insurance Loans Trading Claim loans Mesothelioma Law Firm Mortgage Los préstamos y donaciones hosting Lawyer Moda y Diseño Donate Condominiums hotels Degree Hosting domains Conference Call Donate Car for Tax Credit Defensa Penal Abogados de la Florida Casino reviews Web Hosting y Dominios Recovery Transfer Gas/Electricity Classes Donate Your Car for Kids Dominios Seguros Online Making Money Web Hosting and Domains Rehab Cord Blood Salud Executive MBA ranking universities Fotografía digital Leyes y abogados Acciones Toys for children
No hay comentarios:
Publicar un comentario