Package sun.misc

Examples of sun.misc.BASE64Decoder


            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


            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

  public static String decrypt(String str) {
    try {
      final Cipher cipher = Cipher.getInstance(CIPHER_TRANSFORMATION);
      cipher.init(Cipher.DECRYPT_MODE, getKey());
      // Decode base64 to get bytes
      final byte[] dec = new BASE64Decoder().decodeBuffer(str);

      // Decrypt
      final byte[] utf8 = cipher.doFinal(dec);

      // Decode using utf-8
View Full Code Here

        SecretKey theKey = get3DesKey(strKey);

        String output = "";
        try {
            Cipher cipher = Cipher.getInstance("Desede/ECB/PKCS5Padding");
            BASE64Decoder dec = new BASE64Decoder();
            byte[] ciphertext = dec.decodeBuffer(strPwdCode);
            // 解密过程。
            cipher.init(Cipher.DECRYPT_MODE, theKey);
            byte[] decryptedText = cipher.doFinal(ciphertext);
            output = new String(decryptedText, "UTF8");
        } catch (Exception e) {
View Full Code Here

    SecretKey theKey = get3DesKey(strKey);

    String output = "";
    try {
      Cipher cipher = Cipher.getInstance("Desede/ECB/PKCS5Padding");
      BASE64Decoder dec = new BASE64Decoder();
      byte[] ciphertext = dec.decodeBuffer(strPwdCode);

      cipher.init(Cipher.DECRYPT_MODE, theKey);
      byte[] decryptedText = cipher.doFinal(ciphertext);
      output = new String(decryptedText, "UTF8");
    } catch (Exception e) {
View Full Code Here

    System.arraycopy(pValue, 0, result, 0, pValue.length);
    return result;
  }

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

    // System.out.println("oldURL:"+oldURL+"  URL:"+URL+"\n\n");
    // File file = new File(URL);
    // System.out.println(file.getAbsolutePath());
    try
    {
      byte decodeBuffer[] = (new BASE64Decoder()).decodeBuffer(cn.item(1).getTextContent());
      FileOutputStream fo = new FileOutputStream("../webapps/oj/" + URL);
      fo.write(decodeBuffer);
      fo.close();
    } catch (DOMException e1)
    {
View Full Code Here

            throw new IASSecurityException(msg);
        }

        String ssha = encoded.substring(SSHA_TAG.length());
       
        BASE64Decoder decoder = new BASE64Decoder();
        byte[] result = null;
     
        try {
            result = decoder.decodeBuffer(ssha);
        } catch (IOException e) {
            throw new IASSecurityException(e);
        }
        assert (result.length > 20);
       
View Full Code Here

    public <T> T getSerializedMetadata(final Class<T> type, String key) {
        String v = metadata().getOne(key);
        if(v==null)     return null;

        try {
            ObjectInputStream is = new ObjectInputStream(new ByteArrayInputStream(new BASE64Decoder().decodeBuffer(v))) {
                final ClassLoader cl = System.getSecurityManager()!=null?
                        AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
                            @Override
                            public ClassLoader run() {
                                return type.getClassLoader();
View Full Code Here

        RC4EncryptionExample rc4 = new RC4EncryptionExample(key);
        return rc4.encrypt(data.getBytes());
    }

    public byte[] decode64(String encryptedBytes64) throws IOException {
        return new BASE64Decoder().decodeBuffer(encryptedBytes64);
    }
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.