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); } }
byteEncrypter.setPasswordCharArray(chars);
/** * Sets a password, as a char[]. * * @since 1.8 * @param password the password to be set. */ public void setPasswordCharArray(final char[] password) { this.encryptor.setPasswordCharArray(password); }
/** * Sets a password, as a char[]. * * @since 1.8 * @param password the password to be set. */ public void setPasswordCharArray(final char[] password) { this.encryptor.setPasswordCharArray(password); }
/** * Sets a password, as a char[]. * * @since 1.8 * @param password the password to be set. */ public void setPasswordCharArray(final char[] password) { this.encryptor.setPasswordCharArray(password); }
/** * Sets a password, as a char[]. * * @since 1.8 * @param password the password to be set. */ public void setPasswordCharArray(final char[] password) { this.encryptor.setPasswordCharArray(password); }
/** * Sets a password, as a char[]. * * @since 1.8 * @param password the password to be set. */ public void setPasswordCharArray(final char[] password) { this.encryptor.setPasswordCharArray(password); }
/** * Sets a password, as a char[]. * * @since 1.8 * @param password the password to be set. */ public void setPasswordCharArray(final char[] password) { this.encryptor.setPasswordCharArray(password); }
this.byteEncryptor.setPasswordCharArray(password);
this.byteEncryptor.setPasswordCharArray(password);
this.byteEncryptor.setPasswordCharArray(password);
this.firstEncryptor.setPasswordCharArray(password);
this.byteEncryptor.setPasswordCharArray(password);
this.firstEncryptor.setPasswordCharArray(password);
/** * Sets the password to be used by the internal encryptor (as a char[]), if a specific * encryptor has not been set with <tt>setEncryptor(...)</tt>. * * @since 1.8 * @param password the password to be set for the internal encryptor */ public void setPasswordCharArray(final char[] password) { if (this.encryptorSet) { throw new EncryptionInitializationException( "An encryptor has been already set: no " + "further configuration possible on hibernate wrapper"); } final StandardPBEByteEncryptor standardPBEByteEncryptor = (StandardPBEByteEncryptor) this.encryptor; standardPBEByteEncryptor.setPasswordCharArray(password); }
/** * Decode the password * @param passwd * @return */ byte[] decode(byte[] passwd) { if (!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); } }
protected ICrypt getEncrypterFromSession(HttpSession s) { ICrypt result = (ICrypt) s.getAttribute(ICRYPT_ATTR_NAME); if (result != null) return result; GeoServerSecurityManager manager = GeoServerApplication.get().getSecurityManager(); char[] key = manager.getRandomPassworddProvider().getRandomPasswordWithDefaultLength(); StandardPBEByteEncryptor enc = new StandardPBEByteEncryptor(); enc.setPasswordCharArray(key); // since the password is copied, we can scramble it manager.disposePassword(key); if (manager.isStrongEncryptionAvailable()) { enc.setProvider(new BouncyCastleProvider()); enc.setAlgorithm("PBEWITHSHA256AND128BITAES-CBC-BC"); } else // US export restrictions enc.setAlgorithm("PBEWITHMD5ANDDES"); result = new CryptImpl(enc); s.setAttribute(ICRYPT_ATTR_NAME, result); return result; } }
protected ICrypt getEncrypterFromSession(HttpSession s) { ICrypt result = (ICrypt) s.getAttribute(ICRYPT_ATTR_NAME); if (result !=null) return result; GeoServerSecurityManager manager = GeoServerApplication.get().getSecurityManager(); char[] key = manager.getRandomPassworddProvider().getRandomPasswordWithDefaultLength(); StandardPBEByteEncryptor enc = new StandardPBEByteEncryptor(); enc.setPasswordCharArray(key); // since the password is copied, we can scramble it manager.disposePassword(key); if (manager.isStrongEncryptionAvailable()) { enc.setProvider(new BouncyCastleProvider()); enc.setAlgorithm("PBEWITHSHA256AND128BITAES-CBC-BC"); } else // US export restrictions enc.setAlgorithm("PBEWITHMD5ANDDES"); result= new CryptImpl(enc); s.setAttribute(ICRYPT_ATTR_NAME, result); return result; } }
/** * Encode the password * @param passwd * @return */ byte[] encode(char[] passwd) { if (!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); } }