You are doing two different typetypes of encryption.
Your Java code is using the "AES"AES cipher which is more accurately "AES/ECB/PKCS5Padding"AES/ECB/PKCS5Padding while your swift code is doing the equivalent of "AES/CBC/PKCS5Padding"AES/CBC/PKCS5Padding and is using an IV.
In other words your swift code is doing cipher block chaining and uses a initialization vector. While your java code is doing ECB mode without an IV.
If you don't know what you are doing you shouldn't be implementing encryption schemes, but at a minimum, you should always use a random IV and cipher block chaining.
You should really never use ECB mode.
If you use a random IV, then each time you encrypt something the result will be different.
Rather than checking that the cipher texts are the same you should test that you can encrypt/decrypt messages between each component.
You are doing two different type of encryption. Your Java code is using the "AES" cipher which is more accurately "AES/ECB/PKCS5Padding" while your swift code is doing the equivalent of "AES/CBC/PKCS5Padding" and is using an IV.
In other words your swift code is doing cipher block chaining and uses a initialization vector. While your java code is doing ECB mode without an IV.
If you don't know what you are doing you shouldn't be implementing encryption schemes, but at a minimum, you should always use a random IV and cipher block chaining. You should really never use ECB mode.
If you use a random IV, then each time you encrypt something the result will be different.
Rather than checking that the cipher texts are the same you should test that you can encrypt/decrypt messages between each component.
You are doing two different types of encryption.
Your Java code is using the AES cipher which is more accurately AES/ECB/PKCS5Padding while your swift code is doing the equivalent of AES/CBC/PKCS5Padding and is using an IV.
In other words your swift code is doing cipher block chaining and uses a initialization vector. While your java code is doing ECB mode without an IV.
If you don't know what you are doing you shouldn't be implementing encryption schemes, but at a minimum, you should always use a random IV and cipher block chaining.
You should really never use ECB mode.
If you use a random IV, then each time you encrypt something the result will be different.
Rather than checking that the cipher texts are the same you should test that you can encrypt/decrypt messages between each component.
You are doing two different type of encryption. Your Java code is using the "AES" cipher which is more accurately "AES/ECB/PKCS5Padding" while your swift code is doing the equivalent of "AES/CBC/PKCS5Padding" and is using an IV.
In other words your swift code is doing cipher block chaining and uses a initialization vector. While your java code is doing ECB mode without an IV.
If you don't know what you are doing you shouldn't be implementing encryption schemes, but at a minimum, you should always use a random IV and cipher block chaining. You should really never use ECB mode.
If you use a random IV, then each time you encrypt something the result will be different.
Rather than checking that the cipher texts are the same you should test that you can encrypt/decrypt messages between each component.