Need the following C code converted into a Java library
[login to view URL]
This c++ to Java converter may help you [login to view URL]
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.
Some requirements:
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 [login to view URL]
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.
C:
rlwe_kex_generate_keypair(a, s_alice, b_alice, &ctx);
JAVA:
public KeyPair generateKeyPair( SecureRandom random);
C:
rlwe_kex_compute_key_bob(b_alice, s_bob, c, k_bob, &ctx);
JAVA:
BobResult computeBob( PublicKey alice, PrivateKey bob);
BobResult holds c (call it CResponse) and k (call it secret).
C:
rlwe_kex_compute_key_alice(b_bob, s_alice, c, k_alice, &ctx);
Java:
AliceResult computeAlice( PublicKey bob, PrivateKey alice,
CResponse response);
**
Hint:
Java Main test program should roughly contain
SecureRandom random = new SecureRandom();
KeyPair aliceKeyPair = generateKeyPair( random );
KeyPair bobKeyPair = generateKeyPair( random );
BobResult res = computeBob( [login to view URL](),
[login to view URL]());
AliceResult res2 = computeAlice( [login to view URL](),
[login to view URL](),
[login to view URL]() );
boolean keysMatch= [login to view URL]().equals( [login to view URL]() );
** 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.
Note:
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.
Hello, I am an experienced both c++ and java programmer and I would like to do this project for you. I have experience in writing codes regarding cryptography (cryptohashes, crypto-algorithms like AES) so it won't be a problem for me. Thank you in advance
$80 USD en 3 días
5,0 (48 comentarios)
5,5
5,5
17 freelancers están ofertando un promedio de $162 USD por este trabajo
I have read and fully understood your requirements..
Please open chat to discuss further…
_____________________-----------------------------------_____________________________------------------