diff --git a/README.md b/README.md index eb5cdfc..19ce171 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ BitmessageContext ctx = new BitmessageContext.Builder() .messageRepo(new JdbcMessageRepository(jdbcConfig)) .nodeRegistry(new MemoryNodeRegistry()) .networkHandler(new NetworkNode()) + .cryptography(new BouncyCryptography()) .build(); ``` This creates a simple context using a H2 database that will be created in the user's home directory. Next you'll need to diff --git a/security-bc/build.gradle b/cryptography-bc/build.gradle similarity index 61% rename from security-bc/build.gradle rename to cryptography-bc/build.gradle index ff37994..0634154 100644 --- a/security-bc/build.gradle +++ b/cryptography-bc/build.gradle @@ -2,9 +2,9 @@ uploadArchives { repositories { mavenDeployer { pom.project { - name 'Jabit Bouncy Security' - artifactId = 'jabit-security-bouncy' - description 'The Security implementation using bouncy castle' + name 'Jabit Bouncy Cryptography' + artifactId = 'jabit-cryptography-bouncy' + description 'The Cryptography implementation using bouncy castle' } } } diff --git a/security-bc/src/main/java/ch/dissem/bitmessage/security/bc/BouncySecurity.java b/cryptography-bc/src/main/java/ch/dissem/bitmessage/cryptography/bc/BouncyCryptography.java similarity index 96% rename from security-bc/src/main/java/ch/dissem/bitmessage/security/bc/BouncySecurity.java rename to cryptography-bc/src/main/java/ch/dissem/bitmessage/cryptography/bc/BouncyCryptography.java index a125049..28be67a 100644 --- a/security-bc/src/main/java/ch/dissem/bitmessage/security/bc/BouncySecurity.java +++ b/cryptography-bc/src/main/java/ch/dissem/bitmessage/cryptography/bc/BouncyCryptography.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package ch.dissem.bitmessage.security.bc; +package ch.dissem.bitmessage.cryptography.bc; import ch.dissem.bitmessage.entity.payload.Pubkey; import ch.dissem.bitmessage.entity.valueobject.PrivateKey; -import ch.dissem.bitmessage.ports.AbstractSecurity; +import ch.dissem.bitmessage.ports.AbstractCryptography; import org.bouncycastle.asn1.x9.X9ECParameters; import org.bouncycastle.crypto.BufferedBlockCipher; import org.bouncycastle.crypto.CipherParameters; @@ -47,14 +47,14 @@ import java.util.Arrays; * As Spongycastle can't be used on the Oracle JVM, and Bouncycastle doesn't work properly on Android (thanks, Google), * this is the Bouncycastle implementation. */ -public class BouncySecurity extends AbstractSecurity { +public class BouncyCryptography extends AbstractCryptography { private static final X9ECParameters EC_CURVE_PARAMETERS = CustomNamedCurves.getByName("secp256k1"); static { java.security.Security.addProvider(new BouncyCastleProvider()); } - public BouncySecurity() { + public BouncyCryptography() { super("BC"); } diff --git a/security-bc/src/test/java/ch/dissem/bitmessage/security/SecurityTest.java b/cryptography-bc/src/test/java/ch/dissem/bitmessage/security/CryptographyTest.java similarity index 94% rename from security-bc/src/test/java/ch/dissem/bitmessage/security/SecurityTest.java rename to cryptography-bc/src/test/java/ch/dissem/bitmessage/security/CryptographyTest.java index 3aef7a8..3a68968 100644 --- a/security-bc/src/test/java/ch/dissem/bitmessage/security/SecurityTest.java +++ b/cryptography-bc/src/test/java/ch/dissem/bitmessage/security/CryptographyTest.java @@ -5,7 +5,7 @@ import ch.dissem.bitmessage.entity.ObjectMessage; import ch.dissem.bitmessage.entity.payload.GenericPayload; import ch.dissem.bitmessage.ports.MultiThreadedPOWEngine; import ch.dissem.bitmessage.ports.ProofOfWorkEngine; -import ch.dissem.bitmessage.security.bc.BouncySecurity; +import ch.dissem.bitmessage.cryptography.bc.BouncyCryptography; import ch.dissem.bitmessage.utils.CallbackWaiter; import ch.dissem.bitmessage.utils.Singleton; import ch.dissem.bitmessage.utils.UnixTime; @@ -23,7 +23,7 @@ import static org.mockito.Mockito.when; /** * Created by chris on 19.07.15. */ -public class SecurityTest { +public class CryptographyTest { public static final byte[] TEST_VALUE = "teststring".getBytes(); public static final byte[] TEST_SHA1 = DatatypeConverter.parseHexBinary("" + "b8473b86d4c2072ca9b08bd28e373e8253e865c4"); @@ -33,10 +33,10 @@ public class SecurityTest { public static final byte[] TEST_RIPEMD160 = DatatypeConverter.parseHexBinary("" + "cd566972b5e50104011a92b59fa8e0b1234851ae"); - private static BouncySecurity security; + private static BouncyCryptography security; - public SecurityTest() { - security = new BouncySecurity(); + public CryptographyTest() { + security = new BouncyCryptography(); Singleton.initialize(security); InternalContext ctx = mock(InternalContext.class); when(ctx.getProofOfWorkEngine()).thenReturn(new MultiThreadedPOWEngine()); diff --git a/security-sc/build.gradle b/cryptography-sc/build.gradle similarity index 54% rename from security-sc/build.gradle rename to cryptography-sc/build.gradle index bfbdcab..2d4f82f 100644 --- a/security-sc/build.gradle +++ b/cryptography-sc/build.gradle @@ -2,9 +2,9 @@ uploadArchives { repositories { mavenDeployer { pom.project { - name 'Jabit Spongy Security' - artifactId = 'jabit-security-spongy' - description 'The Security implementation using spongy castle (needed for Android)' + name 'Jabit Spongy Cryptography' + artifactId = 'jabit-cryptography-spongy' + description 'The Cryptography implementation using spongy castle (needed for Android)' } } } diff --git a/security-sc/src/main/java/ch/dissem/bitmessage/security/sc/SpongySecurity.java b/cryptography-sc/src/main/java/ch/dissem/bitmessage/cryptography/sc/SpongyCryptography.java similarity index 96% rename from security-sc/src/main/java/ch/dissem/bitmessage/security/sc/SpongySecurity.java rename to cryptography-sc/src/main/java/ch/dissem/bitmessage/cryptography/sc/SpongyCryptography.java index 70a0743..c9506fb 100644 --- a/security-sc/src/main/java/ch/dissem/bitmessage/security/sc/SpongySecurity.java +++ b/cryptography-sc/src/main/java/ch/dissem/bitmessage/cryptography/sc/SpongyCryptography.java @@ -14,11 +14,11 @@ * limitations under the License. */ -package ch.dissem.bitmessage.security.sc; +package ch.dissem.bitmessage.cryptography.sc; import ch.dissem.bitmessage.entity.payload.Pubkey; import ch.dissem.bitmessage.entity.valueobject.PrivateKey; -import ch.dissem.bitmessage.ports.AbstractSecurity; +import ch.dissem.bitmessage.ports.AbstractCryptography; import org.spongycastle.asn1.x9.X9ECParameters; import org.spongycastle.crypto.BufferedBlockCipher; import org.spongycastle.crypto.CipherParameters; @@ -47,14 +47,14 @@ import java.util.Arrays; * As Spongycastle can't be used on the Oracle JVM, and Bouncycastle doesn't work properly on Android (thanks, Google), * this is the Spongycastle implementation. */ -public class SpongySecurity extends AbstractSecurity { +public class SpongyCryptography extends AbstractCryptography { private static final X9ECParameters EC_CURVE_PARAMETERS = CustomNamedCurves.getByName("secp256k1"); static { java.security.Security.addProvider(new BouncyCastleProvider()); } - public SpongySecurity() { + public SpongyCryptography() { super("SC"); } diff --git a/demo/build.gradle b/demo/build.gradle index e4c51a7..e520157 100644 --- a/demo/build.gradle +++ b/demo/build.gradle @@ -24,7 +24,7 @@ dependencies { compile project(':domain') compile project(':networking') compile project(':repositories') - compile project(':security-bc') + compile project(':cryptography-bc') compile project(':wif') compile 'org.slf4j:slf4j-simple:1.7.12' compile 'args4j:args4j:2.32' diff --git a/demo/src/main/java/ch/dissem/bitmessage/demo/Application.java b/demo/src/main/java/ch/dissem/bitmessage/demo/Application.java index 72da50d..f35bcc5 100644 --- a/demo/src/main/java/ch/dissem/bitmessage/demo/Application.java +++ b/demo/src/main/java/ch/dissem/bitmessage/demo/Application.java @@ -23,7 +23,7 @@ import ch.dissem.bitmessage.entity.payload.Pubkey; import ch.dissem.bitmessage.networking.DefaultNetworkHandler; import ch.dissem.bitmessage.ports.MemoryNodeRegistry; import ch.dissem.bitmessage.repository.*; -import ch.dissem.bitmessage.security.bc.BouncySecurity; +import ch.dissem.bitmessage.cryptography.bc.BouncyCryptography; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,7 +49,7 @@ public class Application { .messageRepo(new JdbcMessageRepository(jdbcConfig)) .powRepo(new JdbcProofOfWorkRepository(jdbcConfig)) .networkHandler(new DefaultNetworkHandler()) - .security(new BouncySecurity()) + .cryptography(new BouncyCryptography()) .port(48444) .listener(new BitmessageContext.Listener() { @Override diff --git a/demo/src/main/java/ch/dissem/bitmessage/demo/Main.java b/demo/src/main/java/ch/dissem/bitmessage/demo/Main.java index 6dbfc14..a7b63d1 100644 --- a/demo/src/main/java/ch/dissem/bitmessage/demo/Main.java +++ b/demo/src/main/java/ch/dissem/bitmessage/demo/Main.java @@ -20,7 +20,7 @@ import ch.dissem.bitmessage.BitmessageContext; import ch.dissem.bitmessage.networking.DefaultNetworkHandler; import ch.dissem.bitmessage.ports.MemoryNodeRegistry; import ch.dissem.bitmessage.repository.*; -import ch.dissem.bitmessage.security.bc.BouncySecurity; +import ch.dissem.bitmessage.cryptography.bc.BouncyCryptography; import ch.dissem.bitmessage.wif.WifExporter; import ch.dissem.bitmessage.wif.WifImporter; import org.kohsuke.args4j.CmdLineException; @@ -53,7 +53,7 @@ public class Main { .messageRepo(new JdbcMessageRepository(jdbcConfig)) .powRepo(new JdbcProofOfWorkRepository(jdbcConfig)) .networkHandler(new DefaultNetworkHandler()) - .security(new BouncySecurity()) + .cryptography(new BouncyCryptography()) .port(48444) .build(); diff --git a/domain/build.gradle b/domain/build.gradle index 1880c6b..484abfd 100644 --- a/domain/build.gradle +++ b/domain/build.gradle @@ -27,5 +27,5 @@ dependencies { compile 'org.slf4j:slf4j-api:1.7.12' testCompile 'junit:junit:4.11' testCompile 'org.mockito:mockito-core:1.10.19' - testCompile project(':security-bc') + testCompile project(':cryptography-bc') } diff --git a/domain/src/main/java/ch/dissem/bitmessage/BitmessageContext.java b/domain/src/main/java/ch/dissem/bitmessage/BitmessageContext.java index 1c4295e..1f34c9d 100644 --- a/domain/src/main/java/ch/dissem/bitmessage/BitmessageContext.java +++ b/domain/src/main/java/ch/dissem/bitmessage/BitmessageContext.java @@ -325,7 +325,7 @@ public class BitmessageContext { MessageRepository messageRepo; ProofOfWorkRepository proofOfWorkRepository; ProofOfWorkEngine proofOfWorkEngine; - Security security; + Cryptography cryptography; MessageCallback messageCallback; CustomCommandHandler customCommandHandler; Listener listener; @@ -372,8 +372,8 @@ public class BitmessageContext { return this; } - public Builder security(Security security) { - this.security = security; + public Builder cryptography(Cryptography cryptography) { + this.cryptography = cryptography; return this; } diff --git a/domain/src/main/java/ch/dissem/bitmessage/InternalContext.java b/domain/src/main/java/ch/dissem/bitmessage/InternalContext.java index 1fe8007..9971b9b 100644 --- a/domain/src/main/java/ch/dissem/bitmessage/InternalContext.java +++ b/domain/src/main/java/ch/dissem/bitmessage/InternalContext.java @@ -42,7 +42,7 @@ import java.util.TreeSet; public class InternalContext { private final static Logger LOG = LoggerFactory.getLogger(InternalContext.class); - private final Security security; + private final Cryptography cryptography; private final Inventory inventory; private final NodeRegistry nodeRegistry; private final NetworkHandler networkHandler; @@ -64,7 +64,7 @@ public class InternalContext { private int connectionLimit; public InternalContext(BitmessageContext.Builder builder) { - this.security = builder.security; + this.cryptography = builder.cryptography; this.inventory = builder.inventory; this.nodeRegistry = builder.nodeRegistry; this.networkHandler = builder.networkHandler; @@ -73,7 +73,7 @@ public class InternalContext { this.proofOfWorkRepository = builder.proofOfWorkRepository; this.proofOfWorkService = new ProofOfWorkService(); this.proofOfWorkEngine = builder.proofOfWorkEngine; - this.clientNonce = security.randomNonce(); + this.clientNonce = cryptography.randomNonce(); this.messageCallback = builder.messageCallback; this.customCommandHandler = builder.customCommandHandler; this.port = builder.port; @@ -81,7 +81,7 @@ public class InternalContext { this.connectionTTL = builder.connectionTTL; this.pubkeyTTL = builder.pubkeyTTL; - Singleton.initialize(security); + Singleton.initialize(cryptography); // TODO: streams of new identities and subscriptions should also be added. This works only after a restart. for (BitmessageAddress address : addressRepository.getIdentities()) { @@ -94,7 +94,7 @@ public class InternalContext { streams.add(1L); } - init(security, inventory, nodeRegistry, networkHandler, addressRepository, messageRepository, + init(cryptography, inventory, nodeRegistry, networkHandler, addressRepository, messageRepository, proofOfWorkRepository, proofOfWorkService, proofOfWorkEngine, messageCallback, customCommandHandler); for (BitmessageAddress identity : addressRepository.getIdentities()) { @@ -110,8 +110,8 @@ public class InternalContext { } } - public Security getSecurity() { - return security; + public Cryptography getCryptography() { + return cryptography; } public Inventory getInventory() { @@ -203,7 +203,7 @@ public class InternalContext { .payload(identity.getPubkey()) .build(); response.sign(identity.getPrivateKey()); - response.encrypt(security.createPublicKey(identity.getPublicDecryptionKey())); + response.encrypt(cryptography.createPublicKey(identity.getPublicDecryptionKey())); messageCallback.proofOfWorkStarted(identity.getPubkey()); // TODO: remember that the pubkey is just about to be sent, and on which stream! proofOfWorkService.doProofOfWork(response); diff --git a/domain/src/main/java/ch/dissem/bitmessage/ProofOfWorkService.java b/domain/src/main/java/ch/dissem/bitmessage/ProofOfWorkService.java index 82c384c..19e231f 100644 --- a/domain/src/main/java/ch/dissem/bitmessage/ProofOfWorkService.java +++ b/domain/src/main/java/ch/dissem/bitmessage/ProofOfWorkService.java @@ -7,7 +7,7 @@ import ch.dissem.bitmessage.entity.PlaintextHolder; import ch.dissem.bitmessage.ports.MessageRepository; import ch.dissem.bitmessage.ports.ProofOfWorkEngine; import ch.dissem.bitmessage.ports.ProofOfWorkRepository; -import ch.dissem.bitmessage.ports.Security; +import ch.dissem.bitmessage.ports.Cryptography; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -21,7 +21,7 @@ import static ch.dissem.bitmessage.utils.Singleton.security; public class ProofOfWorkService implements ProofOfWorkEngine.Callback, InternalContext.ContextHolder { private final static Logger LOG = LoggerFactory.getLogger(ProofOfWorkService.class); - private Security security; + private Cryptography cryptography; private InternalContext ctx; private ProofOfWorkRepository powRepo; private MessageRepository messageRepo; @@ -33,7 +33,7 @@ public class ProofOfWorkService implements ProofOfWorkEngine.Callback, InternalC LOG.info("Doing POW for " + items.size() + " tasks."); for (byte[] initialHash : items) { ProofOfWorkRepository.Item item = powRepo.getItem(initialHash); - security.doProofOfWork(item.object, item.nonceTrialsPerByte, item.extraBytes, this); + cryptography.doProofOfWork(item.object, item.nonceTrialsPerByte, item.extraBytes, this); } } @@ -50,10 +50,10 @@ public class ProofOfWorkService implements ProofOfWorkEngine.Callback, InternalC powRepo.putObject(object, nonceTrialsPerByte, extraBytes); if (object.getPayload() instanceof PlaintextHolder) { Plaintext plaintext = ((PlaintextHolder) object.getPayload()).getPlaintext(); - plaintext.setInitialHash(security.getInitialHash(object)); + plaintext.setInitialHash(cryptography.getInitialHash(object)); messageRepo.save(plaintext); } - security.doProofOfWork(object, nonceTrialsPerByte, extraBytes, this); + cryptography.doProofOfWork(object, nonceTrialsPerByte, extraBytes, this); } @Override @@ -75,7 +75,7 @@ public class ProofOfWorkService implements ProofOfWorkEngine.Callback, InternalC @Override public void setContext(InternalContext ctx) { this.ctx = ctx; - this.security = security(); + this.cryptography = security(); this.powRepo = ctx.getProofOfWorkRepository(); this.messageRepo = ctx.getMessageRepository(); } diff --git a/domain/src/main/java/ch/dissem/bitmessage/entity/Encrypted.java b/domain/src/main/java/ch/dissem/bitmessage/entity/Encrypted.java index 9eaa2ab..8b15371 100644 --- a/domain/src/main/java/ch/dissem/bitmessage/entity/Encrypted.java +++ b/domain/src/main/java/ch/dissem/bitmessage/entity/Encrypted.java @@ -17,7 +17,6 @@ package ch.dissem.bitmessage.entity; import ch.dissem.bitmessage.exception.DecryptionFailedException; -import ch.dissem.bitmessage.ports.Security; import java.io.IOException; diff --git a/domain/src/main/java/ch/dissem/bitmessage/entity/ObjectMessage.java b/domain/src/main/java/ch/dissem/bitmessage/entity/ObjectMessage.java index 9e89c42..99b3aec 100644 --- a/domain/src/main/java/ch/dissem/bitmessage/entity/ObjectMessage.java +++ b/domain/src/main/java/ch/dissem/bitmessage/entity/ObjectMessage.java @@ -22,7 +22,6 @@ import ch.dissem.bitmessage.entity.payload.Pubkey; import ch.dissem.bitmessage.entity.valueobject.InventoryVector; import ch.dissem.bitmessage.entity.valueobject.PrivateKey; import ch.dissem.bitmessage.exception.DecryptionFailedException; -import ch.dissem.bitmessage.ports.Security; import ch.dissem.bitmessage.utils.Bytes; import ch.dissem.bitmessage.utils.Encode; diff --git a/domain/src/main/java/ch/dissem/bitmessage/entity/payload/V4Broadcast.java b/domain/src/main/java/ch/dissem/bitmessage/entity/payload/V4Broadcast.java index 03364d2..39127a8 100644 --- a/domain/src/main/java/ch/dissem/bitmessage/entity/payload/V4Broadcast.java +++ b/domain/src/main/java/ch/dissem/bitmessage/entity/payload/V4Broadcast.java @@ -18,7 +18,6 @@ package ch.dissem.bitmessage.entity.payload; import ch.dissem.bitmessage.entity.BitmessageAddress; import ch.dissem.bitmessage.entity.Plaintext; -import ch.dissem.bitmessage.ports.Security; import java.io.IOException; import java.io.InputStream; diff --git a/domain/src/main/java/ch/dissem/bitmessage/ports/AbstractSecurity.java b/domain/src/main/java/ch/dissem/bitmessage/ports/AbstractCryptography.java similarity index 96% rename from domain/src/main/java/ch/dissem/bitmessage/ports/AbstractSecurity.java rename to domain/src/main/java/ch/dissem/bitmessage/ports/AbstractCryptography.java index 053a776..3cf3f0d 100644 --- a/domain/src/main/java/ch/dissem/bitmessage/ports/AbstractSecurity.java +++ b/domain/src/main/java/ch/dissem/bitmessage/ports/AbstractCryptography.java @@ -39,8 +39,8 @@ import static ch.dissem.bitmessage.utils.Numbers.max; /** * Implements everything that isn't directly dependent on either Spongy- or Bouncycastle. */ -public abstract class AbstractSecurity implements Security, InternalContext.ContextHolder { - public static final Logger LOG = LoggerFactory.getLogger(Security.class); +public abstract class AbstractCryptography implements Cryptography, InternalContext.ContextHolder { + public static final Logger LOG = LoggerFactory.getLogger(Cryptography.class); private static final SecureRandom RANDOM = new SecureRandom(); private static final BigInteger TWO = BigInteger.valueOf(2); private static final BigInteger TWO_POW_64 = TWO.pow(64); @@ -49,7 +49,7 @@ public abstract class AbstractSecurity implements Security, InternalContext.Cont private final String provider; private InternalContext context; - protected AbstractSecurity(String provider) { + protected AbstractCryptography(String provider) { this.provider = provider; } diff --git a/domain/src/main/java/ch/dissem/bitmessage/ports/Security.java b/domain/src/main/java/ch/dissem/bitmessage/ports/Cryptography.java similarity index 99% rename from domain/src/main/java/ch/dissem/bitmessage/ports/Security.java rename to domain/src/main/java/ch/dissem/bitmessage/ports/Cryptography.java index e76b21f..48739ea 100644 --- a/domain/src/main/java/ch/dissem/bitmessage/ports/Security.java +++ b/domain/src/main/java/ch/dissem/bitmessage/ports/Cryptography.java @@ -29,7 +29,7 @@ import java.security.SecureRandom; * Provides some methods to help with hashing and encryption. All randoms are created using {@link SecureRandom}, * which should be secure enough. */ -public interface Security { +public interface Cryptography { /** * A helper method to calculate SHA-512 hashes. Please note that a new {@link MessageDigest} object is created at * each call (to ensure thread safety), so you shouldn't use this if you need to do many hash calculations in diff --git a/domain/src/main/java/ch/dissem/bitmessage/utils/Singleton.java b/domain/src/main/java/ch/dissem/bitmessage/utils/Singleton.java index d272beb..0c7134b 100644 --- a/domain/src/main/java/ch/dissem/bitmessage/utils/Singleton.java +++ b/domain/src/main/java/ch/dissem/bitmessage/utils/Singleton.java @@ -16,23 +16,23 @@ package ch.dissem.bitmessage.utils; -import ch.dissem.bitmessage.ports.Security; +import ch.dissem.bitmessage.ports.Cryptography; /** * Created by chris on 20.07.15. */ public class Singleton { - private static Security security; + private static Cryptography cryptography; - public static void initialize(Security security) { + public static void initialize(Cryptography cryptography) { synchronized (Singleton.class) { - if (Singleton.security == null) { - Singleton.security = security; + if (Singleton.cryptography == null) { + Singleton.cryptography = cryptography; } } } - public static Security security() { - return security; + public static Cryptography security() { + return cryptography; } } diff --git a/domain/src/test/java/ch/dissem/bitmessage/utils/TestBase.java b/domain/src/test/java/ch/dissem/bitmessage/utils/TestBase.java index 1dd1335..e757d91 100644 --- a/domain/src/test/java/ch/dissem/bitmessage/utils/TestBase.java +++ b/domain/src/test/java/ch/dissem/bitmessage/utils/TestBase.java @@ -16,13 +16,13 @@ package ch.dissem.bitmessage.utils; -import ch.dissem.bitmessage.security.bc.BouncySecurity; +import ch.dissem.bitmessage.cryptography.bc.BouncyCryptography; /** * Created by chris on 20.07.15. */ public class TestBase { static { - Singleton.initialize(new BouncySecurity()); + Singleton.initialize(new BouncyCryptography()); } } diff --git a/extensions/build.gradle b/extensions/build.gradle index 0ae9fd4..c92eb96 100644 --- a/extensions/build.gradle +++ b/extensions/build.gradle @@ -32,5 +32,5 @@ dependencies { testCompile 'org.slf4j:slf4j-simple:1.7.12' testCompile 'org.mockito:mockito-core:1.10.19' testCompile project(path: ':domain', configuration: 'testArtifacts') - testCompile project(':security-bc') + testCompile project(':cryptography-bc') } diff --git a/networking/build.gradle b/networking/build.gradle index 06bd5d0..788bc4d 100644 --- a/networking/build.gradle +++ b/networking/build.gradle @@ -16,5 +16,5 @@ dependencies { testCompile 'org.slf4j:slf4j-simple:1.7.12' testCompile 'org.mockito:mockito-core:1.10.19' testCompile project(path: ':domain', configuration: 'testArtifacts') - testCompile project(':security-bc') + testCompile project(':cryptography-bc') } \ No newline at end of file diff --git a/networking/src/test/java/ch/dissem/bitmessage/networking/NetworkHandlerTest.java b/networking/src/test/java/ch/dissem/bitmessage/networking/NetworkHandlerTest.java index ccd2b67..499e377 100644 --- a/networking/src/test/java/ch/dissem/bitmessage/networking/NetworkHandlerTest.java +++ b/networking/src/test/java/ch/dissem/bitmessage/networking/NetworkHandlerTest.java @@ -22,7 +22,7 @@ import ch.dissem.bitmessage.ports.AddressRepository; import ch.dissem.bitmessage.ports.MessageRepository; import ch.dissem.bitmessage.ports.NetworkHandler; import ch.dissem.bitmessage.ports.ProofOfWorkRepository; -import ch.dissem.bitmessage.security.bc.BouncySecurity; +import ch.dissem.bitmessage.cryptography.bc.BouncyCryptography; import ch.dissem.bitmessage.utils.Property; import org.junit.AfterClass; import org.junit.BeforeClass; @@ -59,7 +59,7 @@ public class NetworkHandlerTest { .port(6001) .nodeRegistry(new TestNodeRegistry()) .networkHandler(new DefaultNetworkHandler()) - .security(new BouncySecurity()) + .cryptography(new BouncyCryptography()) .listener(Mockito.mock(BitmessageContext.Listener.class)) .build(); peer.startup(); @@ -74,7 +74,7 @@ public class NetworkHandlerTest { .port(6002) .nodeRegistry(new TestNodeRegistry(localhost)) .networkHandler(networkHandler) - .security(new BouncySecurity()) + .cryptography(new BouncyCryptography()) .listener(Mockito.mock(BitmessageContext.Listener.class)) .build(); } diff --git a/repositories/build.gradle b/repositories/build.gradle index fecebce..cfbc9ea 100644 --- a/repositories/build.gradle +++ b/repositories/build.gradle @@ -18,5 +18,5 @@ dependencies { testCompile 'junit:junit:4.12' testCompile 'com.h2database:h2:1.4.190' testCompile 'org.mockito:mockito-core:1.10.19' - testCompile project(':security-bc') + testCompile project(':cryptography-bc') } \ No newline at end of file diff --git a/repositories/src/test/java/ch/dissem/bitmessage/repository/JdbcMessageRepositoryTest.java b/repositories/src/test/java/ch/dissem/bitmessage/repository/JdbcMessageRepositoryTest.java index 3dceb24..c7c3614 100644 --- a/repositories/src/test/java/ch/dissem/bitmessage/repository/JdbcMessageRepositoryTest.java +++ b/repositories/src/test/java/ch/dissem/bitmessage/repository/JdbcMessageRepositoryTest.java @@ -55,7 +55,7 @@ public class JdbcMessageRepositoryTest extends TestBase { addressRepo = new JdbcAddressRepository(config); repo = new JdbcMessageRepository(config); new InternalContext(new BitmessageContext.Builder() - .security(security()) + .cryptography(security()) .addressRepo(addressRepo) .messageRepo(repo) ); diff --git a/repositories/src/test/java/ch/dissem/bitmessage/repository/TestBase.java b/repositories/src/test/java/ch/dissem/bitmessage/repository/TestBase.java index c6baaa2..be386cd 100644 --- a/repositories/src/test/java/ch/dissem/bitmessage/repository/TestBase.java +++ b/repositories/src/test/java/ch/dissem/bitmessage/repository/TestBase.java @@ -18,7 +18,7 @@ package ch.dissem.bitmessage.repository; import ch.dissem.bitmessage.InternalContext; import ch.dissem.bitmessage.ports.MultiThreadedPOWEngine; -import ch.dissem.bitmessage.security.bc.BouncySecurity; +import ch.dissem.bitmessage.cryptography.bc.BouncyCryptography; import ch.dissem.bitmessage.utils.Singleton; import static org.mockito.Mockito.mock; @@ -29,7 +29,7 @@ import static org.mockito.Mockito.when; */ public class TestBase { static { - BouncySecurity security = new BouncySecurity(); + BouncyCryptography security = new BouncyCryptography(); Singleton.initialize(security); InternalContext ctx = mock(InternalContext.class); when(ctx.getProofOfWorkEngine()).thenReturn(new MultiThreadedPOWEngine()); diff --git a/settings.gradle b/settings.gradle index adecd45..634c473 100644 --- a/settings.gradle +++ b/settings.gradle @@ -10,8 +10,8 @@ include 'demo' include 'wif' -include 'security-sc' +include 'cryptography-sc' -include 'security-bc' +include 'cryptography-bc' include 'extensions' \ No newline at end of file diff --git a/wif/build.gradle b/wif/build.gradle index 5b32a21..ef16682 100644 --- a/wif/build.gradle +++ b/wif/build.gradle @@ -15,5 +15,5 @@ dependencies { compile 'org.ini4j:ini4j:0.5.4' testCompile 'junit:junit:4.11' testCompile 'org.mockito:mockito-core:1.10.19' - testCompile project(':security-bc') + testCompile project(':cryptography-bc') } diff --git a/wif/src/test/java/ch/dissem/bitmessage/wif/WifExporterTest.java b/wif/src/test/java/ch/dissem/bitmessage/wif/WifExporterTest.java index 3e75a15..b930c0a 100644 --- a/wif/src/test/java/ch/dissem/bitmessage/wif/WifExporterTest.java +++ b/wif/src/test/java/ch/dissem/bitmessage/wif/WifExporterTest.java @@ -18,7 +18,7 @@ package ch.dissem.bitmessage.wif; import ch.dissem.bitmessage.BitmessageContext; import ch.dissem.bitmessage.ports.*; -import ch.dissem.bitmessage.security.bc.BouncySecurity; +import ch.dissem.bitmessage.cryptography.bc.BouncyCryptography; import org.junit.Before; import org.junit.Test; @@ -35,7 +35,7 @@ public class WifExporterTest { @Before public void setUp() throws Exception { ctx = new BitmessageContext.Builder() - .security(new BouncySecurity()) + .cryptography(new BouncyCryptography()) .networkHandler(mock(NetworkHandler.class)) .inventory(mock(Inventory.class)) .messageRepo(mock(MessageRepository.class)) diff --git a/wif/src/test/java/ch/dissem/bitmessage/wif/WifImporterTest.java b/wif/src/test/java/ch/dissem/bitmessage/wif/WifImporterTest.java index d889523..fe8e15c 100644 --- a/wif/src/test/java/ch/dissem/bitmessage/wif/WifImporterTest.java +++ b/wif/src/test/java/ch/dissem/bitmessage/wif/WifImporterTest.java @@ -19,7 +19,7 @@ package ch.dissem.bitmessage.wif; import ch.dissem.bitmessage.BitmessageContext; import ch.dissem.bitmessage.entity.BitmessageAddress; import ch.dissem.bitmessage.ports.*; -import ch.dissem.bitmessage.security.bc.BouncySecurity; +import ch.dissem.bitmessage.cryptography.bc.BouncyCryptography; import org.junit.Before; import org.junit.Test; @@ -38,7 +38,7 @@ public class WifImporterTest { @Before public void setUp() throws Exception { ctx = new BitmessageContext.Builder() - .security(new BouncySecurity()) + .cryptography(new BouncyCryptography()) .networkHandler(mock(NetworkHandler.class)) .inventory(mock(Inventory.class)) .messageRepo(mock(MessageRepository.class))