1 13 14 package org.ejbca.ui.cli; 15 16 import java.io.BufferedReader ; 17 import java.io.InputStreamReader ; 18 19 import org.ejbca.util.CertTools; 20 import org.ejbca.util.StringTools; 21 22 27 public class EncryptPwd extends BaseCommand { 28 33 public static void main(String [] args) { 34 try { 35 System.out.println("Please not that this encryption does not provide absolute security, it uses a build in key for encryption to keep the password from at least accidentaly beeing known."); 36 System.out.println("Enter word to encrypt: "); 37 InputStreamReader isr = new InputStreamReader ( System.in ); 38 BufferedReader br = new BufferedReader ( isr ); 39 String s = br.readLine(); 40 CertTools.installBCProvider(); 41 System.out.println("Encrypting pwd '"+s+"'"); 42 String enc = StringTools.pbeEncryptStringWithSha256Aes192(s); 43 System.out.println(enc); 44 } catch (Exception e) { 45 System.out.println(e.getMessage()); 46 System.exit(-1); 48 } 49 } 50 } 51 | Popular Tags |