Package org.apache.commons.codec.binary

Examples of org.apache.commons.codec.binary.Base64


        {
            _iv = ctx.getInitParameter(INIT_ALGORITHM_IV.toLowerCase());
        }
       
        if (_iv != null)
            iv = new Base64().decode(_iv.getBytes());
       
        return iv;
    }
View Full Code Here


                    log.debug("generated random password of length " + length);
            }
        }
        else
        {
            bytes = new Base64().decode(secret.getBytes());
        }
       
        return bytes;
    }
View Full Code Here

                    log.debug("generated random mac password of length " + length);
            }
        }
        else
        {
            bytes = new Base64().decode(secret.getBytes());
        }
       
        return bytes;
    }
View Full Code Here

    }
    return false;
  }
 
  private InputStream getDataInputStream(InputStream stream) throws IOException {
    Base64 base64 = new Base64();
    ByteArrayOutputStream bo = new ByteArrayOutputStream();
   
    byte[] buffer = new byte[1024];
    while (stream.read(buffer) != -1) {
      bo.write(buffer);
    }
    return new ByteArrayInputStream(base64.decode(bo.toByteArray()));
  }
View Full Code Here

        if (authStr == null || !authStr.startsWith("Basic ")) {
            return null;
        }
        final String digest = authStr.substring(6);

        final String userAndPassword = new String(new Base64().decode(digest.getBytes()));
        final Matcher matcher = USER_AND_PASSWORD_REGEX.matcher(userAndPassword);
        if (!matcher.matches()) {
            return null;
        }
View Full Code Here

            }
        }

        if(_username != null)
        {
            String encoded = new String(new Base64().encode((_username + ":" + _password).getBytes()));
            httpCon.setRequestProperty("Authorization", "Basic " + encoded);
        }

        httpCon.setDoOutput(true);
        httpCon.setRequestMethod(method);
View Full Code Here

    }
    return m;
  }

  private static String toBase64(String rawString) {
    Base64 base64decoder = new Base64();
    return new String(base64decoder.encode(rawString.getBytes()));
  }
View Full Code Here

    Base64 base64decoder = new Base64();
    return new String(base64decoder.encode(rawString.getBytes()));
  }

  private static String fromBase64(String base64String) {
    Base64 base64decoder = new Base64();
    return new String(base64decoder.decode(base64String.getBytes()));
  }
View Full Code Here

        }
    }

    public static byte[] encode(byte[] bytes)
    {
        return new Base64().encode(bytes);
    }
View Full Code Here

        }
    }

    public static byte[] decode(byte[] bytes)
    {
        return new Base64().decode(bytes);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.codec.binary.Base64

Copyright © 2018 www.massapicom. 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.