Examples of Base64Encoder


Examples of sun.misc.BASE64Encoder

    @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

Examples of sun.misc.BASE64Encoder

        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

Examples of sun.misc.BASE64Encoder

        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

Examples of sun.misc.BASE64Encoder

    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

Examples of sun.misc.BASE64Encoder

        //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

Examples of sun.misc.BASE64Encoder

    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

Examples of sun.misc.BASE64Encoder

    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

Examples of sun.misc.BASE64Encoder

        switch (encodingType) {
            case BASE64:
                if (log.isDebugEnabled()) {
                    log.debug("base64 encoding on output ");
                }
                return new BASE64Encoder().encode(baos.toByteArray()).getBytes();
            case BIGINTEGER16:
                if (log.isDebugEnabled()) {
                    log.debug("BigInteger 16 encoding on output ");
                }
                return new BigInteger(baos.toByteArray()).toByteArray();
View Full Code Here

Examples of sun.misc.BASE64Encoder

        System.arraycopy(str.getBytes(), 0, inputBytes, 0,
                str.getBytes().length);
        for (int i = 0; i < padlength; i += 8) {
            cipher.encrypt(inputBytes, i, cryptBytes, i);
        }
        return new BASE64Encoder().encode(cryptBytes);
    }
View Full Code Here

Examples of sun.misc.BASE64Encoder

            return null;
        }              
    }

    public static String encodeString(String plainTextPassword) {
        BASE64Encoder encoder = new BASE64Encoder();
         try {
            byte[] cleartext = plainTextPassword.getBytes("UTF8");     
            Cipher cipher = Cipher.getInstance("DES");
            cipher.init(Cipher.ENCRYPT_MODE, key);
            return encoder.encode(cipher.doFinal(cleartext));
        }
        catch (Exception e) {
            e.printStackTrace();
            return "";
        }       
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.