1
$\begingroup$

I have a 16-byte ciphertext, 16-byte key, and 16-byte IV. The key and IV I was able to set myself, and all I know about the ciphertext is that when I decrypt it, it will be human-readable.

I have tried PyCrypto and OpenSSL methods to decrypt the ciphertext with no luck. This is leading me to believe that it may be a custom implementation of AES. My background is not in cryptography so please excuse my ignorance.

Is there a standard way to implement AES-128? Is it uncommon to implement your own version of AES? I'm familiar with the AES algorithm, and it seems like it would be possible to implement your own way of scrambling the bits in the individual rounds.

I also noticed the NIST gives out certifications to individual companies for their AES encryption (ie. Google, Cisco, HP, AWS, etc.). Is this because it's a custom implementation?

$\endgroup$
  • $\begingroup$ Who or what generated the cipher text? A simple answer you have to consider is that the thingie that created the cipher text doesn't work properly. Do you know categorically that it does? $\endgroup$ – Paul Uszak Jun 30 '17 at 20:41
  • 2
    $\begingroup$ what modes of operation have you tried? $\endgroup$ – Richie Frame Jul 1 '17 at 0:02
  • $\begingroup$ @PaulUszak I do know the program that created the cipher text works properly, and there is a method if decrypting the message. I have to implement my own way of decrypting the message. $\endgroup$ – Nick Jul 1 '17 at 14:59
  • $\begingroup$ @RichieFrame If by modes you mean AES modes, I have tried CBC, CFB, and OFB. $\endgroup$ – Nick Jul 1 '17 at 15:02
5
$\begingroup$

Is there a standard way to implement AES 128?

There are several implementation strategies to AES (SIMD-based, plain-C, table-based, side-channel resistant, bit-sliced, AES-NI, ...). The "standard" way depends on your platform and goals, depending on the answer to questions such as "do yo have hardware support?", "do you want constant-timeness", "do you want maximal speed", "how much RAM / code space do you have?", "is your mode parallelized?", ...

Is it uncommon to implement your own version of AES?

Yes, it is, because there are already so many good open-source implementations, however people still do it every now and then. For example re-implement AES "just for fun" and sometimes they have a different set of optimization goals than all previous implementations like "minimize code-size, work everywhere in C, runs in constant-time".

I'm familiar with the AES algorithm and it seems like it would be possible to implement your own way of scrambling the bits in the individual rounds.

No. If your implementation doesn't result in the same encryption and decryption functionality as described in FIPS 197, you do not get to call it "AES", because it's some custom scheme you made up.

I also noticed the NIST gives out certifications to individual companies for their AES encryption (ie. Google, Cisco, HP, AWS, etc.) Is this because it's a custom implementation?

The only actual evaluation and certification program that I'm aware of that is run by NIST is the cryptographic module validation program, which well, validates cryptographic modules according to FIPS 140-2. These validations are usually carried out by certified validators (certified by NIST). The modules may use AES but they usually do much more and the main aspect usually is on key management, role management and user authentication, but also of course on the correct implementation of the algorithms, so yes, you can get your AES implementation validated by this program, if it is part of a cryptographic module.

$\endgroup$
  • $\begingroup$ Great explanation! $\endgroup$ – Nick Jul 1 '17 at 14:51
3
$\begingroup$

There is no such thing as a "custom AES implementation". If any detail of it is changed, it is no longer AES. AES is the standard that describes to precise detail how encryption using AES is done.

NIST gives certification to those who implement AES correctly and safely. You may have implemented it so it gives the right answers, but the way you did it could lead to problems. For example, if you multiply numbers in such a way that 2*50 is quicker than 3*50, an attacker could notice that and make use of it. This is what NIST is certifying for.

Now there are different "modes" of operation. These modes are not part of AES, but rather how you put blocks of AES encryption together. See this wikipedia page

$\endgroup$
  • $\begingroup$ "NIST gives certification to those who implement AES correctly and safely." - you do mean FIPS 140-2 here, right? $\endgroup$ – SEJPM Jun 30 '17 at 19:23
  • $\begingroup$ @EllaRose The key and iv I was able to set myself and all I know about the ciphertext is that when I decrypt it, it will be human readable. I misinterpreted this to mean "I can choose the key to attempt decryption with". $\endgroup$ – Daffy Jun 30 '17 at 20:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.