Removed unused code.

This commit is contained in:
akwizgran
2011-08-19 11:21:59 +02:00
parent 9dea4d0299
commit a59ad23e77
5 changed files with 2 additions and 214 deletions

View File

@@ -15,8 +15,9 @@ public class CryptoModule extends AbstractModule {
protected void configure() {
bind(CryptoComponent.class).to(
CryptoComponentImpl.class).in(Singleton.class);
// FIXME: Use a real key
bind(SecretKey.class).annotatedWith(SecretStorageKey.class).toInstance(
new SecretKeySpec(new byte[32], "AES")); // FIXME
new SecretKeySpec(new byte[32], "AES"));
}
}

View File

@@ -1,43 +0,0 @@
package net.sf.briar.protocol;
import java.io.IOException;
import java.security.Signature;
import java.security.SignatureException;
import net.sf.briar.api.serial.Consumer;
// FIXME: This class is no longer used - remove it?
/** A consumer that passes its input through a signature. */
class SigningConsumer implements Consumer {
private final Signature signature;
SigningConsumer(Signature signature) {
this.signature = signature;
}
public void write(byte b) throws IOException {
try {
signature.update(b);
} catch(SignatureException e) {
throw new IOException(e.getMessage());
}
}
public void write(byte[] b) throws IOException {
try {
signature.update(b);
} catch(SignatureException e) {
throw new IOException(e.getMessage());
}
}
public void write(byte[] b, int off, int len) throws IOException {
try {
signature.update(b, off, len);
} catch(SignatureException e) {
throw new IOException(e.getMessage());
}
}
}

View File

@@ -1,67 +0,0 @@
package net.sf.briar.protocol;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.security.MessageDigest;
import java.security.Signature;
import java.security.SignatureException;
// FIXME: This class is no longer used - remove it?
/**
* An output stream that passes its output through a signature and a message
* digest.
*/
class SigningDigestingOutputStream extends FilterOutputStream {
private final Signature signature;
private final MessageDigest messageDigest;
private boolean signing = false, digesting = false;
public SigningDigestingOutputStream(OutputStream out, Signature signature,
MessageDigest messageDigest) {
super(out);
this.signature = signature;
this.messageDigest = messageDigest;
}
void setSigning(boolean signing) {
this.signing = signing;
}
void setDigesting(boolean digesting) {
this.digesting = digesting;
}
@Override
public void write(byte[] b) throws IOException {
write(b, 0, b.length);
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
out.write(b, off, len);
if(signing) {
try {
signature.update(b, off, len);
} catch(SignatureException e) {
throw new IOException(e.getMessage());
}
}
if(digesting) messageDigest.update(b, off, len);
}
@Override
public void write(int b) throws IOException {
out.write(b);
if(signing) {
try {
signature.update((byte) b);
} catch(SignatureException e) {
throw new IOException(e.getMessage());
}
}
if(digesting) messageDigest.update((byte) b);
}
}