Package sun.misc

Examples of sun.misc.BASE64Decoder


      @FormDataParam("url") String url) {
    Plugin plugin = null;
    boolean error = false;
    if(file != null) {
      String content = file.substring(file.indexOf(',') + 1);
      BASE64Decoder decoder = new BASE64Decoder();
      try {
        byte[] decodedBytes = decoder.decodeBuffer(content);
        try {
          plugin = plugins.add(name, decodedBytes);
        } catch (CrawljaxWebException e) {
          LogWebSocketServlet.sendToAll("message-error-" + e.getMessage());
          error = true;
View Full Code Here


        if (header == null) {
            return false;
        }

        final String encoded = header.substring(header.indexOf(" ") + 1);
        byte[] credentials = new BASE64Decoder().decodeBuffer(encoded);
        for (AuthenticationService service : authenticationService) {
            if (service.hasAccess(method, credentials)) {
                return true;
            }
        }
View Full Code Here

  static Pattern sessionDataParser = Pattern.compile("\u0000([^:]*):([^\u0000]*)\u0000");
  public static Map decode(String sessionData) {
    ObjectInputStream ois;
    try {
      ois = new ObjectInputStream(new ByteArrayInputStream(new BASE64Decoder().decodeBuffer(sessionData)));
      return (Map)ois.readObject();
    } catch (UnsupportedEncodingException e) {
      throw new RuntimeException("decode session data error:UnsupportedEncodingException",e);
    } catch (IOException e) {
      throw new RuntimeException("decode session data error:IOException",e);
View Full Code Here

        // since encoded string cannot have space in it so we are completely
        // safe.
        encryptedString = encryptedString.replace(' ', '+');
        SecretKey key = getSecretKey(commonKey);
        cipher.init(Cipher.DECRYPT_MODE, key);
        byte[] recoveredBytes = cipher.doFinal(new BASE64Decoder()
                .decodeBuffer(encryptedString));
        decryptedValue = new String(recoveredBytes);
        return decryptedValue;
    }
View Full Code Here

    return new BASE64Encoder().encode(data);
  }

  public static byte[] decodeBase64(String base64Data) {
    try {
      return new BASE64Decoder().decodeBuffer(base64Pad(base64Data));
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

    for (BlockFace face : BlockFace.values())
      if (face.toString().equalsIgnoreCase(arr[1])) facing = face;

        //Parse lines
        if (arr.length != 3) return;
        BASE64Decoder decoder = new BASE64Decoder();
        List<String> decoded = new ArrayList<String>();
        String[] encLines = arr[2].split(",");
        for (int i = 0; i < encLines.length; i++) {
          try {
            decoded.add(new String(decoder.decodeBuffer(encLines[i])));
          } catch (IOException e) {
            Util.severe("Unable to decode sign data from database");
          }
        }
        lines = decoded.toArray(new String[0]);
View Full Code Here

  /** Converts the string <code>pValue</code> into a
   * base64 encoded byte array.
   */
  public static byte[] decode(String pValue) throws IOException {
    return (new BASE64Decoder()).decodeBuffer(pValue);
  }
View Full Code Here

    boolean result =false;
    FileOutputStream fos =  null;
    try{
      fos = new FileOutputStream(path,append);
     
      new BASE64Decoder().decodeBuffer(is, fos);
      result = true;
    }
    catch(IOException e)
    {
      throw new ResourceAccessFailed();
View Full Code Here

   * @param pubModulus
   * @param pubExponent
   * @throws Exception
   */
  private RSAHelper(String pubModulus, String pubExponent) throws Exception {
    BASE64Decoder base64Decoder = new BASE64Decoder();
   
    // 创建公钥
    byte[] exponentBuf = base64Decoder.decodeBuffer(pubExponent);
    byte[] modulusBuf = base64Decoder.decodeBuffer(pubModulus);
    BigInteger big_exponent = new BigInteger(1, exponentBuf);
    BigInteger big_modulus = new BigInteger(1, modulusBuf);
    RSAPublicKeySpec keyspec = new RSAPublicKeySpec(big_modulus, big_exponent);
   
    KeyFactory keyfac = KeyFactory.getInstance("RSA");
View Full Code Here

            sha1.reset();
            byte[] p2 = sha1.digest(p);

            sha1.reset();
            BASE64Decoder decoder = new BASE64Decoder();
            sha1.update(decoder.decodeBuffer(salt), 0, 20);
            sha1.update(p2);
            byte[] scramble = sha1.digest();
            for (int i = 0, e = 20; i < e; i++) {
                p[i] ^= scramble[i];
            }
View Full Code Here

TOP

Related Classes of sun.misc.BASE64Decoder

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.