rweather / noise-java Goto Github PK
View Code? Open in Web Editor NEWPlain Java implementation of the Noise protocol
License: MIT License
Plain Java implementation of the Noise protocol
License: MIT License
Hello @rweather
Hi,
I'm not very familiar with gradle/java and would like to include noise-java in my project. I searched for a mavenrepo but couldn't find any.
Can you explain to me, how I can use noise-java with gradle?
For example I could include the jackson library with this line:
compile 'com.fasterxml.jackson.core:jackson-core:2.8.5'
Is there a similar way to use noise-java or do I just download and include the source code of this git repo in my project?
Thanks in advance! :-)
Right now people tend to copy-paste the source code of the library into their project. The other way is to install the library locally, but it doesn't work for teams.
It would be very useful to publish it to a public repository, so developer will be able to declare it as a dependency in their projects. Most simple way to do that is using Bintray, it's free for Open Source, there are ready to use Maven plugins to publish to Bintray, and packages are accessible through jcenter
.
Hello,
I am planning to implement Noise protocol in My Android Application, I have tried to create demo from the existing Java code and Noise-C code, but every time when I send message through socket to my Noise-Server I get Unknown echo protocol identifier error. Below is my code, will you please help me to find the issue in it.
public String bytesToHex(byte[] bytes) {
char[] hexArray = "0123456789ABCDEF".toCharArray();
char[] hexChars = new char[bytes.length * 2];
for (int j = 0; j < bytes.length; j++) {
int v = bytes[j] & 0xFF;
hexChars[j * 2] = hexArray[v >>> 4];
hexChars[j * 2 + 1] = hexArray[v & 0x0F];
}
return new String(hexChars);
}
public NoiseManager(final Context context) {
Observable.fromCallable(new Callable<Void>() {
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
@Override
public Void call() throws Exception {
try {
HandshakeState initiator = new HandshakeState("Noise_XX_25519_ChaChaPoly_SHA256", INITIATOR);
String init_prologue = "";
TestMessage testMessage = new TestMessage();
testMessage.ciphertext = bytesToHex("\\n".getBytes());
testMessage.payload = bytesToHex("\\n".getBytes());
if (initiator.needsLocalKeyPair()) {
StringBuilder clientKey = new StringBuilder();
String host = "localhost";
int port = 7000;
InetAddress address = InetAddress.getByName(host);
Socket socket = new Socket(address, port);
BufferedReader reader = null, reader1 = null;
try {
reader = new BufferedReader(
new InputStreamReader(context.getAssets().open("client_key_25519"),
"UTF-8"));
String line;
while ((line = reader.readLine()) != null) {
clientKey.append(line);
}
initiator.getLocalKeyPair().setPrivateKey(clientKey.toString().getBytes()
, 0);
initiator.start();
byte[] message = new byte[128];
byte[] plaintext = new byte[128];
int len = 0;
while (true) {
if (initiator.getAction() == WRITE_MESSAGE) {
len = initiator.writeMessage(message, 0,
testMessage.payload.getBytes(), 0,
testMessage.payload.getBytes().length);
OutputStreamWriter osw = new OutputStreamWriter(socket.getOutputStream());
BufferedWriter bw = new BufferedWriter(osw);
String strMessage = new String(message, "UTF-8");
bw.write(strMessage);
bw.flush();
Log.e(NoiseManager.class.getSimpleName(),
"Message sent to the server : " + strMessage);
} else {
break;
}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
if (reader != null) {
try {
reader.close();
//socket.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}).observeOn(AndroidSchedulers.mainThread())
.subscribeOn(Schedulers.io())
.subscribe(new Subscriber<Void>() {
@Override
public void onCompleted() {
Log.e(NoiseManager.class.getSimpleName(), "onCompleted");
}
@Override
public void onError(Throwable e) {
e.printStackTrace();
Log.e(NoiseManager.class.getSimpleName(), "onError");
}
@Override
public void onNext(Void o) {
Log.e(NoiseManager.class.getSimpleName(), "onNext");
}
});
}
I'm working on a java implementation of wireguard and one of the needed functions is keyed blake2s hashing.
I saw the note in the Noise.java:174
where the fallback is used:
// Bouncy Castle doesn't currently (June 2016) have an
// implementation of BLAKE2s, but look for the most
// obvious provider name in case one is added in the future.
Is support for keyed hashing something that would be relatively easy to add to the fallback implementation, or should I work on getting blake2s implemented upstream in bouncy castle? There's nothing about blake2s in the latest release or the git master.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.