Skip to content

Commit

Permalink
Misc code cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
int08h committed Feb 17, 2018
1 parent 8849e04 commit 6479d79
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/main/java/nearenough/examples/NettyClient.java
Expand Up @@ -63,7 +63,7 @@ public RequestHandler(InetSocketAddress addr) {
}

@Override
public void channelActive(ChannelHandlerContext ctx) throws Exception {
public void channelActive(ChannelHandlerContext ctx) {
// Creates the client request
RtMessage msg = client.createRequest();

Expand All @@ -81,7 +81,7 @@ public void channelActive(ChannelHandlerContext ctx) throws Exception {

@SuppressWarnings("Duplicates")
@Override
protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) {
// A reply from the server has been received

System.out.printf(
Expand Down Expand Up @@ -120,7 +120,7 @@ protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throw
}

@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
ctx.close();

if (cause instanceof ReadTimeoutException) {
Expand All @@ -145,7 +145,7 @@ public static void main(String[] args) throws InterruptedException {
.channel(NioDatagramChannel.class)
.handler(new ChannelInitializer<NioDatagramChannel>() {
@Override
protected void initChannel(NioDatagramChannel ch) throws Exception {
protected void initChannel(NioDatagramChannel ch) {
ch.pipeline()
.addLast(new ReadTimeoutHandler(5))
.addLast(new RequestHandler(addr));
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/nearenough/examples/NioClient.java
Expand Up @@ -81,7 +81,7 @@ public static void main(String[] args) throws IOException, InterruptedException
if (recvBuf.hasRemaining()) {
break;
}
Thread.sleep(100);
Thread.sleep(100L);
}

if (recvBuf.hasRemaining()) {
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/nearenough/protocol/RtEd25519.java
Expand Up @@ -19,10 +19,6 @@
import static nearenough.protocol.RtConstants.PUBKEY_LENGTH;
import static nearenough.util.Preconditions.checkArgument;

import java.security.InvalidKeyException;
import java.security.PublicKey;
import java.security.Signature;
import java.security.SignatureException;
import net.i2p.crypto.eddsa.EdDSAEngine;
import net.i2p.crypto.eddsa.EdDSAPrivateKey;
import net.i2p.crypto.eddsa.EdDSAPublicKey;
Expand All @@ -31,6 +27,11 @@
import net.i2p.crypto.eddsa.spec.EdDSAPrivateKeySpec;
import net.i2p.crypto.eddsa.spec.EdDSAPublicKeySpec;

import java.security.InvalidKeyException;
import java.security.PublicKey;
import java.security.Signature;
import java.security.SignatureException;

/**
* Provides Ed25519 signing and verification.
*/
Expand All @@ -55,7 +56,7 @@ public static final class Signer {
* seed will be transformed and expanded into an Ed25519 private key as described in <a
* href="https://tools.ietf.org/html/rfc8032#page-13">RFC 8032</a>.
*/
public Signer(byte[] seedBytes) throws InvalidKeyException, SignatureException {
public Signer(byte[] seedBytes) throws InvalidKeyException {
checkArgument(seedBytes.length >= MIN_SEED_LENGTH, "insufficient private key seed length");

EdDSAPrivateKeySpec privateSpec = new EdDSAPrivateKeySpec(seedBytes, ED25519_SPEC);
Expand Down Expand Up @@ -106,7 +107,7 @@ public static final class Verifier {
*
* @param publicKeyBytes A byte[32] containing the Ed25519 public key to use for verifications.
*/
public Verifier(byte[] publicKeyBytes) throws InvalidKeyException, SignatureException {
public Verifier(byte[] publicKeyBytes) throws InvalidKeyException {
checkArgument(publicKeyBytes.length == PUBKEY_LENGTH, "incorrect public key size");

EdDSAPublicKeySpec publicSpec = new EdDSAPublicKeySpec(publicKeyBytes, ED25519_SPEC);
Expand Down

0 comments on commit 6479d79

Please sign in to comment.