diff --git a/bulletin-board-server/src/test/java/meerkat/bulletinboard/BulletinBoardServerTest.java b/bulletin-board-server/src/test/java/meerkat/bulletinboard/BulletinBoardServerTest.java index e0801af..eb43f15 100644 --- a/bulletin-board-server/src/test/java/meerkat/bulletinboard/BulletinBoardServerTest.java +++ b/bulletin-board-server/src/test/java/meerkat/bulletinboard/BulletinBoardServerTest.java @@ -1,11 +1,5 @@ package meerkat.bulletinboard; -import java.io.File; -import java.nio.file.Files; -import java.nio.file.NoSuchFileException; -import java.nio.file.Path; -import java.nio.file.Paths; - import org.junit.Test; import meerkat.bulletinboard.sqlserver.SQLiteBulletinBoardServer; diff --git a/bulletin-board-server/src/test/java/meerkat/bulletinboard/GenericBulletinBoardServerTest.java b/bulletin-board-server/src/test/java/meerkat/bulletinboard/GenericBulletinBoardServerTest.java index 36a998b..279ee7c 100644 --- a/bulletin-board-server/src/test/java/meerkat/bulletinboard/GenericBulletinBoardServerTest.java +++ b/bulletin-board-server/src/test/java/meerkat/bulletinboard/GenericBulletinBoardServerTest.java @@ -8,7 +8,6 @@ import java.security.InvalidKeyException; import java.security.KeyStore; import java.security.KeyStoreException; import java.security.NoSuchAlgorithmException; -import java.security.SecureRandom; import java.security.SignatureException; import java.security.UnrecoverableKeyException; import java.security.cert.CertificateException; diff --git a/meerkat-common/src/main/java/meerkat/crypto/DigitalSignature.java b/meerkat-common/src/main/java/meerkat/crypto/DigitalSignature.java index 587522f..5386c5f 100644 --- a/meerkat-common/src/main/java/meerkat/crypto/DigitalSignature.java +++ b/meerkat-common/src/main/java/meerkat/crypto/DigitalSignature.java @@ -2,8 +2,6 @@ package meerkat.crypto; import com.google.protobuf.Message; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.PasswordCallback; import java.io.IOException; import java.io.InputStream; import java.security.InvalidKeyException; @@ -11,7 +9,6 @@ import java.security.KeyStore; import java.security.SignatureException; import java.security.UnrecoverableKeyException; import java.security.cert.CertificateException; -import java.util.List; import static meerkat.protobuf.Crypto.*; /** diff --git a/meerkat-common/src/main/java/meerkat/crypto/concrete/ECDSADeterministicSignature.java b/meerkat-common/src/main/java/meerkat/crypto/concrete/ECDSADeterministicSignature.java index 992dbbb..0afbdd7 100644 --- a/meerkat-common/src/main/java/meerkat/crypto/concrete/ECDSADeterministicSignature.java +++ b/meerkat-common/src/main/java/meerkat/crypto/concrete/ECDSADeterministicSignature.java @@ -2,43 +2,25 @@ package meerkat.crypto.concrete; import com.google.protobuf.ByteString; import com.google.protobuf.Message; -import meerkat.crypto.DigitalSignature; import meerkat.protobuf.Crypto; import meerkat.protobuf.Crypto.Signature; -import meerkat.util.Hex; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.DERSequence; -import org.bouncycastle.crypto.Digest; import org.bouncycastle.crypto.params.AsymmetricKeyParameter; -import org.bouncycastle.crypto.params.ECDomainParameters; import org.bouncycastle.crypto.params.ECPrivateKeyParameters; import org.bouncycastle.crypto.signers.DSAKCalculator; import org.bouncycastle.crypto.signers.ECDSASigner; import org.bouncycastle.crypto.signers.HMacDSAKCalculator; -import org.bouncycastle.jcajce.provider.asymmetric.util.DSAEncoder; import org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil; -import org.bouncycastle.jce.ECKeyUtil; -import org.bouncycastle.jce.ECPointUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import javax.security.auth.callback.Callback; -import javax.security.auth.callback.CallbackHandler; -import javax.security.auth.callback.PasswordCallback; -import javax.security.auth.callback.UnsupportedCallbackException; import java.io.IOException; import java.io.InputStream; import java.math.BigInteger; -import java.nio.ByteBuffer; import java.security.*; -import java.security.cert.Certificate; import java.security.cert.*; import java.security.interfaces.ECPrivateKey; -import java.security.spec.ECParameterSpec; -import java.util.Collection; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Map; /** diff --git a/meerkat-common/src/main/java/meerkat/crypto/concrete/ECDSASignature.java b/meerkat-common/src/main/java/meerkat/crypto/concrete/ECDSASignature.java index 6cbcf8d..615b06e 100644 --- a/meerkat-common/src/main/java/meerkat/crypto/concrete/ECDSASignature.java +++ b/meerkat-common/src/main/java/meerkat/crypto/concrete/ECDSASignature.java @@ -108,7 +108,6 @@ public class ECDSASignature extends GlobalCryptoSetup implements DigitalSignatur logger.error("Certificate must be in X509 format; got {} instead!", cert.getClass().getCanonicalName()); continue; } - PublicKey pubKey = cert.getPublicKey(); ByteString keyId = computeCertificateFingerprint(cert); loadedCertificates.put(keyId, cert); } diff --git a/meerkat-common/src/main/java/meerkat/crypto/concrete/ECElGamalEncryption.java b/meerkat-common/src/main/java/meerkat/crypto/concrete/ECElGamalEncryption.java index 8718dd7..1e075bf 100644 --- a/meerkat-common/src/main/java/meerkat/crypto/concrete/ECElGamalEncryption.java +++ b/meerkat-common/src/main/java/meerkat/crypto/concrete/ECElGamalEncryption.java @@ -1,7 +1,6 @@ package meerkat.crypto.concrete; import com.google.protobuf.ByteString; -import com.google.protobuf.CodedOutputStream; import com.google.protobuf.InvalidProtocolBufferException; import com.google.protobuf.Message; import meerkat.crypto.Encryption; @@ -14,22 +13,18 @@ import org.bouncycastle.crypto.params.ECPublicKeyParameters; import org.bouncycastle.crypto.util.PublicKeyFactory; import org.bouncycastle.jce.spec.ECParameterSpec; import org.bouncycastle.math.ec.ECCurve; -import org.bouncycastle.math.ec.ECFieldElement; import org.bouncycastle.math.ec.ECPoint; import org.bouncycastle.util.BigIntegers; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import qilin.primitives.concrete.ECElGamal; import qilin.primitives.concrete.ECGroup; -import qilin.primitives.PseudorandomGenerator; -import qilin.primitives.generic.ElGamal; import qilin.util.PRGRandom; import qilin.util.Pair; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.math.BigInteger; -import java.security.SecureRandom; import java.security.spec.*; import java.util.Random; diff --git a/meerkat-common/src/test/java/meerkat/crypto/concrete/ECDSADeterministicSignatureTest.java b/meerkat-common/src/test/java/meerkat/crypto/concrete/ECDSADeterministicSignatureTest.java index 95b9d3e..cc41497 100644 --- a/meerkat-common/src/test/java/meerkat/crypto/concrete/ECDSADeterministicSignatureTest.java +++ b/meerkat-common/src/test/java/meerkat/crypto/concrete/ECDSADeterministicSignatureTest.java @@ -2,14 +2,12 @@ package meerkat.crypto.concrete; import com.google.protobuf.ByteString; import com.google.protobuf.Message; -import meerkat.protobuf.BulletinBoardAPI.UnsignedBulletinBoardMessage; + +import meerkat.crypto.concrete.ECDSASignature; import meerkat.protobuf.Crypto; import org.junit.Test; -import java.io.InputStream; import java.math.BigInteger; -import java.security.KeyStore; - import static org.junit.Assert.*; /** diff --git a/meerkat-common/src/test/java/meerkat/crypto/concrete/ECDSASignatureTest.java b/meerkat-common/src/test/java/meerkat/crypto/concrete/ECDSASignatureTest.java index e0337a9..37c2d1b 100644 --- a/meerkat-common/src/test/java/meerkat/crypto/concrete/ECDSASignatureTest.java +++ b/meerkat-common/src/test/java/meerkat/crypto/concrete/ECDSASignatureTest.java @@ -3,7 +3,7 @@ package meerkat.crypto.concrete; import com.google.protobuf.ByteString; import com.google.protobuf.Message; import meerkat.protobuf.Crypto; -import meerkat.protobuf.BulletinBoardAPI.*; +import meerkat.crypto.concrete.ECDSASignature; import org.junit.Before; import org.junit.Test; diff --git a/meerkat-common/src/test/java/meerkat/crypto/concrete/ECElGamalEncryptionTest.java b/meerkat-common/src/test/java/meerkat/crypto/concrete/ECElGamalEncryptionTest.java index 0d628e8..bb52df9 100644 --- a/meerkat-common/src/test/java/meerkat/crypto/concrete/ECElGamalEncryptionTest.java +++ b/meerkat-common/src/test/java/meerkat/crypto/concrete/ECElGamalEncryptionTest.java @@ -1,18 +1,15 @@ package meerkat.crypto.concrete; -import meerkat.protobuf.BulletinBoardAPI; import meerkat.protobuf.ConcreteCrypto; import meerkat.protobuf.Crypto; import meerkat.protobuf.Voting; import org.bouncycastle.math.ec.ECPoint; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import qilin.primitives.concrete.ECElGamal; import qilin.primitives.concrete.ECGroup; -import qilin.primitives.generic.ElGamal; import qilin.util.Pair; import java.math.BigInteger; diff --git a/meerkat-common/src/test/java/meerkat/crypto/concrete/ECElGamalUtils.java b/meerkat-common/src/test/java/meerkat/crypto/concrete/ECElGamalUtils.java index fec4803..44efe69 100644 --- a/meerkat-common/src/test/java/meerkat/crypto/concrete/ECElGamalUtils.java +++ b/meerkat-common/src/test/java/meerkat/crypto/concrete/ECElGamalUtils.java @@ -77,7 +77,7 @@ public class ECElGamalUtils { try { java.lang.reflect.Method newBuilder = plaintextMessageType.getMethod("newBuilder"); - GeneratedMessage.Builder builder = (GeneratedMessage.Builder) newBuilder.invoke(plaintextMessageType); + GeneratedMessage.Builder builder = (GeneratedMessage.Builder) newBuilder.invoke(plaintextMessageType); builder.mergeDelimitedFrom(in); return plaintextMessageType.cast(builder.build()); } catch (Exception e) { diff --git a/restful-api-common/src/main/java/meerkat/rest/ProtobufMessageBodyReader.java b/restful-api-common/src/main/java/meerkat/rest/ProtobufMessageBodyReader.java index 853d962..d09e213 100644 --- a/restful-api-common/src/main/java/meerkat/rest/ProtobufMessageBodyReader.java +++ b/restful-api-common/src/main/java/meerkat/rest/ProtobufMessageBodyReader.java @@ -32,7 +32,7 @@ public class ProtobufMessageBodyReader implements MessageBodyReader { InputStream entityStream) throws IOException, WebApplicationException { try { Method newBuilder = type.getMethod("newBuilder"); - GeneratedMessage.Builder builder = (GeneratedMessage.Builder) newBuilder.invoke(type); + GeneratedMessage.Builder builder = (GeneratedMessage.Builder) newBuilder.invoke(type); return builder.mergeFrom(entityStream).build(); } catch (Exception e) { throw new WebApplicationException(e);