1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
public static void main(String[] args) {
final String message = "Mon message à traiter d'urgence ";
try {
SecretKey cle = cleCrypt();
System.out.println("cle: " + BytesToHex.bytesToHex(cle.getEncoded()));
byte[] encrypted = encrypter(message, cle); // récupération du tableau de bytes contenant la valeur du cryptage
System.out.println("texte encrypte : " + BytesToHex.bytesToHex(encrypted ));
String dec = decrypter(encrypted, cle); // décryptage
System.out.println("texte decrypte : " + dec);
} catch (Exception e) {
e.printStackTrace();
}
} |