Skip to content

Commit

Permalink
Change examples and readme to point at roughtime.int08h.com
Browse files Browse the repository at this point in the history
  • Loading branch information
int08h committed Feb 18, 2018
1 parent 6479d79 commit 5dad675
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 17 deletions.
15 changes: 14 additions & 1 deletion README.md
Expand Up @@ -14,11 +14,24 @@ time synchronisation in a secure way that doesn't depend on any particular time
a way that, if a time server does misbehave, clients end up with cryptographic proof of it. It was
created by Adam Langley and Robert Obryk.

## Links
## Resources
* [Nearenough Github repo](https://github.com/int08h/nearenough)
* [Roughtime project](https://roughtime.googlesource.com/roughtime)
* My blog posts [describing Roughtime features](https://int08h.com/post/to-catch-a-lying-timeserver/) and
exploring the [Nearenough API and details of Roughtime messages](https://int08h.com/post/roughtime-message-anatomy/).

### Public int08h.com Roughtime Server

A publicly accessible Roughtime server is available at `roughtime.int08h.com` port `2002`. The
server's long-term public key is `016e6e0284d24c37c6e4d7d8d5b4e1d3c1949ceaa545bf875616c9dce0c9bec1`
and can verified by querying the server's DNS `TXT` record:

```bash
$ dig -t txt roughtime.int08h.com
...
;; ANSWER SECTION:
roughtime.int08h.com. 1799 IN TXT "016e6e0284d24c37c6e4d7d8d5b4e1d3c1949ceaa545bf875616c9dce0c9bec1"
```

## Building
Gradle is used to build Nearenough. Run the tests:
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/nearenough/examples/NettyClient.java
Expand Up @@ -40,13 +40,13 @@
*/
public final class NettyClient {

// Hostname and port of the public Google Roughtime server
private static final String GOOGLE_SERVER_HOST = "roughtime.sandbox.google.com";
private static final int GOOGLE_SERVER_PORT = 2002;
// Hostname and port of the public int08h.com Roughtime server
private static final String INT08H_SERVER_HOST = "roughtime.int08h.com";
private static final int INT08H_SERVER_PORT = 2002;

// Long-term public key of the public Google Roughtime server
private static final byte[] GOOGLE_SERVER_PUBKEY = hexToBytes(
"7ad3da688c5c04c635a14786a70bcf30224cc25455371bf9d4a2bfb64b682534"
// Long-term public key of the public int08h.com Roughtime server
private static final byte[] INT08H_SERVER_PUBKEY = hexToBytes(
"016e6e0284d24c37c6e4d7d8d5b4e1d3c1949ceaa545bf875616c9dce0c9bec1"
);

private static final class RequestHandler extends SimpleChannelInboundHandler<DatagramPacket> {
Expand All @@ -59,7 +59,7 @@ public RequestHandler(InetSocketAddress addr) {

// Creates a new RoughtimeClient.
// Behind the scenes SecureRandom will be used to generate a unique nonce.
this.client = new RoughtimeClient(GOOGLE_SERVER_PUBKEY);
this.client = new RoughtimeClient(INT08H_SERVER_PUBKEY);
}

@Override
Expand Down Expand Up @@ -133,7 +133,7 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
}

public static void main(String[] args) throws InterruptedException {
InetSocketAddress addr = new InetSocketAddress(GOOGLE_SERVER_HOST, GOOGLE_SERVER_PORT);
InetSocketAddress addr = new InetSocketAddress(INT08H_SERVER_HOST, INT08H_SERVER_PORT);

System.out.printf("Sending request to %s\n", addr);

Expand Down
16 changes: 8 additions & 8 deletions src/main/java/nearenough/examples/NioClient.java
Expand Up @@ -33,26 +33,26 @@
*/
public final class NioClient {

// Hostname and port of the public Google Roughtime server
private static final String GOOGLE_SERVER_HOST = "roughtime.sandbox.google.com";
private static final int GOOGLE_SERVER_PORT = 2002;
// Hostname and port of the public int08h.com Roughtime server
private static final String INT08H_SERVER_HOST = "roughtime.int08h.com";
private static final int INT08H_SERVER_PORT = 2002;

// Long-term public key of the public Google Roughtime server
private static final byte[] GOOGLE_SERVER_PUBKEY = hexToBytes(
"7ad3da688c5c04c635a14786a70bcf30224cc25455371bf9d4a2bfb64b682534"
// Long-term public key of the public int08h.com Roughtime server
private static final byte[] INT08H_SERVER_PUBKEY = hexToBytes(
"016e6e0284d24c37c6e4d7d8d5b4e1d3c1949ceaa545bf875616c9dce0c9bec1"
);

@SuppressWarnings("Duplicates")
public static void main(String[] args) throws IOException, InterruptedException {
InetSocketAddress addr = new InetSocketAddress(GOOGLE_SERVER_HOST, GOOGLE_SERVER_PORT);
InetSocketAddress addr = new InetSocketAddress(INT08H_SERVER_HOST, INT08H_SERVER_PORT);
System.out.printf("Sending request to %s\n", addr);

// Nonblocking NIO UDP channel for the remote Roughtime server
DatagramChannel channel = DatagramChannel.open(StandardProtocolFamily.INET);
channel.configureBlocking(false);

// Create a new RoughtimeClient instance
RoughtimeClient client = new RoughtimeClient(GOOGLE_SERVER_PUBKEY);
RoughtimeClient client = new RoughtimeClient(INT08H_SERVER_PUBKEY);

// Create a request message
RtMessage request = client.createRequest();
Expand Down

0 comments on commit 5dad675

Please sign in to comment.