Need the following C code converted into a Java library
[url removed, login to view]
This c++ to Java converter may help you [url removed, login to view]
I need the C code converted to nice Java code/classes.
It should be pretty easy/straightforward.
See rlwe_main.c for an example program.
a) I would like a nice clean interface to the lib that makes it clean and easy to call the functions.
b) generateKeyPair needs to work with Java KeyPair.
Easy enough to do - you can subclass PublicKey and PrivateKey
by putting the uint32_t in the
public byte getEncoded() of [url removed, login to view]
c) assume CONSTANT_TIME is our default (see code)
d) Use java SecureRandom (passed in externally to interface)
for random numbers for rlwe_kex_generate_keypair
ie public KeyPair generateKeyPair(SecureRandom ........
e) Java test program should emulate the test logic in C main
(see below). Of course, the program must work and always
generate the same secret between Alice and Bob.
f) No statics in final - I need the final code to run in parallel with multiple threads
g) Ignore the C random number code - we should be using SecureRandom in the Java implementation.
** interface definition
I'll put the suggested mappings between old C and Java here. Chat if you want to do something different.
rlwe_kex_generate_keypair(a, s_alice, b_alice, &ctx);
public KeyPair generateKeyPair( SecureRandom random);
rlwe_kex_compute_key_bob(b_alice, s_bob, c, k_bob, &ctx);
BobResult computeBob( PublicKey alice, PrivateKey bob);
BobResult holds c (call it CResponse) and k (call it secret).
rlwe_kex_compute_key_alice(b_bob, s_alice, c, k_alice, &ctx);
AliceResult computeAlice( PublicKey bob, PrivateKey alice,
Java Main test program should roughly contain
SecureRandom random = new SecureRandom();
KeyPair aliceKeyPair = generateKeyPair( random );
KeyPair bobKeyPair = generateKeyPair( random );
BobResult res = computeBob( [url removed, login to view](),
[url removed, login to view]());
AliceResult res2 = computeAlice( [url removed, login to view](),
[url removed, login to view](),
[url removed, login to view]() );
boolean keysMatch= [url removed, login to view]().equals( [url removed, login to view]() );
** Background logic to understand whats going on
Alice generates initiator polynomal (PubKey), gives it to Bob.
Bob takes initiator polynomial (alice pubkey) and now has secret (k), gives responding polynomials (C and pubkey bob) to Alice.
Alice takes responding polynomials (C and pubkey bob) and calculates secret (k).
We then run test to ensure that both Alice and Bob have the same secret.
All copyright must of completed work belong to me, This obviously also means you can't give the produced code to anyone else, in whole or in part.
Obviously, the Java code given to me must be bug free, fully working, and clean wherever possible,
Even though the c++ to java converter may be useful, you'll still to put some manual effort in.
The test code should clearly show the system works even when run many many times
(ie. if you put the main test loop and run it 100,000 times, the secret should match every time with different
public and private keys etc)
17 freelancer menawar dengan rata-rata $162 untuk pekerjaan ini
I have read and fully understood your requirements.. Please open chat to discuss further… _____________________-----------------------------------_____________________________------------------