| 
	
		|  Autor | Tema: Reto: descifrar archivo  (Leído 6,803 veces) |  
	| 
			| 
					
						| deurus 
								
								 Desconectado 
								Mensajes: 4
								
								
								
								
								
								   | 
 
Haber si alguien me puede ayudar con esto. Tengo un fichero cifrado y ya que no estoy muy familiarizado con Java me gustaría que alguien me echara una mano. 
 Si alguien se anima le mando lo que tengo por email ya que supongo que teniendo los datos de cifrado, contruir un desencriptador será facilillo. Si quieres los archivos ponte en contacto conmigo.
 
 Un saludo y gracias
 
 Esto es un resumen de lo que tengo:
 
 cifrado
 ------------
 Tipo: PBEWithMD5AndDES
 iterationCount = 19;
 byte salt[] = {-87, -101, -56, 50, 86, 53, -29, 3 };
 decryptPassword = "ESI";
 
 -----------------
 Cargar demos.java
 -----------------
 try
 {
 stream = Application1.crypto.decrypt((java.lang.Object.class).getResourceAsStream("/project/modulo" + demos.substring(6, demos.length() - 4) + ".xml"));
 if(stream != null)
 {
 demosAMostrar = demosAMostrar + demos.substring(6, demos.length() - 4) + ";";
 stream.close();
 }
 }
 catch(Exception e)
 {
 e.printStackTrace();
 }
 }
 
 -----------------------------
 Crypto.java (solo el decrypt)
 ----------- -----------------
 
 public InputStream decrypt(InputStream in)
 {
 if(AccederADatos.leer("h.desencriptarModulos").compareToIgnoreCase("S\355") == 0) //a omitir
 try
 {
 in = new CipherInputStream(in, dcipher);
 }
 catch(Exception e)
 {
 e.printStackTrace();
 }
 return in;
 }
 
 -----------------
 Application1.java
 -----------------
 static
 {
 crypto = new Crypto(AccederADatos.decryptPassword);
 }
 
 ------------
 Applet1.java
 ------------
 
 AccederADatos.decryptPassword = "ESI";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 |  
						| 
								|  |  
								| « Última modificación:  6 Septiembre 2011, 22:54 pm por deurus » |  En línea | 
 
 |  |  |  | 
			| 
					
						| deurus 
								
								 Desconectado 
								Mensajes: 4
								
								
								
								
								
								   | 
 
Me he construido un desencriptador pero todavía falla algo, alguien ve por que falla el código???
 import java.io.*;
 import java.security.*;
 import javax.crypto.*;
 import javax.crypto.spec.*;
 import java.util.*;
 
 public class FileDecryptor_custom
 {
 private static String filename;
 private static String password;
 private static FileInputStream inFile;
 private static FileOutputStream outFile;
 //-----
 //bufi = new byte[1024];
 //m_buffer = new byte[10240];
 
 /**
 * Note: All kinds of exceptions can be thrown in main.
 * See the API documentation for each method used.
 */
 
 public static void main(String[] args) throws Exception
 {
 
 // File to decrypt.
 
 filename = "modulo1.xml";
 
 String password = "ESI";
 
 inFile = new FileInputStream(filename);
 outFile = new FileOutputStream(filename + "_decrypted");
 
 PBEKeySpec keySpec = new PBEKeySpec(password.toCharArray());
 SecretKeyFactory keyFactory =  SecretKeyFactory.getInstance("PBEWithMD5AndDES");
 SecretKey passwordKey = keyFactory.generateSecret(keySpec);
 
 // Read in the previouly stored salt and set the iteration count.
 
 // 8-byte Salt
 byte[] salt = {
 (byte)0xA9, (byte)0x9B, (byte)0xC8, (byte)0x32,
 (byte)0x56, (byte)0x35, (byte)0xE3, (byte)0x03
 };
 inFile.read(salt);
 int iterations = 19;
 
 PBEParameterSpec parameterSpec = new PBEParameterSpec(salt, iterations);
 // Create the cipher and initialize it for decryption.
 Cipher cipher = Cipher.getInstance("PBEWithMD5AndDES");
 cipher.init(Cipher.DECRYPT_MODE, passwordKey, parameterSpec);
 
 //byte[] input = new byte[64];
 byte[] input = new byte[10240];
 int bytesRead;
 while ((bytesRead = inFile.read(input)) != -1)
 //while ((bytesRead = inFile.read(input)) > -1)
 {
 byte[] output = cipher.update(input, 0, bytesRead);
 //byte[] output = cipher.update(input, 0, bytesRead);
 if (output != null)
 outFile.write(output);
 }
 
 byte[] output = cipher.doFinal();
 if (output != null)
 outFile.write(output);
 
 inFile.close();
 outFile.flush();
 outFile.close();
 }
 }
 
 
 |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  | 
			| 
					
						| deurus 
								
								 Desconectado 
								Mensajes: 4
								
								
								
								
								
								   | 
 
Para el que le interese, los archivos se encuentran aquí : |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  | 
			| 
					
						| deurus 
								
								 Desconectado 
								Mensajes: 4
								
								
								
								
								
								   | 
 
Reto superado. Para el que le interese aquí tiene el enlace del como se hizo con todos los archivos.http://ul.to/94hfrf0c |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  |  |  
 
	
 
 
				
					
						| Mensajes similares |  
						|  | Asunto | Iniciado por | Respuestas | Vistas | Último mensaje |  
						|   |   | Reto: puedes descifrar esta pequeña funcion Php??
							« 1 2 » PHP
 | PanConMantequilla | 12 | 7,299 |  6 Agosto 2010, 04:03 am por Castg!
 |  
						|   |   | descifrar un archivo Desafíos - Wargames
 | Potato | 1 | 4,216 |  7 Junio 2012, 19:10 pm por reagea
 |  
						|   |   | Descifrar el archivo config_dsl.bin de Livebox Hacking Wireless
 | Decay | 0 | 4,105 |  8 Agosto 2012, 12:58 pm por Decay
 |  
						|   |   | Descifrar archivo .db.crypt Seguridad
 | spectrum72 | 2 | 8,174 |  16 Agosto 2012, 16:14 pm por spectrum72
 |  
						|   |   | [Reto] Descifrar swf Seguridad
 | MeCraniDOS | 7 | 5,033 |  25 Junio 2013, 12:34 pm por MeCraniDOS
 |    |