Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate NaCl and implement wrbt peering #26

Open
benhylau opened this issue Feb 10, 2015 · 2 comments
Open

Integrate NaCl and implement wrbt peering #26

benhylau opened this issue Feb 10, 2015 · 2 comments
Assignees

Comments

@benhylau
Copy link
Member

No description provided.

@benhylau benhylau self-assigned this Feb 10, 2015
@benhylau benhylau removed their assignment Feb 21, 2015
@benhylau benhylau self-assigned this Mar 7, 2015
@benhylau
Copy link
Member Author

This is for Android using com.github.gerardsoleca:robosodium:1.0.0:

// Alice sends peering request.
KeyPair aliceKeyPair = new KeyPair();
byte[] aliceSk = aliceKeyPair.getPrivateKey().toBytes();
byte[] alicePk = aliceKeyPair.getPublicKey().toBytes();

// Bob responds with peering offer.
String bobCjdnsSk = "yourCjdnsPrivateKey";
String bobOffer = "credentials";
String nonce = "121212121212121212121212"; // TODO Figure out how to generate

KeyPair bobKeyPair = new KeyPair(bobCjdnsSk, Encoder.HEX);
byte[] bobSk = bobKeyPair.getPrivateKey().toBytes();
byte[] bobPk = bobKeyPair.getPublicKey().toBytes();

Box bobBox = new Box(alicePk, bobSk);
byte[] encryptedBundle = bobBox.encrypt(nonce.getBytes(), bobOffer.getBytes());
Log.d(LOG_TAG, "Encrypted: " + new String(encryptedBundle));

// Alice verifies offer.
Box aliceBox = new Box(bobPk, aliceSk);
byte[] decryptedBundle = aliceBox.decrypt(nonce.getBytes(), encryptedBundle);
Log.d(LOG_TAG, "Decrypted: " + new String(decryptedBundle));

@amardeshbd The wrbt protocol will need some altering now that the signing is done as part of the Box encryption process.

@PeterChu2 You can use the cjdns private key to make a Box for signing, just need to specify the HEX encoding. See above.

@ghost
Copy link

ghost commented Apr 19, 2016

/ip4/1.2.3.4/udp/54321/cjdns/thepublickey.k/pwd/thepassword
/ip4/1.2.3.4/udp/54321/cjdns/thepublickey.k/pwd/thepassword/login/thelogin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant