Examples of BASE64Encoder


Examples of sun.misc.BASE64Encoder

    }

    private String base64EncodePolicy(JsonElement jsonElement) throws UnsupportedEncodingException
    {
        String policyJsonStr = jsonElement.toString();
        String base64Encoded = (new BASE64Encoder()).encode(policyJsonStr.getBytes("UTF-8")).replaceAll("\n","").replaceAll("\r", "");

        return base64Encoded;
    }
View Full Code Here

Examples of sun.misc.BASE64Encoder

    private String sign(String toSign) throws UnsupportedEncodingException, NoSuchAlgorithmException, InvalidKeyException
    {
        Mac hmac = Mac.getInstance("HmacSHA1");
        hmac.init(new SecretKeySpec(AWS_SECRET_KEY.getBytes("UTF-8"), "HmacSHA1"));
        String signature = (new BASE64Encoder()).encode(hmac.doFinal(toSign.getBytes("UTF-8"))).replaceAll("\n", "");

        return signature;
    }
View Full Code Here

Examples of sun.misc.BASE64Encoder

           connection.disconnect();
       }

       //Authenticate
       connection = (HttpURLConnection) new URL("http://localhost:8080" + contextPath).openConnection();
       String authentication = (new BASE64Encoder()).encode(("alan:starcraft").getBytes());
       connection.setRequestProperty("Authorization", "Basic " + authentication);
       try {
           BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
           assertEquals(HttpURLConnection.HTTP_OK, connection.getResponseCode());
           assertEquals("Hello World", reader.readLine());
View Full Code Here

Examples of sun.misc.BASE64Encoder

    private final Log log;

    public YoutrackClient(String url, String project, String username, String password, Log log) {
        this.url = url;
        this.project = project;
        this.authorization = new BASE64Encoder().encode((username + ":" + password).getBytes());
        this.log = log;
    }
View Full Code Here

Examples of sun.misc.BASE64Encoder

      {
         SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
         random.setSeed(System.currentTimeMillis());
         byte bytes[] = new byte[32];
         random.nextBytes(bytes);
         BASE64Encoder encoder = new BASE64Encoder();
         return encoder.encode(bytes);
      }
      catch (NoSuchAlgorithmException e)
      {
         throw new AssertionError(e);
      }
View Full Code Here

Examples of sun.misc.BASE64Encoder

            // that gives us fragmented answers.
            conn.setRequestProperty("Connection", "close");
            // BASIC AUTH
            if (userPassword != null)
            {
                conn.setRequestProperty("Authorization", "Basic " + (new BASE64Encoder()).encode(userPassword.getBytes()));
            }
            // Read response
            InputStream is = null;
            if (conn.getResponseCode() == 200)
            {
View Full Code Here

Examples of sun.misc.BASE64Encoder

  public static byte[] decode(String pValue) throws IOException {
    return (new BASE64Decoder()).decodeBuffer(pValue);
  }

  public static String encode(byte[] pValue) {
    return (new BASE64Encoder()).encode(pValue);
  }
View Full Code Here

Examples of sun.misc.BASE64Encoder

        int first = (result[i] >> 4) & 0x0f;
        int second = result[i] & 0x0f;
        resultString += Character.valueOf(blah.charAt(first)) + Character.valueOf(blah.charAt(second)).toString();
      }
     
      BASE64Encoder be = new BASE64Encoder();
     
//      System.out.println(resultString);
      return be.encode((username + "\0" + resultString).getBytes());
 
View Full Code Here

Examples of sun.misc.BASE64Encoder

public class CipherUtil {

  private static final String ALGORITHM = "DES";
 
  public static String encrypt(String data, String file) throws Exception {
    return new BASE64Encoder().encode(encrypt(data.getBytes(), file));
  }
View Full Code Here

Examples of sun.misc.BASE64Encoder

        private void encryprtString(JTextArea textArea1, JTextArea textArea2,
                File keyFile, Encrypter encrypter) throws Exception {
            byte[] resultText = encrypter
                    .encrypt(textArea1.getText().getBytes(), keyFile);
            BASE64Encoder encoder = new BASE64Encoder();
            textArea2.setText(new String(encoder.encode(resultText)));
        }
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.