I managed to compile org_conscrypt_NativeCrypto.cpp for my own application along with some of the java classes. The engine loads fine but when I call
engine.getPrivateKeyById(alias); the PrivateKey cannot be used with the Signature class. This exception is thrown from initSign(): 01-10 10:16:06.960: E/AndroidRuntime(1369): Caused by: java.lang.UnsupportedOperationException: private exponent cannot be extracted 01-10 10:16:06.960: E/AndroidRuntime(1369): at com.android.org.conscrypt.OpenSSLRSAPrivateKey.getPrivateExponent(OpenSSLRSAPrivateKey.java:143) I'm a little confused as to why it attempts to extract the raw key as this key should be Engine backed. On Thursday, November 7, 2013 10:21:06 PM UTC-5, Kenny Root wrote: > > It's moved since then: > https://android.googlesource.com/platform/external/conscrypt/+/57ef6334828dfb4f7f6834ddddf5a0ac61f1a4d0/src/test/java/org/conscrypt/NativeCryptoTest.java > line > 2100 > > > On Sun, Nov 3, 2013 at 12:09 AM, Nitish Agarwal > <[email protected]<javascript:> > > wrote: > >> Hi, >> >> I am in a similar situation. The link which you provided for the >> NativeCrypto.java gives me a 404 ERROR. >> >> Can you post another link to the Test file. >> >> Thanks and Regards, >> Nitish >> >> On Tuesday, September 10, 2013 1:12:57 AM UTC-7, Kenny Root wrote: >>> >>> You can see an example of the approximate OpenSSL calls you'd have to >>> make in a test I wrote: >>> https://android.googlesource.com/platform/libcore/+/master/ >>> crypto/src/test/java/org/conscrypt/NativeCryptoTest.java >>> >>> Starting around line 2073 in the "loadTestEngine" method. You probably >>> want to do DIR_ADD with ApplicationInfo#nativeLibraryDir. >>> >>> >>> On Tue, Sep 10, 2013 at 12:19 AM, tera tellence >>> <[email protected]>wrote: >>> >>>> Hi All, >>>> >>>> I have not had success with this. Can you please give me some >>>> directions? Thanks in Advance! >>>> >>>> -Tera >>>> >>>> >>>> On Tue, Sep 3, 2013 at 12:15 PM, tera tellence >>>> <[email protected]>wrote: >>>> >>>>> Dear All, >>>>> >>>>> How can one call an external engine dynamically in Android? >>>>> Does the Android allow for dynamic loading of engines? >>>>> >>>>> I recompiled OpenSSL1.0.0c with Engine support and added it to my App >>>>> as a shared library. I also compiled the engine source codes and got the >>>>> shared library of the engine in the "lib" directory of my App.Then in my >>>>> Native JNI Code I tried to load my engine using: >>>>> >>>>> ENGINE_load_dynamic(); >>>>> ENGINE * dyn = ENGINE_by_id( "dynamic" ); >>>>> >>>>> >>>>> char * engine_path = "/data/data/com.example. >>>>> engine/lib/libmyengine.so"; >>>>> >>>>> if ( 1 != ENGINE_ctrl_cmd_string( dyn, "SO_PATH", engine_path, >>>>> CMD_MANDATORY ) ) >>>>> //print error path >>>>> >>>>> if ( 1 != ENGINE_ctrl_cmd_string( dyn, "ID", "myengine", CMD_MANDATORY >>>>> ) ) >>>>> //print error id >>>>> >>>>> if ( 1 != ENGINE_ctrl_cmd( dyn, "LIST_ADD", 1, NULL, NULL, >>>>> CMD_MANDATORY ) ) >>>>> //print error list_add >>>>> >>>>> if ( 1 != ENGINE_ctrl_cmd( dyn, "LOAD", 1, NULL, NULL, CMD_MANDATORY ) >>>>> ) >>>>> //print error load >>>>> >>>>> >>>>> In the above code, the LOAD seems to fail. In the Java code, I did >>>>> make a call to: >>>>> >>>>> static{ >>>>> System.loadLibrary("myengine"); >>>>> } >>>>> >>>>> Please advise. Could anyone explain how I can load my engine? >>>>> >>>>> Thanks. >>>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Android Security Discussions" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To post to this group, send email to [email protected]. >>>> Visit this group at http://groups.google.com/ >>>> group/android-security-discuss. >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>> >>> >>> >>> -- >>> >>> Kenny Root >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Android Security Discussions" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]<javascript:> >> . >> To post to this group, send email to >> [email protected]<javascript:> >> . >> Visit this group at >> http://groups.google.com/group/android-security-discuss. >> For more options, visit https://groups.google.com/groups/opt_out. >> > > > > -- > > Kenny Root > -- You received this message because you are subscribed to the Google Groups "Android Security Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/android-security-discuss. For more options, visit https://groups.google.com/groups/opt_out.
