Examples of doFinal()


Examples of javax.crypto.Cipher.doFinal()

    SecretKey cipherKey = factory.generateSecret(keySpec);
    // Decode the secret
    byte[] encoding = Base64Utils.fromb64(secret);
    Cipher cipher = Cipher.getInstance(this.pbealgo);
    cipher.init(Cipher.DECRYPT_MODE, cipherKey, cipherSpec);
    byte[] decode = cipher.doFinal(encoding);
    return new String(decode).toCharArray();
  }
}
View Full Code Here

Examples of javax.crypto.Cipher.doFinal()

    Cipher cipher = Cipher.getInstance(DES);
    // ���ܳ׳�ʼ��Cipher����
    cipher.init(Cipher.ENCRYPT_MODE, securekey, sr);
    // ���ڣ���ȡ���ݲ�����
    // ��ʽִ�м��ܲ���
    return cipher.doFinal(src);
  }
 
  /**
   * ����
   * @param src  ����Դ
View Full Code Here

Examples of javax.crypto.Cipher.doFinal()

    Cipher cipher = Cipher.getInstance(DES);
    // ���ܳ׳�ʼ��Cipher����
    cipher.init(Cipher.DECRYPT_MODE, securekey, sr);
    // ���ڣ���ȡ���ݲ�����
    // ��ʽִ�н��ܲ���
    return cipher.doFinal(src);
  }
    /**
     * �������
     * @param data
     * @return
 
View Full Code Here

Examples of javax.crypto.Cipher.doFinal()

    Cipher cipher = Cipher.getInstance(DES);
    // ���ܳ׳�ʼ��Cipher����
    cipher.init(Cipher.ENCRYPT_MODE, securekey, sr);
    // ���ڣ���ȡ���ݲ�����
    // ��ʽִ�м��ܲ���
    return cipher.doFinal(src);
  }
 
  /**
   * ����
   * @param src  ����Դ
View Full Code Here

Examples of javax.crypto.Cipher.doFinal()

    Cipher cipher = Cipher.getInstance(DES);
    // ���ܳ׳�ʼ��Cipher����
    cipher.init(Cipher.DECRYPT_MODE, securekey, sr);
    // ���ڣ���ȡ���ݲ�����
    // ��ʽִ�н��ܲ���
    return cipher.doFinal(src);
  }
    /**
     * ���ݽ���
     * @param data
     * @param key ��Կ
View Full Code Here

Examples of javax.crypto.Cipher.doFinal()

   
      Cipher cipher = Cipher.getInstance( PBE_ALG );
     
      cipher.init(Cipher.ENCRYPT_MODE, key, paramSpec);
 
      byte[]  enc = cipher.doFinal( data );
     
      byte[]  res = new byte[salt.length + enc.length];
     
      System.arraycopy( salt, 0, res, 0, salt.length );
     
View Full Code Here

Examples of javax.crypto.Cipher.doFinal()

     
      cipher.init(Cipher.DECRYPT_MODE, key, paramSpec);
 
      fail_is_pw_error = true;
     
      return( cipher.doFinal( data, 8, data.length-8 ));
     
    }catch( Throwable e ){
     
      if ( fail_is_pw_error ){
       
View Full Code Here

Examples of javax.crypto.Cipher.doFinal()

      try{
        Cipher  rsa_cipher = Cipher.getInstance( "RSA" );
       
        rsa_cipher.init( Cipher.ENCRYPT_MODE, public_key );
       
        encryped_session_key = rsa_cipher.doFinal( secret_bytes );
       
      }catch( Throwable e ){
       
          // fallback to the BC implementation for jdk1.4.2 as JCE RSA not available
       
View Full Code Here

Examples of javax.crypto.Cipher.doFinal()

       
      Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding");
     
      cipher.init(Cipher.ENCRYPT_MODE, session_key );
 
      byte[]  encrypted_message = cipher.doFinal( message_bytes );
 
      secure_payload.put( "ver", "1" );
      secure_payload.put( "alg", "DESede" );
      secure_payload.put( "key", encryped_session_key );
      secure_payload.put( "content", encrypted_message );
View Full Code Here

Examples of javax.crypto.Cipher.doFinal()

    try{
      Cipher cipher = Cipher.getInstance("DESede/ECB/PKCS5Padding");
     
      cipher.init(Cipher.DECRYPT_MODE, session_key );
 
      byte[]  message_bytes = cipher.doFinal( encrypted_message );
 
      Map plain_payload = StaticUtilities.getFormatters().bDecode( message_bytes );

      return( plain_payload );
     
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.