Package sun.misc

Examples of sun.misc.BASE64Decoder


            textArea2.setText(new String(encoder.encode(resultText)));
        }

        private void decryprtString(JTextArea textArea1, JTextArea textArea2,
                File keyFile, Encrypter encrypter) throws Exception {
            BASE64Decoder decoder = new BASE64Decoder();
            byte[] clearText = decoder.decodeBuffer(textArea1.getText());
            byte[] resultText = encrypter.decrypt(clearText, keyFile);
            textArea2.setText(new String(resultText, Encrypter.ENCODING));

        }
View Full Code Here


    public byte[] decrypt(byte[] cipherByte, File keyFile) {
        try {
            String text = new String(cipherByte);
            String saltString = text.substring(0, 12);
            String cipherText = text.substring(12, text.length());
            BASE64Decoder decoder = new BASE64Decoder();
            byte[] saltArray = decoder.decodeBuffer(saltString);
            byte[] cipherTextArray = decoder.decodeBuffer(cipherText);
            char[] passwordChar = password.toCharArray();

            // Create the PBEKeySpec with the given password
            PBEKeySpec keySpec = new PBEKeySpec(passwordChar);
View Full Code Here

        try {
            byte[] cipherByte = readByte(new File(inputFile));
            String text = new String(cipherByte);
            String saltString = text.substring(0, 12);
            String cipherText = text.substring(12, text.length());
            BASE64Decoder decoder = new BASE64Decoder();
            byte[] saltArray = decoder.decodeBuffer(saltString);
            byte[] cipherTextArray = decoder.decodeBuffer(cipherText);
            char[] passwordChar = password.toCharArray();

            // Create the PBEKeySpec with the given password
            PBEKeySpec keySpec = new PBEKeySpec(passwordChar);
View Full Code Here

            return false;
        }
        // Get encoded user and password, comes after "BASIC "
        String userpassEncoded = authHeader.substring( 6 );

        BASE64Decoder dec = new BASE64Decoder();
        String userpassDecoded = new String( dec.decodeBuffer( userpassEncoded ) );
        int idx = userpassDecoded.indexOf( ':' );

        if ( idx == -1 )
        {
            return false;
View Full Code Here

                        String username = usernamePropertySet.get(usernamePropertySet.size()-1);

                        List<String> passwordPropertySet = resource.getPropertyValues(IssueTrackerConstants.ACCOUNT_PASSWORD);
                        String encryptedPassword = passwordPropertySet.get(passwordPropertySet.size()-1);

                        byte[] base64DecodedBytes = (new BASE64Decoder()).decodeBuffer(encryptedPassword);

                        String password = new String(CryptoUtil.getDefaultCryptoUtil().decrypt(base64DecodedBytes));


                        String isAutoReportingEnabled = resource.getProperty(IssueTrackerConstants.AUTO_REPORTING);
View Full Code Here

  }

    public byte[] readDecodedBytes(String name) throws IOException {
    char[] ba = readWrappedBody(name);
    int n = ba.length;
    return new BASE64Decoder().decodeBuffer(new String(ba, 0, n));
  }
View Full Code Here

            case BASE64:
                if (log.isDebugEnabled()) {
                    log.debug("base64 decoding on input  ");
                }
                decodedInputStream = new ByteArrayInputStream(
                         new BASE64Decoder().decodeBuffer(inputStream));
                break;
            case BIGINTEGER16:
                if (log.isDebugEnabled()) {
                    log.debug("BigInteger 16 encoding on output ");
                }
View Full Code Here

        if (privateKey == null) {
            handleException("Error private key can not be null ");
        }

        try {
            decrypted= cipher.doFinal(new BASE64Decoder().decodeBuffer(encryptedPassword));
        } catch (Exception e) {
            handleException("Error occurred when decrypting encrypted value");
        }
        return new String(decrypted);
    }
View Full Code Here

     * @param str
     * @return @throws
     *         IOException
     */
    public String decrypt(String str) throws IOException {
        byte[] inputBytes = new BASE64Decoder().decodeBuffer(str);// The input
        // text bytes.
        byte[] clearBytes = new byte[inputBytes.length]; // The decrypted bytes.
        for (int i = 0; i < inputBytes.length; i += 8) {
            cipher.decrypt(inputBytes, i, clearBytes, i);
        }
View Full Code Here

            return "";
        }       
    }

    public static String decodeString(String encryptedPwd) {
        BASE64Decoder decoder = new BASE64Decoder() ;
       
        try {       
            byte[] passwordBytes =
                decoder.decodeBuffer(encryptedPwd);
            Cipher cipher = Cipher.getInstance("DES");
            cipher.init(Cipher.DECRYPT_MODE, key);
            passwordBytes = cipher.doFinal(passwordBytes);
            return new String (passwordBytes, "UTF8");
        }
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.