السلام عليكم
هذا الكود الذي عملته
و اسفه سبق و نزلت موضوع مشابه لكني ما صغت السؤال بشكل صحيح ، و ما قدرت اعدل ع الموضوع السابق
هذا الكود :
// Test AES Encryption and Decryption using JCrypto
// usage :
// java AESTest -gen KeyFile
// java AESTest -enc PlainFile CipherFile KeyFile
// java AESTest -dec CipherFile plainFile KeyFile
import com.sudancs.jcrypto.AESCipher ;
import com.sudancs.jFile.FileOperations ;
import java.security.Key ;
import java.io.IOException ;
public class AESTest {
public static void main (String[] args ) {
if ( args.length > 0 ) {
try {
if ( args[0].equals("-gen") ) {
AESCipher AES = new AESCipher("AES");
Key key = AES.getKey();
FileOperations.writeKeyToDisk( args[1] , key );
}
else if ( args[0].equals("-enc") ) {
Key key = FileOperations.readKeyFromDisk( args[3] ); // read key file
AESCipher AES = new AESCipher("AES",key);
byte[] plainText = FileOperations.readFromDisk( args[1] ) ; // read plain File
byte[] cipherText = AES.encrypt(plainText) ;
FileOperations.writeToDisk( args[2] , cipherText ) ; // write cipher file
}
else if ( args[0].equals("-dec") ) {
Key key = FileOperations.readKeyFromDisk( args[3] ); // read key file
AESCipher AES = new AESCipher("AES",key);
byte[] cipherText = FileOperations.readFromDisk( args[1] ) ; // read cipher File
byte[] plainText = AES.decrypt(cipherText) ;
FileOperations.writeToDisk( args[2] , plainText ) ; // write plain file
}
}
catch ( Exception ioe ) {
ioe.printStackTrace();
}
}
else
System.out.println("error in usage");
}
}انا اريد هذا الكود ان يستعرض ملف مشفر و مفتاح key جاهز عندي
و بالتالي يعطيني النص الاساسي بعد فك التشفير
يعني وظيفته باختصار decrypt
ما هو التعديل الذي يجب ان اضعه في هذا الكود حتى يتم التنفيذ
ارجو منكم الافاده يا اخوه و شكرا
