Menu

Problem about jna in JPBC when implementing android app

weiwei
2013-07-29
2016-10-28
  • weiwei

    weiwei - 2013-07-29

    Dear Angelo and everyone:
    I have a big headache in implementing jPBC on android. I didn't find the android project soucecode for benchmark, so I have to do it by myself.
    If I include 'jna-3.5.1.jar' in the android project, the android virtual device manager gives me error "The library 'jna-3.5.1.jar' contains native libraries that will not run on the device". so I have to remove the jna-3.5.1.jar from the android project library.
    However, I need both the android and PC server to have the same curve paramenters so they can exchange messages, so I need to use "PairingFactory.getPairing" to generate consistent paring from 'curves.properties'. As a result, I use the following code to read the 'curves.properties' in android SD card:

        File root = Environment.getExternalStorageDirectory();
        String curvePropertyPath = root.getAbsolutePath()+"/curve.properties";
        CurveParameters curparams = PairingFactory.getInstance().loadCurveParameters(curvePropertyPath);
        Pairing pairing = PairingFactory.getPairing(curparams);
        I'll get this error:
        E/dalvikvm(294): Could not find class 'it.unisa.dia.gas.plaf.jpbc.wrapper.jna.WrapperLibrary', referenced from method it.unisa.dia.gas.plaf.jpbc.wrapper.jna.WrapperLibraryProvider.<clinit>
    

    It's because there is no 'jna-3.5.1.jar.jar'.I'm in a dilemma. how to solve this problem? I don't know how android benchmark app handle this. Your help will be highly appreciated.

     

    Last edit: weiwei 2013-07-29
  • Borui Li

    Borui Li - 2015-04-16

    I am stuck at the same place. But about the same curve paramenters problem, i have another way to deal with that. I use pbc (not jPBC) to generate the an "a1.paramenter" and use it in java project with jPBC, that works(both server and client). But i am still stuck on how to use these jars from jPBC in a android project. Everything on a java project runs perfect, but when i build the jars(not include the jni) path in an android project with the same classes i wrote in java project, it pops up "java.lang.illegalArgumentException: No valid resource found" errors! DO you have any idea about this?

     
  • Angelo De Caro

    Angelo De Caro - 2015-04-19

    Hi Borui Li,

    Please, put the curve parameters in assets folder. It should work.

    ./angelo

     
  • arunkumar

    arunkumar - 2016-10-28

    I don't know How to put curve parameters in assets folder.

     

Log in to post a comment.