Package org.apache.commons.codec.binary

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


        // TODO find a way to avoid decoding each time, maybe context listener

        byte[] iv = null;

        if (_iv != null)
            iv = base64.decode(_iv.getBytes());

        if(_cache != null && "false".equals(_cache)){
           
            // secret will have to be decoded and SecretKey will have to
            // be generated
View Full Code Here


        if(_cache != null && "false".equals(_cache)){
           
            // secret will have to be decoded and SecretKey will have to
            // be generated
           
            byte[] secret = base64.decode(_secret.getBytes());
           
            return symmetric(data, secret, _algorithm, _algorithmParams, iv, mode);
           
        }else{
           
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

            KerberosAuthenticator.NEGOTIATE + "' :  {}", authorization);
      }
    } else {
      authorization = authorization.substring(KerberosAuthenticator.NEGOTIATE.length()).trim();
      final Base64 base64 = new Base64(0);
      final byte[] clientToken = base64.decode(authorization);
      Subject serverSubject = loginContext.getSubject();
      try {
        token = Subject.doAs(serverSubject, new PrivilegedExceptionAction<AuthenticationToken>() {

          @Override
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

  }
 
  public static byte[] base64Decode(byte[] content)
  {
    Base64 base64 = new Base64();
    return base64.decode(content);
  }
 
  public static String getMimeType(String fileName) throws java.io.IOException
  {
    FileNameMap fileNameMap = URLConnection.getFileNameMap();
View Full Code Here

                Decoder dec = new Base64();
                String usernamePassword = "";

                try
                {
                    usernamePassword = new String( (byte[]) dec.decode( auth.substring( 6 ).getBytes() ) );
                }
                catch ( DecoderException ie )
                {
                    log.warn( "Error decoding username and password.", ie.getMessage() );
                }
View Full Code Here

                Decoder dec = new Base64();
                String usernamePassword = "";

                try
                {
                    usernamePassword = new String( (byte[]) dec.decode( auth.substring( 6 ).getBytes() ) );
                }
                catch ( DecoderException ie )
                {
                    log.warn( "Error decoding username and password.", ie.getMessage() );
                }
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();
View Full Code Here

        byte[] buffer = new byte[1024];
        while (stream.read(buffer) != -1) {
            bo.write(buffer);
        }
        return new ByteArrayInputStream(base64.decode(bo.toByteArray()));
    }

    private <T extends Element> Document<T> getEntry(InputStream stream, RequestContext request) throws ParseException,
        IOException {
        Parser parser = request.getAbdera().getParser();
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.