byte[] decode(byte[] passwd) { if (!config.isEncrypting()) { return passwd; } // decrypt the password StandardPBEByteEncryptor encryptor = new StandardPBEByteEncryptor(); char[] key = key(); try { encryptor.setPasswordCharArray(key); return encryptor.decrypt(Base64.decodeBase64(passwd)); } finally { scramble(key); } }
byte[] encode(char[] passwd) { if (!config.isEncrypting()) { return toBytes(passwd); } // encrypt the password StandardPBEByteEncryptor encryptor = new StandardPBEByteEncryptor(); char[] key = key(); try { encryptor.setPasswordCharArray(key); return Base64.encodeBase64(encryptor.encrypt(toBytes(passwd))); } finally { scramble(key); } }
char[] chars = toChars(password); byteEncrypter = new StandardPBEByteEncryptor(); byteEncrypter.setPasswordCharArray(chars);
/** * Creates a new instance of <tt>PooledStandardPBEByteEncryptor</tt>. */ public PooledPBEByteEncryptor() { super(); this.firstEncryptor = new StandardPBEByteEncryptor(); }
/** * Creates a new instance of <tt>PooledStandardPBEByteEncryptor</tt>. */ public PooledPBEByteEncryptor() { super(); this.firstEncryptor = new StandardPBEByteEncryptor(); }
/** * Creates a new instance of <tt>PooledStandardPBEByteEncryptor</tt>. */ public PooledPBEByteEncryptor() { super(); this.firstEncryptor = new StandardPBEByteEncryptor(); }
/** * Creates a new instance of <tt>StandardPBEBigDecimalEncryptor</tt>. */ public StandardPBEBigDecimalEncryptor() { super(); this.byteEncryptor = new StandardPBEByteEncryptor(); }
/** * Creates a new instance of <tt>StandardPBEBigDecimalEncryptor</tt>. */ public StandardPBEBigDecimalEncryptor() { super(); this.byteEncryptor = new StandardPBEByteEncryptor(); }
/** * Creates a new instance of <tt>StandardPBEBigIntegerEncryptor</tt>. */ public StandardPBEBigIntegerEncryptor() { super(); this.byteEncryptor = new StandardPBEByteEncryptor(); }
/** * Creates a new instance of <tt>StandardPBEBigDecimalEncryptor</tt>. */ public StandardPBEBigDecimalEncryptor() { super(); this.byteEncryptor = new StandardPBEByteEncryptor(); }
/** * Creates a new instance of <tt>StandardPBEBigIntegerEncryptor</tt>. */ public StandardPBEBigIntegerEncryptor() { super(); this.byteEncryptor = new StandardPBEByteEncryptor(); }
/** * Creates a new instance of <tt>StandardPBEBigIntegerEncryptor</tt>. */ public StandardPBEBigIntegerEncryptor() { super(); this.byteEncryptor = new StandardPBEByteEncryptor(); }
/** * Creates a new instance of <tt>StandardPBEStringEncryptor</tt>. */ public StandardPBEStringEncryptor() { super(); this.byteEncryptor = new StandardPBEByteEncryptor(); this.base64 = new Base64(); }
/** * Creates a new instance of <tt>StrongBinaryEncryptor</tt>. */ public StrongBinaryEncryptor() { super(); this.encryptor = new StandardPBEByteEncryptor(); this.encryptor.setAlgorithm("PBEWithMD5AndTripleDES"); }
/** * Creates a new instance of <tt>BasicBinaryEncryptor</tt>. */ public BasicBinaryEncryptor() { super(); this.encryptor = new StandardPBEByteEncryptor(); this.encryptor.setAlgorithm("PBEWithMD5AndDES"); }
/** * Creates a new instance of <tt>StandardPBEStringEncryptor</tt>. */ public StandardPBEStringEncryptor() { super(); this.byteEncryptor = new StandardPBEByteEncryptor(); this.base64 = new Base64(); }
/** * Creates a new instance of <tt>StandardPBEStringEncryptor</tt>. */ public StandardPBEStringEncryptor() { super(); this.byteEncryptor = new StandardPBEByteEncryptor(); this.base64 = new Base64(); }
/** * Creates a new instance of <tt>StrongBinaryEncryptor</tt>. */ public StrongBinaryEncryptor() { super(); this.encryptor = new StandardPBEByteEncryptor(); this.encryptor.setAlgorithm("PBEWithMD5AndTripleDES"); }
System.out.println("start *****"); String text="The quick brown fox jumps over the lazy dog"; StandardPBEByteEncryptor encryptor=new StandardPBEByteEncryptor(); encryptor.setAlgorithm("PBEWithMD5AndDES"); encryptor.setPassword("HelloWorld"); byte[] encrypted=encryptor.encrypt(text.getBytes()); System.out.println("stop *****");
private static StandardPBEByteEncryptor getEncryptor(String key) { StandardPBEByteEncryptor encryptor = new StandardPBEByteEncryptor(); encryptor.setPassword(key); encryptor.setAlgorithm("PBEWithSHA1AndRC4_128"); encryptor.setKeyObtentionIterations(4000); return encryptor; }