Package sun.misc

Examples of sun.misc.BASE64Decoder.decodeBuffer()


        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


   */
  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);
   
View Full Code Here

  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

    this.url = savePath + "/" + this.fileName;
    BASE64Decoder decoder = new BASE64Decoder();
    try {
      File outFile = new File(this.getPhysicalPath(this.url));
      OutputStream ro = new FileOutputStream(outFile);
      byte[] b = decoder.decodeBuffer(base64Data);
      for (int i = 0; i < b.length; ++i) {
        if (b[i] < 0) {
          b[i] += 256;
        }
      }
View Full Code Here

    public static String getFromBASE64(String s) {
        if (s == null)
            return null;
        BASE64Decoder decoder = new BASE64Decoder();
        try {
            byte[] b = decoder.decodeBuffer(s);
            return new String(b);
        } catch (Exception e) {
            return null;
        }
    }
View Full Code Here

        //Get credentials from authourization header.
        if (authorization != null
                && authorization.toLowerCase().startsWith("basic ")) {
            authorization = authorization.substring(6).trim();
            BASE64Decoder decoder = new BASE64Decoder();
            byte[] bs = decoder.decodeBuffer(authorization);
            String decodedString = new String(bs);
            int ind = decodedString.indexOf(':');
            if (ind > 0) {
                username = decodedString.substring(0, ind);
                password = decodedString.substring(ind + 1);
View Full Code Here

      _solution = json.getString( "solution" );
      _path = json.getString( "path" );
      _file = json.getString( "file" );
      String p = json.getString( "params" );
      try {
        jsonParams = new JSONObject( new String( base64Decoder.decodeBuffer( p ) ) );
      } catch ( IOException e ) {
        logger.error( e );
        throw new JSONException( e );
      }
      JSONArray jsonUnbound = json.getJSONArray( "unbound" );
View Full Code Here

      }

      if ( json.has( "userData" ) ) {
        String u = json.getString( "userData" );
        try {
          jsonUserData = new JSONObject( new String( base64Decoder.decodeBuffer( u ) ) );
        } catch ( IOException e ) {
          logger.error( e );
          throw new JSONException( e );
        }
        String[] userDataKeys = JSONObject.getNames( jsonUserData );
View Full Code Here

  public String decrypt(String encryptedString) {
    String decryptedText = null;
    try {
      cipher.init(Cipher.DECRYPT_MODE, key);
      BASE64Decoder base64decoder = new BASE64Decoder();
      byte[] encryptedText = base64decoder.decodeBuffer(encryptedString);
      byte[] plainText = cipher.doFinal(encryptedText);
      decryptedText = bytes2String(plainText);
    } catch (Exception e) {
      e.printStackTrace();
    }
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.