Package sun.misc

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


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

        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

    @Override
    public byte[] encrypt(byte[] clearText, File keyFile) {
        try {
            initKey();
            cipher.init(Cipher.ENCRYPT_MODE, skey, paramSpec);
            BASE64Encoder encoder = new BASE64Encoder();
            String saltString = encoder.encode(SALT);
            String cipherTextString = encoder.encode(cipher.doFinal(clearText));
            return (saltString + cipherTextString).getBytes();
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException(e.getMessage());
        }
View Full Code Here

        md = MessageDigest.getInstance("SHA"); //step 2
        md.update(plaintext.getBytes("UTF-8")); //step 3

        byte raw[] = md.digest(); //step 4
        String hash = (new BASE64Encoder()).encode(raw); //step 5
        return hash; //step 6
    }
View Full Code Here

        md = MessageDigest.getInstance("SHA"); //step 2
        md.update(plaintext.getBytes("UTF-8")); //step 3

        byte raw[] = md.digest(); //step 4
        String hash = (new BASE64Encoder()).encode(raw); //step 5
        return hash; //step 6
    }
View Full Code Here

    private void digest(String msg, MessageDigest digest) {
        System.out.println("Using alogrithm: " + digest.getAlgorithm());
        digest.reset();
        byte[] bytes = msg.getBytes();
        byte[] out = digest.digest(bytes);
        BASE64Encoder enc = new BASE64Encoder();
        System.out.println(enc.encode(out));
    }
View Full Code Here

        //TODO: Move this to the autoscale project
        File f = new File("/home/azeez/Desktop/axis2/payload.zip");
        try {
            byte[] bytes = getBytesFromFile(f);
            BASE64Encoder encoder = new BASE64Encoder();
            String userData = encoder.encode(bytes);
            data.setData(userData);
            System.out.println("Data=" + userData);
        } catch (IOException e) {
            e.printStackTrace();
        }
View Full Code Here

    public UserData getAppUserData() throws EC2Exception {
        UserData userData = new UserData();
        try {
            byte[] bytes = AutoscaleUtil.getBytesFromFile(new File(pApplicationPayload));
            BASE64Encoder encoder = new BASE64Encoder();
            String userDataStr = encoder.encode(bytes);
            userData.setData(userDataStr);
        } catch (IOException e) {
            autoscaleUtil.handleException("Cannot read data from payload file", e);
        }
        return userData;
View Full Code Here

    public UserData getLoadBalancerUserData() throws EC2Exception {
        UserData userData = new UserData();
        try {
            byte[] bytes = AutoscaleUtil.getBytesFromFile(new File(pLoadBalancerPayload));
            BASE64Encoder encoder = new BASE64Encoder();
            String userDataStr = encoder.encode(bytes);
            userData.setData(userDataStr);
        } catch (IOException e) {
            autoscaleUtil.handleException("Cannot read data from payload file", e);
        }
        return userData;
View Full Code Here

TOP

Related Classes of sun.misc.BASE64Encoder

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.