/** * Decodes a byte[] containing containing * characters in the Base64 alphabet. * * @param pArray A byte array containing Base64 character data * @return a byte array containing binary data */ public byte[] decode(final byte[] pArray) { return decodeBase64(pArray); }
/** * Decodes a byte[] containing containing * characters in the Base64 alphabet. * * @param pArray A byte array containing Base64 character data * @return a byte array containing binary data */ public byte[] decode(final byte[] pArray) { return decodeBase64(pArray); }
/** * Decodes a byte[] containing containing * characters in the Base64 alphabet. * * @param pArray A byte array containing Base64 character data * @return a byte array containing binary data */ public byte[] decode(byte[] pArray) { return decodeBase64(pArray); }
private Object deserializeObject(String serializedValue) { try { byte[] bytes = Base64.decodeBase64(serializedValue.getBytes()); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); ObjectInputStream in = new ObjectInputStream(bais); return in.readObject(); } catch (Exception e) { throw new RuntimeException(e); } }
/** * @see PasswordCipher#decrypt(char[]) * @throws RuntimeException * in any case of error. */ public String decrypt(char[] encodedPassword) { if ((null == encodedPassword) || encodedPassword.length == 0) { throw new IllegalArgumentException("encodedPassword cannot be null nor empty."); } try { byte[] cipherText = Base64.decodeBase64( String.valueOf(encodedPassword).getBytes()); // Get a 3DES Cipher object Cipher cipher = Cipher.getInstance(TRANSFORMATION); // Set it into decryption mode cipher.init(Cipher.DECRYPT_MODE, KEY); // Decrypt data String plainText = new String(cipher.doFinal(cipherText)); return plainText; } catch (Exception e) { throw new RuntimeException(e); } }
/** * @throws RuntimeException in any case of error. * @see org.apache.openejb.cipher.PasswordCipher#decrypt(char[]) */ public String decrypt(final char[] encodedPassword) { if (null == encodedPassword || encodedPassword.length == 0) { throw new IllegalArgumentException("encodedPassword cannot be null nor empty."); } try { final byte[] cipherText = Base64.decodeBase64( String.valueOf(encodedPassword).getBytes()); // Get a 3DES Cipher object final Cipher cipher = Cipher.getInstance(TRANSFORMATION); // Set it into decryption mode cipher.init(Cipher.DECRYPT_MODE, KEY); // Decrypt data return new String(cipher.doFinal(cipherText)); } catch (final Exception e) { throw new OpenEJBRuntimeException(e); } }
/** * @throws RuntimeException in any case of error. * @see org.apache.openejb.cipher.PasswordCipher#decrypt(char[]) */ public String decrypt(final char[] encodedPassword) { if (null == encodedPassword || encodedPassword.length == 0) { throw new IllegalArgumentException("encodedPassword cannot be null nor empty."); } try { final byte[] cipherText = Base64.decodeBase64( String.valueOf(encodedPassword).getBytes()); // Get a 3DES Cipher object final Cipher cipher = Cipher.getInstance(TRANSFORMATION); // Set it into decryption mode cipher.init(Cipher.DECRYPT_MODE, KEY); // Decrypt data return new String(cipher.doFinal(cipherText)); } catch (final Exception e) { throw new OpenEJBRuntimeException(e); } }
if (auth.toUpperCase().startsWith("BASIC ")) { auth = auth.substring(6); String decoded = new String(Base64.decodeBase64(auth.getBytes())); String[] parts = decoded.split(":"); if (parts != null && parts.length == 2) {
if (auth.toUpperCase().startsWith("BASIC ")) { auth = auth.substring(6); final String decoded = new String(Base64.decodeBase64(auth.getBytes())); final String[] parts = decoded.split(":"); if (parts.length == 2) {
if (auth.toUpperCase(Locale.ENGLISH).startsWith("BASIC ")) { auth = auth.substring(6); final String decoded = new String(Base64.decodeBase64(auth.getBytes())); final String[] parts = decoded.split(":"); if (parts.length == 2) {