Package org.apache.commons.codec.binary

Examples of org.apache.commons.codec.binary.Base64.decode()


                if (logger.isDebugEnabled()) {
                    logger.debug("Header found : "+auth);
                }
                auth = auth.substring(6).trim();
                Base64 decoder = new Base64();
                String cred = new String(decoder.decode(auth.getBytes("UTF-8")));
                int colonInd = cred.indexOf(':');
                String user = cred.substring(0,colonInd);
                String pass = cred.substring(colonInd+1);

                JahiaUser jahiaUser = ServicesRegistry.getInstance().getJahiaUserManagerService().lookupUser(user);
View Full Code Here


  public static byte[] decodeBase64(String str)
  {
    try
    {
      Base64 decoder = new Base64();
        return decoder.decode(str.getBytes());
    }
    catch (Exception e)
    {
      return new byte[0];
    }
View Full Code Here

        Base64 base64 = new Base64();
        byte[] byteData = null;

        try {
            byteData = base64.decode(string.getBytes());

        } catch (Throwable t) {
            String message =
                "error occurred Base64 decoding: " + string + " : " + t;
            throw new IOException(message);
View Full Code Here

                if (authscheme.equalsIgnoreCase("basic")) {
                    String s = auth.substring(i + 1).trim();
                    byte[] credsRaw = s.getBytes(HTTP.ASCII);
                    BinaryDecoder codec = new Base64();
                    try {
                        String creds = new String(codec.decode(credsRaw), HTTP.ASCII);
                        context.setAttribute("proxy-creds", creds);
                    } catch (DecoderException ex) {
                        throw new ProtocolException("Malformed BASIC credentials");
                    }
                }
View Full Code Here

    Base64 coder;
    key = new SecretKeySpec(secret.getBytes(), "AES");
    try {
      cipher = Cipher.getInstance("AES/ECB/PKCS5Padding", "SunJCE");
      coder = new Base64();
      byte[] encrypted = coder.decode(repoUserPassword.getBytes());
      cipher.init(Cipher.DECRYPT_MODE, key);
      byte[] decrypted = cipher.doFinal(encrypted);
      decryptPassword = new String(decrypted);
    } catch (Exception e) {
      e.printStackTrace();
View Full Code Here

        Base64 base64 = new Base64();
        byte[] byteData = null;

        try {
            byteData = base64.decode(string.getBytes());

        } catch (Throwable t) {
            String message =
                "error occurred Base64 decoding: " + string + " : " + t;
            throw new IOException(message);
View Full Code Here

      output.write(line);
    }   
   
    Base64 base64 = new Base64();
      byte[] encoded = base64.encode(output.toByteArray());
    ByteArrayInputStream bi = new ByteArrayInputStream(base64.decode(encoded));
   
    File f = new File("info-out.png");
    if (f.exists()) f.delete();
    f.createNewFile();
    FileOutputStream fo = new FileOutputStream(f);   
View Full Code Here

            _name = data[0];

            byte[] encoded_password = data[1].getBytes(DEFAULT_ENCODING);

            Base64 b64 = new Base64();
            byte[] decoded = b64.decode(encoded_password);

            _encodedPassword = encoded_password;

            _password = new char[decoded.length];
View Full Code Here

        _name = data[0];

        byte[] encoded_password = data[1].getBytes(Base64MD5PasswordFilePrincipalDatabase.DEFAULT_ENCODING);

        Base64 b64 = new Base64();
        byte[] decoded = b64.decode(encoded_password);

        _encodedPassword = encoded_password;

        _password = new char[decoded.length];
View Full Code Here

        {
            throw new RuntimeException("MD5 encoding not supported, even though the Java standard requires it",e);
        }

        Base64 b64 = new Base64();
        byte[] decoded = b64.decode(encoded_password);

        _encodedPassword = encoded_password;

        _password = new char[decoded.length];
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.