How to build AES Crypt for Android shared Library ( JNI )

Discussion related to AES Crypt, the file encryption software for Windows, Linux, Mac, and Java.
iSgomm
Posts: 4
Joined: Thu Oct 31, 2013 2:58 pm

How to build AES Crypt for Android shared Library ( JNI )

Post by iSgomm »

Hi,
now i am using MAC OSX MAVERICK and I'm trying to create a shared library within an Android project in eclipse to use it via JNI calls, but
when I execute the build command (ndk-build) I receive the following error:

Android NDK: WARNING: APP_PLATFORM android-18 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml
Compile thumb : AESCrypt <= libAESCrypt.c
Compile thumb : AESCrypt <= aes.c
Compile thumb : AESCrypt <= aescrypt.c
jni/aescrypt.c:30:34: fatal error: iconv.h: No such file or directory
compilation terminated.
make: *** [obj/local/armeabi/objs/AESCrypt/aescrypt.o] Error 1

I upload Eclipse ADT project.

Can someone help me?
Greetings
Attachments
test.aes.zip
(1.25 MiB) Downloaded 686 times
User avatar
paulej
Posts: 595
Joined: Sun Aug 23, 2009 7:32 pm
Location: Research Triangle Park, NC, USA
Contact:

Re: How to build AES Crypt for Android shared Library ( JNI

Post by paulej »

It sounds like iconv() is not supported on Android. Just get rid of that and change the code to convert the input format for passwords into UTF16-LE.
iSgomm
Posts: 4
Joined: Thu Oct 31, 2013 2:58 pm

Re: How to build AES Crypt for Android shared Library ( JNI

Post by iSgomm »

Thanks for the reply.
But I do not know how to change the source code to convert the input format for passwords into UTF16-LE.
I attach source of eclipse project of AESCrypt, can you help me ?
Many, many thanks....
Greeting
User avatar
paulej
Posts: 595
Joined: Sun Aug 23, 2009 7:32 pm
Location: Research Triangle Park, NC, USA
Contact:

Re: How to build AES Crypt for Android shared Library ( JNI

Post by paulej »

What format is the text in when enteref into Android? It might already be UTF-16LE, in which case no conservation is even needed.

If no conversion is needed, you can just remove the call to iconv(). If conversion is needed, you just need to know the input character encoding used. The conversion process is surely you something you can handle if you're building this kind of app.

BTW, are you aware that there is already a port of AES Crypt to android? Source is not available, other than the same source you are using. Nonetheless, there is already one tool.
iSgomm
Posts: 4
Joined: Thu Oct 31, 2013 2:58 pm

Re: How to build AES Crypt for Android shared Library ( JNI

Post by iSgomm »

The text that I enter in the Android consists of ASCII characters without any special coding.
I try to remove the function iconv() let's see what happens .....

Could you tell me where I ported to Android AESCrypt.
Many thanks
User avatar
paulej
Posts: 595
Joined: Sun Aug 23, 2009 7:32 pm
Location: Research Triangle Park, NC, USA
Contact:

Re: How to build AES Crypt for Android shared Library ( JNI

Post by paulej »

I'm not referring to the characters you enter. Rather, I'm referring to the character encoding used by Android. Based on this page, UTF-8 is the default encoding: http://developer.android.com/reference/ ... arset.html.

AES Crypt passwords need to be in UTF-16LE format. So, it might be possible to use this method to perform the conversion. Our, it might be possible to just change the default encoding to be UTF-16LE. No BOM is present in password strings.

You might also be able to call this function if the password is in a strong class: http://download.oracle.com/javase/6/doc ... .String%29
iSgomm
Posts: 4
Joined: Thu Oct 31, 2013 2:58 pm

Re: How to build AES Crypt for Android shared Library ( JNI

Post by iSgomm »

Hi,
thanks for your time and patience.
I modified the C sources eliminating the conversion to UTF-16LE, I modified the java source eliminating the conversion to UTF-16LE, I imported everything into an Android project with JNI, and everything works properly.
I still want to properly test the code making sure that everything works properly
Thanks again, greetings
sstevemmitchell
Posts: 1
Joined: Wed Nov 03, 2021 4:58 pm

Re: How to build AES Crypt for Android shared Library ( JNI )

Post by sstevemmitchell »

Simple API to perform AES encryption on Android with no dependancies. This is the Android counterpart to the AESCrypt library Ruby and AESCrypt-ObjC created by Gurpartap Singh. It used the same weak :'( security defaults i.e Blank IV noted below.

For compatiblity with AESCrypt, AESCrypt-Android has the same defaults namely:

256-bit AES key
CBC mode
PKCS7Padding
Blank/Empty IV (default)*
*Using CBC with the default blank IV is vulnerable. This has been left in for compatibility with AESCrypt implementations. See Adv method for providing your own IV. If you don't need to be compatable with AESCrypt then look at java-aes-crypto it's API is just as simple and generates more secure keys.
User avatar
paulej
Posts: 595
Joined: Sun Aug 23, 2009 7:32 pm
Location: Research Triangle Park, NC, USA
Contact:

Re: How to build AES Crypt for Android shared Library ( JNI )

Post by paulej »

sstevemmitchell wrote: Wed Nov 03, 2021 5:03 pm Simple API to perform AES encryption on Android with no dependancies. This is the Android counterpart to the AESCrypt library Ruby and AESCrypt-ObjC created by Gurpartap Singh. It used the same weak :'( security defaults i.e Blank IV noted below.

For compatiblity with AESCrypt, AESCrypt-Android has the same defaults namely:

256-bit AES key
CBC mode
PKCS7Padding
Blank/Empty IV (default)*
*Using CBC with the default blank IV is vulnerable. This has been left in for compatibility with AESCrypt implementations. See Adv method for providing your own IV. If you don't need to be compatable with AESCrypt then look at java-aes-crypto it's API is just as simple and generates more secure keys.
You are referring to a completely different program called "aescrypt" than AES Crypt. The latter (which is what this forum is about) definitely does not leave the IV empty. It is populated with random values.
User avatar
paulej
Posts: 595
Joined: Sun Aug 23, 2009 7:32 pm
Location: Research Triangle Park, NC, USA
Contact:

Re: How to build AES Crypt for Android shared Library ( JNI )

Post by paulej »

Post Reply