Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2008

Tip: Looking for answers? Try searching our database.

simple brute force code to crack AES

Thread view: 
polaris - 02 Apr 2008 19:31 GMT
hi
I should write a code to break AES encryption. I have the key in file
but its not complete so i have to guess the missing right most 16-
bits
out of 128-bits. I don't know how to treat the key at the level of
bit
where i get it as SecretKey. This is my code:

ObjectInputStream in = new ObjectInputStream(new
FileInputStream("SecretKey.ser"));
SecretKey key = (SecretKey)in.readObject();
byte[] raw = key.getEncoded();
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");

how can i make a for loop to move over all possible key values.

please help
Roedy Green - 02 Apr 2008 21:39 GMT
On Wed, 2 Apr 2008 11:31:01 -0700 (PDT), polaris
<smarto59@hotmail.com> wrote, quoted or indirectly quoted someone who
said :

>how can i make a for loop to move over all possible key values.
see http://mindprod.com/jgloss/combination.html
Signature


Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Arne Vajhøj - 09 Apr 2008 02:43 GMT
> I should write a code to break AES encryption. I have the key in file
> but its not complete so i have to guess the missing right most 16-
[quoted text clipped - 10 lines]
>
> how can i make a for loop to move over all possible key values.

Try:

for(int i = 0; i < 256; i++) {
   raw[14] = (byte)i;
   for(int j = 0; j < 256; j++) {
      raw[15] = (byte)j;
      // test raw
   }
}

assuming you really have the first 112 bits and only miss the
last 16 bit of raw.

Arne


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.