JNA quick example
I started writing the fix for that signature stuff. It requires java (JNA easier than JNI) to read some bloody c code. If you guys want to get started here is how
- Grap the encrypt.c and .h (somewhere on the subreddit)
- make
- grap the .so (or dll if you are on windows)
public class Test {
public interface CTest extends Library {
public int encrypt(byte[] input, long size, byte[] iv, long size2, byte[] output, int[] output size)
}
public static void main(String ... args) {
CTest ctest = (CTest) Native.loadLibrary("encrypt", CTest.class);
System.out.println(ctest.encrypt(new byte[3], 3, iv, 32, null, new int[50000]));
//System.out.println(new Encrypt().encrypt(new byte[3], 3, iv, 32, null, 32));
}
}
```;
It should output 0
the real input are
(raw_signature_proto_buf, size, iv, 32, output, output size pointer)
I'm off to bed hope I see a PR tomorrow morning 👍
I am working on re-scripting the encryption to java to a jar. Probably you could skip the jnit part at this moment and let me see if the java implementation of the encryption works.
Ideally you would rewrite the encryption code in java. Using their library isn't very optimal. JNA/JNI is messy IMO
PS: do you happen to have encrypt.c and encrypt.h?
Why not?
Here you go http://pgoapi.com/
I have a working JNA code (and actually the all flow working) but it is mess indeed hmm good luck to rewrite the encrypt.c into java! it's impossible so much code :/
Paul776 If you need any help I'm good with Java and would be willing to help out.
@Paul776 semi-automated. almost done. testing.
Is this all that needs to be done for the api to actually work again?
@DrBrad nope. compile proto. generate signature for every message envelope. encripted. put it into unknown6.
i don't think will be added to this api anytime soon unfortunately :(
@Paul776 it is not impossible. Plus using JNA is slow. I have been able to implement most of the Signature proto (minus the final hash using the encryption) but I am too tired to finish it tonight. I will probably have this all implemented tomorrow at some point.
Assuming this xxhash library I found functions correctly. I may have to do some testing on it. If it fails, I will write my own version.
@ramarro123 Do you know of any other Java PokemonGo-API's out currently? As you could use another api to help with this one.
@illusion12 Just curious. Is it possible to import C library using jni? I read jni is faster than jna?
@Paul776 completed. tested with varying random input of size 200, 256, 500 and seems to be correct. but i dont have dump to fully verify
Actually I fail at the make-step (ld -lencrpyt missing) and using a windows dll I found in chat I get -1 as result.
For JNA, see https://github.com/Grover-c13/PokeGOAPI-Java/pull/494
feel free to make that thing actually work as right now either the encryption thing or the xxhash'ing is not working correctly.
@DanippDm5vzDS8HWnc9fap http://imgur.com/a/338XO
It is working perfectly (meaning I have a valid final output) but the making the request I get 0 pokemons back
I will gave up with JNA it's not the right solution. Could you share your converted java code? I can give it a try right now with a valid request
https://github.com/Grover-c13/PokeGOAPI-Java/pull/494
Has Java code
@jabbink I have hooked my JNA imp with your code, and it return 0 pokemons as well might be something wrong in the way we build the requests
merged #494 so i close this issue ;)