Premetto di non essere un esperto di criptazione..
Ho provato il codice che hai postato con questo main:
e con questo maincodice:public static void main(String[] args) { String str="prova"; StringEncrypter se=new StringEncrypter("psw"); String enc=se.encrypt(str); System.out.println(se.decrypt(enc)); }
e sembra che la decodifica avvenga correttamente.. Forse il problema non è qui, ma nel codice che richiama StringEncryptercodice:public static void main(String[] args) { String str="prova"; byte[] key="12345678".getBytes(); SecretKeySpec sk=new SecretKeySpec(key,"DES"); StringEncrypter se=new StringEncrypter(sk,"DES"); String enc=se.encrypt(str); System.out.println(se.decrypt(enc)); }
![]()

Rispondi quotando