/** * Decodes a base64 string into bytes. Newline characters found at block * boundaries will be ignored. * * @param encodedString * The string to decode. * @return The decoded byte array. */ public static byte[] decode(String encodedString) { return decode(encodedString.toCharArray()); }
/** * Decodes a base64 string into bytes. Newline characters found at block * boundaries will be ignored. * * @param encodedString * The string to decode. * @return The decoded byte array. */ public static byte[] decode(String encodedString) { return decode(encodedString.toCharArray()); }
/** * Encrypts a content string. * * @param algo * The cryptographic algorithm. * @param base64Secret * The cryptographic secret, encoded as a Base64 string. * @param content * The content string to encrypt. * @return The encrypted bytes. * @throws GeneralSecurityException */ public static byte[] encrypt(String algo, String base64Secret, String content) throws GeneralSecurityException { return encrypt(algo, Base64.decode(base64Secret), content); }
/** * Decrypts a bytes array. * * @param algo * The cryptographic algorithm. * @param base64Secret * The cryptographic secret key, encoded as a Base64 string. * @param encrypted * The encrypted bytes. * @return The decrypted content string. * @throws GeneralSecurityException */ public static String decrypt(String algo, String base64Secret, byte[] encrypted) throws GeneralSecurityException { return decrypt(algo, Base64.decode(base64Secret), encrypted); }
final byte[] encrypted = Base64.decode(cookieValue);
String serverKeyString = props.getProperty("server.key",null); if( null != serverKeyString ){ byte[] serverKey = Base64.decode(serverKeyString); atlasProps.setServerKey(serverKey);
@Override public void parseResponse(ChallengeResponse challenge, Request request, Series<Header> httpHeaders) { try { byte[] credentialsEncoded = Base64.decode(challenge.getRawValue()); if (credentialsEncoded == null) { getLogger() .info("Cannot decode credentials: " + challenge.getRawValue()); } String credentials = new String(credentialsEncoded, "ISO-8859-1"); int separator = credentials.indexOf(':'); if (separator == -1) { // Log the blocking getLogger().info( "Invalid credentials given by client with IP: " + ((request != null) ? request.getClientInfo() .getAddress() : "?")); } else { challenge.setIdentifier(credentials.substring(0, separator)); challenge.setSecret(credentials.substring(separator + 1)); } } catch (UnsupportedEncodingException e) { getLogger().log(Level.INFO, "Unsupported HTTP Basic encoding error", e); } catch (IllegalArgumentException e) { getLogger().log(Level.INFO, "Unable to decode the HTTP Basic credential", e); } }
HeaderConstants.HEADER_CONTENT_MD5)) { result.setDigest(new Digest(Digest.ALGORITHM_MD5, Base64 .decode(header.getValue()))); } else if (header.getName().equalsIgnoreCase( HeaderConstants.HEADER_CONTENT_DISPOSITION)) {
org.restlet.engine.util.Base64.decode(base64hash))); entityHeaderFound = true;