Coder Social home page Coder Social logo

noise-java's People

Contributors

dependabot[bot] avatar jon-signal avatar nashatyrev avatar polivar3 avatar rweather avatar tsoloane avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

noise-java's Issues

Using noise-java with gradle

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! :-)

Publish to a public Maven repo

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.

Unknown echo protocol identifier

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");
                }
            });
}

Adding support for keyed blake2s hashes

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.