[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

AES is AES is AES, right? WRONG!

Posted on 2012-08-31
3
Medium Priority
?
1,096 Views
Last Modified: 2013-12-02
I've been trying to build two sets of two routines using AES encryption
Set #1 - .NET
A) Encrypt a file
B) Decrypt a file
Set #2 - Android/Java
A) Encrypt a file
B) Decrypt a file
BUT #1 and #2 must be inter-compatible!
e.g. Encrypt with .NET ... decrypt with Android/Java
and
e.g. Encrypt with Android/Java ... decrypt with .NET
In several articles, I've read that AES encrypt/decrypt is compatible between .NET and Android/Java ... with one caveat ... which was repeated over and over and over. All AES parameter/settings must be the SAME.

But, that's tough when MS and Android each use DIFFERENT PARAMETER NAMES to mean exactly the same thing and it's even more difficult when I'm a bonehead novice with encryption (much less AES encryption)

Arrrrgggghhhhh!

Microsoft's System.Security.Cryptography.AES ... uses parameters of
Blocksize, Feedbacksize, IV, Key, Keysize, LegalBlockSizes, LegalKeySizes, Mode, Padding
Javax.crypto.Cipher ... uses parameters of
Cipher, CipherInputStream, CipherOutputStream, CipherSpi, EncryptedPrivateKeyInfo, ExemptionMechanism, ExemptionMechanismSpi, KeyAgreement, KeyAgreementSpi, KeyGenerator, KeyGeneratorSpi, Mac, MacSpi, NullCipher, SealedObject, SecretKeyFactory, SecretKeyFactorySpi
Can ANYONE HELP?
Four routines
Two in C#
Two in Java
Arrrrgggghhhhh!
0
Comment
Question by:volking
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 2000 total points
ID: 38357006
Not much time now, but most important are keysize and padding (apart from algo of course)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 38366998
:)
0
 
LVL 15

Expert Comment

by:Giovanni Heward
ID: 39690402
In many respects, Rijndael (AES) is a relatively simple cipher. It has a variable number of rounds. Other than an extra round performed at the end of encipherment with one step omitted, the number of rounds in Rijndael is:

9 if both the block and the key are 128 bits long
11 if either the block or the key is 192 bits long, and neither of them is longer
13 if either the block or the key is 256 bits long

The process for enciphering a block of data in Rijndael is to first perform an Add Round Key step (XORing a subkey with the block) by itself, the regular rounds noted above, and the final round with the Mix Column step, as described below, omitted.

The Rounds
There are four steps in each round. First is the Byte Sub step, where each byte of the block is replaced by its substitute in an S-box (substitution table).

Next is the Shift Row step. Considering the block to be made up of bytes 1 to 16, these bytes are arranged in a rectangle, and shifted according to the algorithm.

Next comes the Mix Column step. Matrix multiplication is performed: each column, in the arrangement described above, is multiplied by the following matrix:

2 3 1 1
1 2 3 1
1 1 2 3
3 1 1 2

The final step is Add Round Key. This simply XORs in the subkey for the current round.

Rijndael (AES)
0

Featured Post

Cyber Threats to Small Businesses (Part 2)

The evolving cybersecurity landscape presents SMBs with a host of new threats to their clients, their data, and their bottom line. In part 2 of this blog series, learn three quick processes Webroot’s CISO, Gary Hayslip, recommends to help small businesses beat modern threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many Password Managers (PM) out there to choose from. PM's can help with your password habits and routines, but they should not be a crutch you rely on too heavily. I also have an article for company/enterprise PM's.
Businesses who process credit card payments have to adhere to PCI Compliance standards. Here’s why that’s important.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Suggested Courses
Course of the Month20 days, 5 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question