├── .gitignore ├── LICENSE ├── README ├── build.gradle ├── client ├── build.gradle.disabled └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── cryptoworkshop │ │ │ └── ximix │ │ │ └── client │ │ │ ├── BoardCreationOptions.java │ │ │ ├── BoardCreationService.java │ │ │ ├── BoardDetail.java │ │ │ ├── CommandService.java │ │ │ ├── DownloadOperation.java │ │ │ ├── DownloadOperationListener.java │ │ │ ├── DownloadOptions.java │ │ │ ├── DownloadShuffleResultOperation.java │ │ │ ├── DownloadShuffleResultOptions.java │ │ │ ├── FullInfoData.java │ │ │ ├── KeyGenerationOptions.java │ │ │ ├── KeyGenerationService.java │ │ │ ├── KeyService.java │ │ │ ├── MessageChooser.java │ │ │ ├── MonitorService.java │ │ │ ├── NetworkBoardListener.java │ │ │ ├── NodeDetail.java │ │ │ ├── QueryService.java │ │ │ ├── RegistrarServiceException.java │ │ │ ├── Service.java │ │ │ ├── ShuffleOperation.java │ │ │ ├── ShuffleOperationListener.java │ │ │ ├── ShuffleOptions.java │ │ │ ├── ShuffleStatus.java │ │ │ ├── ShuffleTranscriptOptions.java │ │ │ ├── ShuffleTranscriptSeedDownloadOperationListener.java │ │ │ ├── ShuffleTranscriptsDownloadOperation.java │ │ │ ├── ShuffleTranscriptsDownloadOperationListener.java │ │ │ ├── SignatureGenerationOptions.java │ │ │ ├── SigningService.java │ │ │ ├── StatisticsData.java │ │ │ ├── UploadService.java │ │ │ ├── connection │ │ │ ├── AdminServicesConnection.java │ │ │ ├── ClientCommandService.java │ │ │ ├── ClientNodeHealthMonitor.java │ │ │ ├── ClientServiceConnectionException.java │ │ │ ├── ClientSigningService.java │ │ │ ├── ClientUploadService.java │ │ │ ├── KeyGenerationCommandService.java │ │ │ ├── NodeConfig.java │ │ │ ├── NodeConfigFactory.java │ │ │ ├── NodeConnectionListener.java │ │ │ ├── NodeServicesConnection.java │ │ │ ├── ServiceConnectionException.java │ │ │ ├── ServicesConnection.java │ │ │ ├── ServicesConnectionImpl.java │ │ │ ├── SpecificServicesConnection.java │ │ │ ├── XimixConnectionMapFactory.java │ │ │ ├── XimixRegistrar.java │ │ │ ├── XimixRegistrarFactory.java │ │ │ ├── package-info.java │ │ │ └── signing │ │ │ │ ├── BLSSigningService.java │ │ │ │ ├── BaseSigningService.java │ │ │ │ ├── ECDSASigningService.java │ │ │ │ ├── Participant.java │ │ │ │ ├── SigID.java │ │ │ │ ├── message │ │ │ │ ├── BLSPartialCreateMessage.java │ │ │ │ ├── ECDSAFetchMessage.java │ │ │ │ ├── ECDSAInitialiseMessage.java │ │ │ │ ├── ECDSAPartialCreateMessage.java │ │ │ │ ├── ECDSAPointMessage.java │ │ │ │ ├── MessageUtils.java │ │ │ │ └── package-info.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ └── verify │ │ │ ├── CommitmentVerificationException.java │ │ │ ├── ECDecryptionChallengeVerifier.java │ │ │ ├── ECShuffledTranscriptVerifier.java │ │ │ ├── LinkIndexVerifier.java │ │ │ ├── SignedDataVerifier.java │ │ │ ├── TranscriptVerificationException.java │ │ │ └── package-info.java │ └── resources │ │ └── org │ │ └── cryptoworkshop │ │ └── ximix │ │ └── client │ │ └── connection │ │ └── d62003-159-158.param │ └── test │ └── java │ └── org │ └── cryptoworkshop │ └── ximix │ └── client │ └── verify │ └── test │ └── VerifierTest.java ├── common └── src │ ├── main │ └── java │ │ └── org │ │ └── cryptoworkshop │ │ └── ximix │ │ └── common │ │ ├── asn1 │ │ ├── PartialPublicKeyInfo.java │ │ ├── XimixObjectIdentifiers.java │ │ ├── board │ │ │ ├── Pair.java │ │ │ ├── PairSequence.java │ │ │ ├── PairSequenceWithProofs.java │ │ │ ├── PointSequence.java │ │ │ └── package-info.java │ │ ├── message │ │ │ ├── AlgorithmServiceMessage.java │ │ │ ├── BigIntegerMessage.java │ │ │ ├── BoardCapabilities.java │ │ │ ├── BoardDetailMessage.java │ │ │ ├── BoardDownloadMessage.java │ │ │ ├── BoardErrorStatusMessage.java │ │ │ ├── BoardMessage.java │ │ │ ├── BoardStatusMessage.java │ │ │ ├── BoardUploadBlockMessage.java │ │ │ ├── BoardUploadIndexedMessage.java │ │ │ ├── BoardUploadMessage.java │ │ │ ├── CapabilityMessage.java │ │ │ ├── ChallengeLogMessage.java │ │ │ ├── ClientMessage.java │ │ │ ├── CommandMessage.java │ │ │ ├── CopyAndMoveMessage.java │ │ │ ├── CreateBoardMessage.java │ │ │ ├── DecryptDataMessage.java │ │ │ ├── DecryptShuffledBoardMessage.java │ │ │ ├── DownloadShuffledBoardMessage.java │ │ │ ├── ECPointMessage.java │ │ │ ├── ElementMessage.java │ │ │ ├── ErrorMessage.java │ │ │ ├── FetchPartialPublicKeyMessage.java │ │ │ ├── FetchPublicKeyMessage.java │ │ │ ├── FileTransferMessage.java │ │ │ ├── IDMessage.java │ │ │ ├── KeyGenParams.java │ │ │ ├── KeyGenerationMessage.java │ │ │ ├── KeyGenerationParameters.java │ │ │ ├── KeyIDMessage.java │ │ │ ├── KeyPairGenerateMessage.java │ │ │ ├── Message.java │ │ │ ├── MessageCommitment.java │ │ │ ├── MessageReply.java │ │ │ ├── MessageType.java │ │ │ ├── MessageUtils.java │ │ │ ├── MessageWitness.java │ │ │ ├── MessageWitnessBlock.java │ │ │ ├── NamedKeyGenParams.java │ │ │ ├── NodeInfo.java │ │ │ ├── NodeStatusMessage.java │ │ │ ├── NodeStatusRequestMessage.java │ │ │ ├── ParticipantMessage.java │ │ │ ├── PermuteAndMoveMessage.java │ │ │ ├── PostedData.java │ │ │ ├── PostedMessage.java │ │ │ ├── PostedMessageBlock.java │ │ │ ├── PostedMessageDataBlock.java │ │ │ ├── SeedAndWitnessMessage.java │ │ │ ├── SeedCommitmentMessage.java │ │ │ ├── SeedMessage.java │ │ │ ├── ShareMessage.java │ │ │ ├── SignatureCreateMessage.java │ │ │ ├── SignatureMessage.java │ │ │ ├── StoreMessage.java │ │ │ ├── TranscriptBlock.java │ │ │ ├── TranscriptDownloadMessage.java │ │ │ ├── TranscriptQueryMessage.java │ │ │ ├── TranscriptQueryResponse.java │ │ │ ├── TranscriptTransferMessage.java │ │ │ ├── TransitBoardMessage.java │ │ │ └── package-info.java │ │ └── package-info.java │ │ ├── config │ │ ├── Config.java │ │ ├── ConfigException.java │ │ ├── ConfigObjectFactory.java │ │ └── package-info.java │ │ ├── crypto │ │ ├── Algorithm.java │ │ ├── BLSPublicKeyFactory.java │ │ ├── ECDecryptionProof.java │ │ ├── IndexCommitter.java │ │ ├── package-info.java │ │ └── threshold │ │ │ ├── BLSCommittedSecretShare.java │ │ │ ├── BLSCommittedSplitSecret.java │ │ │ ├── BLSNewDKGSecretSplitter.java │ │ │ ├── ECCommittedSecretShare.java │ │ │ ├── ECCommittedSplitSecret.java │ │ │ ├── ECNewDKGSecretSplitter.java │ │ │ ├── LagrangeWeightCalculator.java │ │ │ ├── ShamirSecretSplitter.java │ │ │ ├── SplitSecret.java │ │ │ └── package-info.java │ │ └── util │ │ ├── DecoupledListenerHandlerFactory.java │ │ ├── EventNotifier.java │ │ ├── IndexNumberGenerator.java │ │ ├── JDKLoggingEventNotifier.java │ │ ├── ListenerHandler.java │ │ ├── ListenerHandlerFactory.java │ │ ├── Operation.java │ │ ├── OperationListener.java │ │ ├── TranscriptType.java │ │ ├── challenge │ │ ├── OddsEvensChallenger.java │ │ ├── PairedChallenger.java │ │ ├── SeededChallenger.java │ │ ├── SerialChallenger.java │ │ ├── SimpleOddsEvensChallenger.java │ │ └── package-info.java │ │ └── package-info.java │ └── test │ └── java │ └── org │ └── cryptoworkshop │ └── ximix │ └── common │ └── test │ └── NodeStatusMessageTest.java ├── console ├── build.gradle.disabled ├── includes │ └── ximix-console │ │ └── bin │ │ ├── start.bat │ │ ├── start.sh │ │ └── stop.sh └── src │ └── main │ ├── java │ └── org │ │ └── cryptoworkshop │ │ └── ximix │ │ ├── console │ │ ├── Main.java │ │ ├── NodeAdapter.java │ │ ├── adapters │ │ │ ├── BaseNodeAdapter.java │ │ │ └── MixnetCommandServiceAdapter.java │ │ ├── applet │ │ │ └── CommandApplet.java │ │ ├── config │ │ │ ├── AdapterConfig.java │ │ │ ├── ConsoleConfig.java │ │ │ ├── ConsoleConfigFactory.java │ │ │ └── HTTPConfig.java │ │ ├── handlers │ │ │ ├── ConsoleHandler.java │ │ │ └── messages │ │ │ │ └── StandardMessage.java │ │ ├── model │ │ │ ├── AdapterInfo.java │ │ │ ├── Command.java │ │ │ └── ParameterInfo.java │ │ └── util │ │ │ ├── Traversal.java │ │ │ └── vote │ │ │ └── BallotUnpacker.java │ │ └── tool │ │ ├── GenNodeKeyStore.java │ │ ├── GenTrustAnchorKeyStore.java │ │ ├── KeyFetch.java │ │ ├── KeyGenerator.java │ │ ├── SHA1DigestCalculator.java │ │ ├── Signer.java │ │ ├── Verifier.java │ │ └── package-info.java │ └── resources │ └── html │ ├── css │ └── ui-lightness │ │ ├── images │ │ ├── animated-overlay.gif │ │ ├── ui-bg_diagonals-thick_18_b81900_40x40.png │ │ ├── ui-bg_diagonals-thick_20_666666_40x40.png │ │ ├── ui-bg_flat_10_000000_40x100.png │ │ ├── ui-bg_glass_100_f6f6f6_1x400.png │ │ ├── ui-bg_glass_100_fdf5ce_1x400.png │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ ├── ui-bg_gloss-wave_35_f6a828_500x100.png │ │ ├── ui-bg_highlight-soft_100_eeeeee_1x100.png │ │ ├── ui-bg_highlight-soft_75_ffe45c_1x100.png │ │ ├── ui-icons_222222_256x240.png │ │ ├── ui-icons_228ef1_256x240.png │ │ ├── ui-icons_ef8c08_256x240.png │ │ ├── ui-icons_ffd27a_256x240.png │ │ └── ui-icons_ffffff_256x240.png │ │ ├── jquery-ui-1.10.3.custom.css │ │ └── jquery-ui-1.10.3.custom.min.css │ ├── images │ ├── con.gif │ ├── loader-lge.gif │ ├── logo.png │ └── uncon.gif │ ├── index.html │ ├── js │ ├── flot │ │ ├── LICENSE.txt │ │ ├── excanvas.js │ │ ├── excanvas.min.js │ │ ├── jquery.colorhelpers.js │ │ ├── jquery.colorhelpers.min.js │ │ ├── jquery.flot.canvas.js │ │ ├── jquery.flot.canvas.min.js │ │ ├── jquery.flot.categories.js │ │ ├── jquery.flot.categories.min.js │ │ ├── jquery.flot.crosshair.js │ │ ├── jquery.flot.crosshair.min.js │ │ ├── jquery.flot.errorbars.js │ │ ├── jquery.flot.errorbars.min.js │ │ ├── jquery.flot.fillbetween.js │ │ ├── jquery.flot.fillbetween.min.js │ │ ├── jquery.flot.image.js │ │ ├── jquery.flot.image.min.js │ │ ├── jquery.flot.js │ │ ├── jquery.flot.min.js │ │ ├── jquery.flot.navigate.js │ │ ├── jquery.flot.navigate.min.js │ │ ├── jquery.flot.pie.js │ │ ├── jquery.flot.pie.min.js │ │ ├── jquery.flot.resize.js │ │ ├── jquery.flot.resize.min.js │ │ ├── jquery.flot.selection.js │ │ ├── jquery.flot.selection.min.js │ │ ├── jquery.flot.stack.js │ │ ├── jquery.flot.stack.min.js │ │ ├── jquery.flot.symbol.js │ │ ├── jquery.flot.symbol.min.js │ │ ├── jquery.flot.threshold.js │ │ ├── jquery.flot.threshold.min.js │ │ ├── jquery.flot.time.js │ │ └── jquery.flot.time.min.js │ ├── jquery-min.js │ ├── jquery-ui.custom.min.js │ ├── lang │ │ ├── en_us.js │ │ └── lang.js │ └── ximix.js │ └── main.css ├── demo ├── build.gradle.disabled ├── conf │ ├── console.xml │ ├── mixnet.xml │ ├── node1 │ │ ├── node1.xml │ │ ├── nodeCaStore.p12 │ │ └── trustCa.pem │ ├── node2 │ │ ├── node2.xml │ │ ├── nodeCaStore.p12 │ │ └── trustCa.pem │ ├── node3 │ │ ├── node3.xml │ │ ├── nodeCaStore.p12 │ │ └── trustCa.pem │ ├── node4 │ │ ├── node4.xml │ │ ├── nodeCaStore.p12 │ │ └── trustCa.pem │ ├── node5 │ │ ├── node5.xml │ │ ├── nodeCaStore.p12 │ │ └── trustCa.pem │ └── trustCa.pem ├── lt │ └── bigvote.xml └── src │ └── main │ └── java │ └── org │ └── cryptoworkshop │ └── ximix │ └── demo │ ├── admin │ └── Main.java │ ├── ballot │ ├── Main.java │ └── PackedBallotTableBuilder.java │ ├── client │ └── Main.java │ └── lt │ ├── LoadTester.java │ ├── LoadTesterConfig.java │ └── LoadTesterConfigFactory.java ├── docs └── XimixOutline.pdf ├── gradle.properties ├── installer ├── build.gradle.disabled ├── includes │ └── ximix │ │ └── bin │ │ ├── start.bat │ │ ├── start.sh │ │ └── stop.sh ├── manifest │ └── MANIFEST.mf └── src │ └── main │ ├── java │ └── org │ │ └── cryptoworkshop │ │ └── ximix │ │ └── installer │ │ ├── Installer.java │ │ ├── InstallerConfig.java │ │ ├── InstallerListener.java │ │ ├── Util.java │ │ └── ui │ │ ├── AbstractInstallerUI.java │ │ ├── MainConsole.java │ │ ├── MainFrame.java │ │ └── steps │ │ ├── AbstractInstallerStep.java │ │ ├── ConfirmStep.java │ │ ├── SelectInstallLocation.java │ │ └── SelectNumberOfNodes.java │ └── resources │ ├── install.xml │ └── install_node.xml ├── mirror.test ├── node ├── build.gradle.disabled └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── cryptoworkshop │ │ │ └── ximix │ │ │ └── node │ │ │ ├── Main.java │ │ │ ├── XimixNode.java │ │ │ ├── core │ │ │ ├── DefaultXimixNode.java │ │ │ ├── RemoteServicesCache.java │ │ │ ├── RemoteServicesListener.java │ │ │ ├── XimixNodeBuilder.java │ │ │ ├── XimixNodeContext.java │ │ │ ├── XimixServices.java │ │ │ └── package-info.java │ │ │ ├── crypto │ │ │ ├── key │ │ │ │ ├── BLSKeyManager.java │ │ │ │ ├── BLSKeyPairGenerator.java │ │ │ │ ├── BLSNewDKGGenerator.java │ │ │ │ ├── ECKeyManager.java │ │ │ │ ├── ECKeyPairGenerator.java │ │ │ │ ├── ECNewDKGGenerator.java │ │ │ │ ├── KeyManager.java │ │ │ │ ├── KeyManagerListener.java │ │ │ │ ├── KeyPairGenerator.java │ │ │ │ ├── message │ │ │ │ │ ├── BLSCommittedSecretShareMessage.java │ │ │ │ │ ├── ECCommittedSecretShareMessage.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── package-info.java │ │ │ │ └── util │ │ │ │ │ ├── BLSPublicKeyFactory.java │ │ │ │ │ ├── PrivateKeyInfoFactory.java │ │ │ │ │ ├── SubjectPublicKeyInfoFactory.java │ │ │ │ │ └── package-info.java │ │ │ ├── operator │ │ │ │ ├── BLSPrivateKeyOperator.java │ │ │ │ ├── ECPrivateKeyOperator.java │ │ │ │ ├── bc │ │ │ │ │ ├── BcECPrivateKeyOperator.java │ │ │ │ │ └── package-info.java │ │ │ │ ├── jpbc │ │ │ │ │ ├── JpbcPrivateKeyOperator.java │ │ │ │ │ └── package-info.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ ├── service │ │ │ │ ├── NodeDecryptionService.java │ │ │ │ ├── NodeKeyGenerationService.java │ │ │ │ ├── NodeKeyRetrievalService.java │ │ │ │ ├── NodeShuffledBoardDecryptionService.java │ │ │ │ ├── NodeSigningService.java │ │ │ │ ├── ProofGenerator.java │ │ │ │ └── package-info.java │ │ │ ├── signature │ │ │ │ ├── BLSSignerEngine.java │ │ │ │ ├── ECDSASignerEngine.java │ │ │ │ ├── SignerEngine.java │ │ │ │ └── package-info.java │ │ │ └── util │ │ │ │ ├── BigIntegerShare.java │ │ │ │ ├── ECPointShare.java │ │ │ │ ├── ElementShare.java │ │ │ │ ├── Share.java │ │ │ │ ├── ShareMap.java │ │ │ │ ├── ShareMapListener.java │ │ │ │ └── package-info.java │ │ │ ├── mixnet │ │ │ ├── board │ │ │ │ ├── BoardRemoteBackupListener.java │ │ │ │ ├── BulletinBoard.java │ │ │ │ ├── BulletinBoardBackupListener.java │ │ │ │ ├── BulletinBoardChangeListener.java │ │ │ │ ├── BulletinBoardImpl.java │ │ │ │ ├── BulletinBoardRegistry.java │ │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ ├── service │ │ │ │ ├── BoardExecutor.java │ │ │ │ ├── BoardHostingService.java │ │ │ │ ├── BoardIndex.java │ │ │ │ ├── MessageEvaluator.java │ │ │ │ ├── RemoteBoardHostingService.java │ │ │ │ └── package-info.java │ │ │ ├── shuffle │ │ │ │ ├── CopyAndMoveTask.java │ │ │ │ ├── RandomIndexNumberGenerator.java │ │ │ │ ├── TransformShuffleAndMoveTask.java │ │ │ │ └── package-info.java │ │ │ ├── transform │ │ │ │ ├── MultiColumnRowTransform.java │ │ │ │ ├── NullTransform.java │ │ │ │ ├── Transform.java │ │ │ │ └── package-info.java │ │ │ └── util │ │ │ │ └── package-info.java │ │ │ ├── monitor │ │ │ ├── NodeMonitorService.java │ │ │ └── package-info.java │ │ │ ├── package-info.java │ │ │ └── service │ │ │ ├── BasicNodeService.java │ │ │ ├── CrossSection.java │ │ │ ├── Decoupler.java │ │ │ ├── ListeningSocketInfo.java │ │ │ ├── NodeContext.java │ │ │ ├── NodeService.java │ │ │ ├── PrivateKeyOperator.java │ │ │ ├── ServiceEvent.java │ │ │ ├── ServiceStatisticsListener.java │ │ │ ├── ThresholdKeyPairGenerator.java │ │ │ └── package-info.java │ └── resources │ │ └── org │ │ └── cryptoworkshop │ │ └── ximix │ │ └── node │ │ └── crypto │ │ └── key │ │ └── d62003-159-158.param │ └── test │ ├── java │ └── org │ │ └── cryptoworkshop │ │ └── ximix │ │ └── node │ │ ├── crypto │ │ └── test │ │ │ ├── BLSKeyManagerTest.java │ │ │ ├── BasicShamirSharingTest.java │ │ │ ├── ECCommittedSecretShareMessageTest.java │ │ │ ├── ECKeyManagerTest.java │ │ │ ├── NewDKGTest.java │ │ │ ├── TestNotifier.java │ │ │ └── TestUtils.java │ │ ├── mixnet │ │ └── test │ │ │ ├── BulletinBoardTest.java │ │ │ └── SeededChallengerTest.java │ │ └── test │ │ └── CryptoServicesTest.java │ └── resources │ └── conf │ ├── nodeCaStore.p12 │ └── trustCa.pem ├── scripts ├── mkconsoleinstaller.sh └── mkinstaller.sh ├── settings.gradle └── test ├── build.gradle.disabled └── src ├── main └── java │ └── org │ └── cryptoworkshop │ └── ximix │ └── test │ └── node │ ├── NodeTestUtil.java │ ├── ResourceAnchor.java │ ├── SquelchingThrowableHandler.java │ ├── TestNotifier.java │ ├── TestXimixNodeFactory.java │ └── ValueObject.java └── test ├── java └── org │ └── cryptoworkshop │ └── ximix │ └── test │ └── tests │ ├── BLSProcessingTest.java │ ├── BoardCreationTest.java │ ├── BulletinBoardTest.java │ ├── ECDSAProcessingTest.java │ ├── KeyProcessingTest.java │ ├── MessageTest.java │ ├── NodeStartStopTest.java │ ├── PeersTest.java │ ├── RegistrarTest.java │ ├── ShuffleDownloadDecryptionTest.java │ ├── TestUtil.java │ └── VerificationTest.java └── resources └── conf ├── mixnet.xml ├── node1.xml ├── node1CaStore.p12 ├── node2.xml ├── node2CaStore.p12 ├── node3.xml ├── node3CaStore.p12 ├── node4.xml ├── node4CaStore.p12 ├── node5.xml ├── node5CaStore.p12 ├── nodeCaStore.p12 └── trustCa.pem /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | *.com 4 | *.class 5 | *.dll 6 | *.exe 7 | *.o 8 | *.so 9 | 10 | # Packages # 11 | ############ 12 | # it's better to unpack these files and commit the raw source 13 | # git has its own built in compression methods 14 | *.7z 15 | *.dmg 16 | *.gz 17 | *.iso 18 | *.jar 19 | *.rar 20 | *.tar 21 | *.zip 22 | 23 | # Logs and databases # 24 | ###################### 25 | *.log 26 | *.sql 27 | *.sqlite 28 | 29 | # OS generated files # 30 | ###################### 31 | .DS_Store 32 | .DS_Store? 33 | ._* 34 | .Spotlight-V100 35 | .Trashes 36 | Icon? 37 | ehthumbs.db 38 | Thumbs.db 39 | 40 | # IDE related 41 | ###################### 42 | *.iml 43 | *.classpath 44 | *.project 45 | .gradle/ 46 | .idea/ 47 | atlassian-ide-plugin.xml 48 | */build 49 | libs/* 50 | out/ 51 | */build/* 52 | build/reports/tests 53 | build/test-results/binary/test 54 | build 55 | coverage/ 56 | demo/conf/node2/boards 57 | -------------------------------------------------------------------------------- /client/build.gradle.disabled: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(':common') 3 | compile project(':crypto') 4 | } 5 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/BoardCreationService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | import org.cryptoworkshop.ximix.client.connection.ServiceConnectionException; 19 | 20 | /** 21 | * Interface containing the methods associated with board creation. 22 | */ 23 | public interface BoardCreationService 24 | extends Service 25 | { 26 | /** 27 | * Create the board boardName using the passed in options. 28 | * 29 | * @param boardName the name of the board to create. 30 | * @param creationOptions the options to use. 31 | * @exception ServiceConnectionException in case of error. 32 | */ 33 | void createBoard(String boardName, BoardCreationOptions creationOptions) 34 | throws ServiceConnectionException; 35 | } 36 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/BoardDetail.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | /** 19 | * Class for carrying basic board details. 20 | */ 21 | public class BoardDetail 22 | { 23 | private final String host; 24 | private final int messageCount; 25 | private String backupHost; 26 | 27 | /** 28 | * Base constructor. 29 | * 30 | * @param host name of host holding the board. 31 | * @param messageCount number of messages on the board. 32 | * @param backupHost name of the back up host, if there is one. 33 | */ 34 | public BoardDetail(String host, int messageCount, String backupHost) 35 | { 36 | this.host = host; 37 | this.messageCount = messageCount; 38 | this.backupHost = backupHost; 39 | } 40 | 41 | public int getMessageCount() 42 | { 43 | return messageCount; 44 | } 45 | 46 | public String getHost() 47 | { 48 | return host; 49 | } 50 | 51 | public String getBackupHost() 52 | { 53 | return backupHost; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/CommandService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | /** 19 | * Combined interface for issuing mix network commands. 20 | */ 21 | public interface CommandService 22 | extends Service, UploadService, ShuffleOperation, ShuffleTranscriptsDownloadOperation, DownloadOperation, DownloadShuffleResultOperation, BoardCreationService, QueryService 23 | { 24 | } 25 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/DownloadOperation.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | import org.cryptoworkshop.ximix.client.connection.ServiceConnectionException; 19 | import org.cryptoworkshop.ximix.common.util.Operation; 20 | 21 | /** 22 | * Interface defining available download operations. 23 | */ 24 | public interface DownloadOperation 25 | { 26 | /** 27 | * Download the contents of a board. 28 | * 29 | * @param boardName name of the board to download from. 30 | * @param options 31 | * @param defaultListener the listener to be sent messages 32 | */ 33 | Operation downloadBoardContents( 34 | String boardName, 35 | DownloadOptions options, 36 | DownloadOperationListener defaultListener) 37 | throws ServiceConnectionException; 38 | } 39 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/DownloadOperationListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | import java.util.List; 19 | 20 | import org.cryptoworkshop.ximix.common.util.OperationListener; 21 | 22 | /** 23 | * Listener for monitoring download operations. 24 | */ 25 | public interface DownloadOperationListener 26 | extends OperationListener 27 | { 28 | /** 29 | * Signal that the passed in message was downloaded with the passed in index. 30 | * 31 | * @param index index of the downloaded message on the bulletin board. 32 | * @param message the downloaded message. 33 | * @param proofs a map of the proofs applicable to this message 34 | */ 35 | public void messageDownloaded(int index, byte[] message, List proofs); 36 | } 37 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/FullInfoData.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | import java.util.Collections; 19 | import java.util.HashMap; 20 | import java.util.Map; 21 | 22 | /** 23 | * General carrier for status information about a node. 24 | */ 25 | public class FullInfoData 26 | { 27 | private final Map data; 28 | 29 | /** 30 | * Base Constructor. 31 | * 32 | * @param data a map of (String, Object) representing status values. 33 | */ 34 | public FullInfoData(Map data) 35 | { 36 | this.data = Collections.unmodifiableMap(new HashMap<>(data)); 37 | } 38 | 39 | /** 40 | * Return the data map contained in this information object. 41 | * 42 | * @return a map of (String, Object) representing status values. 43 | */ 44 | public Map getDataMap() 45 | { 46 | return data; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/KeyGenerationService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | import org.cryptoworkshop.ximix.client.connection.ServiceConnectionException; 19 | 20 | /** 21 | * Carrier interface for methods connected with key generation and retrieval. 22 | */ 23 | public interface KeyGenerationService 24 | extends KeyService 25 | { 26 | /** 27 | * Generate a public key and associate it with key ID keyID. The key is returned if generated successfully. 28 | * 29 | * @param keyID the id of the key we are looking for. 30 | * @param keyGenOptions options applicable to this key generation. 31 | * @return a byte[] array of the SubjectPublicKeyInfo object representing the key. 32 | */ 33 | byte[] generatePublicKey(String keyID, KeyGenerationOptions keyGenOptions) 34 | throws ServiceConnectionException; 35 | } 36 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/KeyService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | import org.cryptoworkshop.ximix.client.connection.ServiceConnectionException; 19 | 20 | /** 21 | * Carrier interface for methods connected with key retrieval. 22 | */ 23 | public interface KeyService 24 | extends Service 25 | { 26 | /** 27 | * Return the public key associated with key ID keyID. 28 | * 29 | * @param keyID the id of the key we are looking for. 30 | * @return a byte[] array of the SubjectPublicKeyInfo object representing the key. 31 | */ 32 | byte[] fetchPublicKey(String keyID) 33 | throws ServiceConnectionException; 34 | } 35 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/MessageChooser.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | /** 19 | * General interface for indicating to an internal service that a particular message, or messages, require some additional processing. 20 | */ 21 | public interface MessageChooser 22 | { 23 | /** 24 | * Return true if a message with a particular index is chosen, false otherwise. 25 | * 26 | * @param index the index number of a message on its bulletin board. 27 | * @return true if the message is regarded as chosen, false otherwise. 28 | */ 29 | boolean chooseMessage(int index); 30 | } 31 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/NetworkBoardListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | public interface NetworkBoardListener 19 | { 20 | void boardChanged(String boardName, BoardDetail boardDetail); 21 | } 22 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/NodeDetail.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | import java.net.InetAddress; 19 | 20 | /** 21 | * Carrier class for basic node details. 22 | */ 23 | public class NodeDetail 24 | { 25 | private final InetAddress address; 26 | private final int portNo; 27 | private final String name; 28 | 29 | /** 30 | * Base constructor. 31 | * 32 | * @param name the name of the node. 33 | * @param address the address of the node. 34 | * @param portNo the port number the node is listening on. 35 | */ 36 | public NodeDetail(String name, InetAddress address, int portNo) 37 | { 38 | this.address = address; 39 | this.portNo = portNo; 40 | this.name = name; 41 | } 42 | 43 | /** 44 | * Return the port number the node is listening on. 45 | * 46 | * @return node's port number. 47 | */ 48 | public int getPortNo() 49 | { 50 | return portNo; 51 | } 52 | 53 | /** 54 | * Return the name of the node. 55 | * 56 | * @return the node's name. 57 | */ 58 | public String getName() 59 | { 60 | return name; 61 | } 62 | 63 | /** 64 | * Return the address of the node. 65 | * 66 | * @return the node's address. 67 | */ 68 | public InetAddress getAddress() 69 | { 70 | return address; 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/QueryService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | import java.util.Set; 19 | 20 | import org.cryptoworkshop.ximix.client.connection.ServiceConnectionException; 21 | 22 | /** 23 | * Carrier service interface for methods associated with board related queries. 24 | */ 25 | public interface QueryService 26 | extends Service 27 | { 28 | /** 29 | * Return a list of the currently available nodes. 30 | * 31 | * @return a list of active node names. 32 | * @exception org.cryptoworkshop.ximix.client.connection.ServiceConnectionException in case of error. 33 | */ 34 | Set getNodeNames() 35 | throws ServiceConnectionException; 36 | 37 | /** 38 | * Return true if the board with boardName exists in the network, false otherwise. 39 | * 40 | * @param boardName the name of the board to create. 41 | * @return true if board exists, false otherwise. 42 | * @exception org.cryptoworkshop.ximix.client.connection.ServiceConnectionException in case of error. 43 | */ 44 | boolean isBoardExisting(String boardName) 45 | throws ServiceConnectionException; 46 | } 47 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/RegistrarServiceException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | /** 19 | * Basic registrar service exception. 20 | */ 21 | public class RegistrarServiceException 22 | extends Exception 23 | { 24 | /** 25 | * Construct an exception with the specified message. 26 | * 27 | * @param message the message to pass. 28 | */ 29 | public RegistrarServiceException(String message) 30 | { 31 | super(message); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/Service.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | import org.cryptoworkshop.ximix.client.connection.ServiceConnectionException; 19 | 20 | /** 21 | * Base interface for a service. 22 | */ 23 | public interface Service 24 | { 25 | /** 26 | * Free any resources used by this service. 27 | * 28 | * @throws org.cryptoworkshop.ximix.client.connection.ServiceConnectionException in case of failure to cleanly shutdown. 29 | */ 30 | void shutdown() 31 | throws ServiceConnectionException; 32 | } 33 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/ShuffleOperation.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | import org.cryptoworkshop.ximix.client.connection.ServiceConnectionException; 19 | import org.cryptoworkshop.ximix.common.util.Operation; 20 | 21 | /** 22 | * Support interface for requesting a shuffle. 23 | */ 24 | public interface ShuffleOperation 25 | { 26 | /** 27 | * Do a shuffle. If a shuffle is to be repeated on a node twice, repeat the node name in the nodes argument. 28 | * 29 | * @param boardName board to do the shuffle on. 30 | * @param options applicable shuffle options to use. 31 | * @param defaultListener initial listener to monitor a shuffle operation. 32 | * @param nodes the node path to use. 33 | * @throws org.cryptoworkshop.ximix.client.connection.ServiceConnectionException 34 | */ 35 | Operation doShuffleAndMove( 36 | String boardName, 37 | ShuffleOptions options, 38 | ShuffleOperationListener defaultListener, 39 | String... nodes) 40 | throws ServiceConnectionException; 41 | } 42 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/ShuffleOperationListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | import java.util.Map; 19 | 20 | import org.cryptoworkshop.ximix.common.util.OperationListener; 21 | 22 | /** 23 | * Listener for monitoring shuffle operations. 24 | */ 25 | public interface ShuffleOperationListener 26 | extends OperationListener 27 | { 28 | /** 29 | * Called to pass in the commitments for seeds for later transcript recovery committed to by the nodes in 30 | * the shuffle. 31 | * 32 | * @param seedCommitments a map of node name, byte[] pairs. The byte[] represents a CMS SignedData object 33 | * containing a SeedCommitmentMessage. 34 | */ 35 | void commit(Map seedCommitments); 36 | } 37 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/ShuffleStatus.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.client; 2 | 3 | /** 4 | * A general status object for providing shuffle details. 5 | */ 6 | public class ShuffleStatus 7 | { 8 | private final boolean errorStatus; 9 | private final String message; 10 | private final String nodeName; 11 | private final int stepNo; 12 | private final Throwable cause; 13 | 14 | public ShuffleStatus(String message, String nodeName, int stepNo) 15 | { 16 | this.errorStatus = false; 17 | this.message = message; 18 | this.nodeName = nodeName; 19 | this.stepNo = stepNo; 20 | this.cause = null; 21 | } 22 | 23 | public ShuffleStatus(String message, String nodeName, Throwable cause) 24 | { 25 | this.errorStatus = true; 26 | this.message = message; 27 | this.nodeName = nodeName; 28 | this.stepNo = -1; 29 | this.cause = cause; 30 | } 31 | 32 | public boolean isErrorStatus() 33 | { 34 | return errorStatus; 35 | } 36 | 37 | public String getMessage() 38 | { 39 | return message; 40 | } 41 | 42 | public String getNodeName() 43 | { 44 | return nodeName; 45 | } 46 | 47 | public int getStepNo() 48 | { 49 | return stepNo; 50 | } 51 | 52 | public Throwable getCause() 53 | { 54 | return cause; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/ShuffleTranscriptSeedDownloadOperationListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | import java.util.Map; 19 | 20 | import org.cryptoworkshop.ximix.common.util.OperationListener; 21 | 22 | /** 23 | * Listener for monitoring shuffle transcript download operations. 24 | */ 25 | public interface ShuffleTranscriptSeedDownloadOperationListener 26 | extends OperationListener 27 | { 28 | void committedSeedMap(Map seeds, Map witnesses); 29 | } 30 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/ShuffleTranscriptsDownloadOperationListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | import java.io.InputStream; 19 | 20 | import org.cryptoworkshop.ximix.common.util.OperationListener; 21 | 22 | /** 23 | * Listener for monitoring shuffle transcript download operations. 24 | */ 25 | public interface ShuffleTranscriptsDownloadOperationListener 26 | extends OperationListener 27 | { 28 | void shuffleTranscriptArrived(long operationNumber, int stepNumber, InputStream transcript); 29 | } 30 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/SigningService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | import org.cryptoworkshop.ximix.client.connection.ServiceConnectionException; 19 | 20 | /** 21 | * Carrier service interface for methods associated with signing. 22 | */ 23 | public interface SigningService 24 | extends KeyService 25 | { 26 | /** 27 | * Generate a signature using the given keyID and options for the passed in message. The type of signature 28 | * is determined by the algorithm associated with keyID, and a byte encoding suitable for verification is returned. 29 | * 30 | * @param keyID the id for the key to be used in signing. 31 | * @param options any options required for the signature generation. 32 | * @param message the message to be signed. 33 | * @return a byte[] encoding of the signature in a format suitable for later verification. 34 | * @throws ServiceConnectionException in case of failure. 35 | */ 36 | byte[] generateSignature(String keyID, SignatureGenerationOptions options, byte[] message) 37 | throws ServiceConnectionException; 38 | } 39 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/StatisticsData.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | import java.util.Collections; 19 | import java.util.HashMap; 20 | import java.util.Map; 21 | 22 | /** 23 | * General carrier for statistical data about a node. 24 | */ 25 | public class StatisticsData 26 | { 27 | private final Map data; 28 | 29 | /** 30 | * Base Constructor. 31 | * 32 | * @param data a map of (String, Object) representing statistical data. 33 | */ 34 | public StatisticsData(Map data) 35 | { 36 | this.data = Collections.unmodifiableMap(new HashMap<>(data)); 37 | } 38 | 39 | /** 40 | * Return the data map contained in this statistics object. 41 | * 42 | * @return a map of (String, Object) representing statistical data. 43 | */ 44 | public Map getDataMap() 45 | { 46 | return data; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/UploadService.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client; 17 | 18 | import org.cryptoworkshop.ximix.client.connection.ServiceConnectionException; 19 | 20 | /** 21 | * Carrier service interface for methods associated with message upload. 22 | */ 23 | public interface UploadService 24 | extends Service 25 | { 26 | /** 27 | * Upload the passed in message to the board boardName. 28 | * 29 | * @param boardName the name of the board to upload to. 30 | * @param message a byte[] representing an encoding of the message to be uploaded. 31 | * @throws ServiceConnectionException 32 | */ 33 | void uploadMessage(String boardName, byte[] message) 34 | throws ServiceConnectionException; 35 | 36 | /** 37 | * Upload a batch of messages to the board boardName. 38 | * 39 | * @param boardName the name of the board to upload to. 40 | * @param messages a array of byte[] representing encodings of the messages to be uploaded. 41 | * @throws ServiceConnectionException 42 | */ 43 | void uploadMessages(String boardName, byte[][] messages) 44 | throws ServiceConnectionException; 45 | } 46 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/connection/AdminServicesConnection.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client.connection; 17 | 18 | import java.util.Set; 19 | 20 | import org.bouncycastle.asn1.ASN1Encodable; 21 | import org.cryptoworkshop.ximix.common.asn1.message.MessageReply; 22 | import org.cryptoworkshop.ximix.common.asn1.message.MessageType; 23 | 24 | /** 25 | * Basic interface for privileged service connections. 26 | */ 27 | public interface AdminServicesConnection 28 | extends ServicesConnection 29 | { 30 | /** 31 | * Return the current set of active nodes behind this connection. 32 | * 33 | * @return the set of active nodes. 34 | */ 35 | Set getActiveNodeNames(); 36 | 37 | /** 38 | * Send a message to a specific node. 39 | * 40 | * @param nodeName node message is to be sent to. 41 | * @param type type of the message. 42 | * @param messagePayload the data making up the message payload. 43 | * @return a reply indicating message acceptance or rejection. 44 | * @throws ServiceConnectionException in case of network failure. 45 | */ 46 | MessageReply sendMessage(String nodeName, MessageType type, ASN1Encodable messagePayload) 47 | throws ServiceConnectionException; 48 | } 49 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/connection/ClientServiceConnectionException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client.connection; 17 | 18 | /** 19 | * Exception class for client side service connection exceptions. 20 | */ 21 | public class ClientServiceConnectionException 22 | extends ServiceConnectionException 23 | { 24 | /** 25 | * Base constructor. 26 | * 27 | * @param message exception detail. 28 | */ 29 | public ClientServiceConnectionException(String message) 30 | { 31 | super(message); 32 | } 33 | 34 | /** 35 | * Base constructor - nested case. 36 | * 37 | * @param message exception detail. 38 | * @param cause the exception giving rise to this one. 39 | */ 40 | public ClientServiceConnectionException(String message, Throwable cause) 41 | { 42 | super(message, cause); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/connection/NodeConfigFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client.connection; 17 | 18 | import org.cryptoworkshop.ximix.common.config.ConfigObjectFactory; 19 | import org.w3c.dom.Node; 20 | 21 | /** 22 | * Internal factory class to produce NodeConfig objects for interpreting configuration details. 23 | */ 24 | class NodeConfigFactory 25 | implements ConfigObjectFactory 26 | { 27 | public NodeConfig createObject(Node configNode) 28 | { 29 | return new NodeConfig(configNode); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/connection/NodeConnectionListener.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.client.connection; 2 | 3 | public interface NodeConnectionListener 4 | { 5 | void status(String name, boolean isAvailable); 6 | } 7 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/connection/ServiceConnectionException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client.connection; 17 | 18 | /** 19 | * Exception class for general service connection exceptions. 20 | */ 21 | public class ServiceConnectionException 22 | extends Exception 23 | { 24 | /** 25 | * Base constructor. 26 | * 27 | * @param message exception detail. 28 | */ 29 | public ServiceConnectionException(String message) 30 | { 31 | super(message); 32 | } 33 | 34 | /** 35 | * Protected to prevent constructor been used on remote side of connection... 36 | * 37 | * @param message the message to carry. 38 | * @param cause underlying cause of the exception. 39 | */ 40 | protected ServiceConnectionException(String message, Throwable cause) 41 | { 42 | super(message, cause); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/connection/SpecificServicesConnection.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client.connection; 17 | 18 | /** 19 | * Interface for a service connection associated with a specific node. 20 | */ 21 | public interface SpecificServicesConnection 22 | extends ServicesConnection 23 | { 24 | /** 25 | * Return the name of the node bound to this connection. 26 | * 27 | * @return the name of the node the connection represents. 28 | */ 29 | String getName(); 30 | } 31 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/connection/XimixRegistrar.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client.connection; 17 | 18 | import org.cryptoworkshop.ximix.client.RegistrarServiceException; 19 | 20 | /** 21 | * Registrar which encompasses all the services offered by the peers in the network. 22 | */ 23 | public interface XimixRegistrar 24 | { 25 | /** 26 | * Connect to a specific service. 27 | * 28 | * @param serviceClass the interface for the service being requested. 29 | * @return an implementation of serviceClass supporting the passed in service. 30 | * @throws org.cryptoworkshop.ximix.client.RegistrarServiceException in case of failure. 31 | */ 32 | T connect(Class serviceClass) 33 | throws RegistrarServiceException; 34 | 35 | /** 36 | * Shutdown the registrar, freeing any resources. 37 | */ 38 | void shutdown(); 39 | } 40 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/connection/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Ximix service registrar and service connection support classes. 18 | */ 19 | package org.cryptoworkshop.ximix.client.connection; 20 | 21 | 22 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/connection/signing/Participant.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client.connection.signing; 17 | 18 | /** 19 | * Identifier class for a participant in a threshold sharing process. 20 | */ 21 | public class Participant 22 | { 23 | private final int sequenceNo; 24 | private final String name; 25 | 26 | /** 27 | * Base constructor. 28 | * 29 | * @param sequenceNo the participant's sequence number in the sharing process, 30 | * @param name the name of the participant. 31 | */ 32 | public Participant(int sequenceNo, String name) 33 | { 34 | this.sequenceNo = sequenceNo; 35 | this.name = name; 36 | } 37 | 38 | public int getSequenceNo() 39 | { 40 | return sequenceNo; 41 | } 42 | 43 | public String getName() 44 | { 45 | return name; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/connection/signing/SigID.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client.connection.signing; 17 | 18 | /** 19 | * Object based key to identify particular signing operations. 20 | */ 21 | public class SigID 22 | { 23 | private final String id; 24 | 25 | /** 26 | * Base constructor. 27 | * 28 | * @param id an ID associated with a signing operation. 29 | */ 30 | public SigID(String id) 31 | { 32 | this.id = id; 33 | } 34 | 35 | public String getID() 36 | { 37 | return id; 38 | } 39 | 40 | public int hashCode() 41 | { 42 | return id.hashCode(); 43 | } 44 | 45 | public boolean equals(Object o) 46 | { 47 | if (o == this) 48 | { 49 | return true; 50 | } 51 | 52 | if (o instanceof SigID) 53 | { 54 | SigID other = (SigID)o; 55 | 56 | return this.id.equals(other.id); 57 | } 58 | 59 | return false; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/connection/signing/message/MessageUtils.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.client.connection.signing.message; 2 | 3 | import org.bouncycastle.asn1.ASN1EncodableVector; 4 | import org.bouncycastle.asn1.ASN1Sequence; 5 | import org.bouncycastle.asn1.DLSequence; 6 | import org.cryptoworkshop.ximix.client.connection.signing.Participant; 7 | import org.cryptoworkshop.ximix.common.asn1.message.ParticipantMessage; 8 | 9 | class MessageUtils 10 | { 11 | static ASN1Sequence toASN1Sequence(Participant[] participants) 12 | { 13 | ASN1EncodableVector v = new ASN1EncodableVector(); 14 | 15 | for (Participant participant : participants) 16 | { 17 | v.add(new ParticipantMessage(participant.getSequenceNo(), participant.getName())); 18 | } 19 | 20 | return new DLSequence(v); 21 | } 22 | 23 | public static Participant[] toArray(ASN1Sequence seq) 24 | { 25 | Participant[] participants = new Participant[seq.size()]; 26 | 27 | for (int i = 0; i != participants.length; i++) 28 | { 29 | ParticipantMessage pm = ParticipantMessage.getInstance(seq.getObjectAt(i)); 30 | 31 | participants[i] = new Participant(pm.getSequenceNo(), pm.getName()); 32 | } 33 | 34 | return participants; 35 | } 36 | 37 | 38 | } 39 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/connection/signing/message/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Internal messages for supporting signature generation... 18 | */ 19 | package org.cryptoworkshop.ximix.client.connection.signing.message; 20 | 21 | 22 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/connection/signing/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Algorithm specific services for supporting signature generation. 18 | */ 19 | package org.cryptoworkshop.ximix.client.connection.signing; 20 | 21 | 22 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Base classes for writing a Ximix client. 18 |

19 | Clients are created via a XimixRegistrar. For example a simple client which simply retrieves a Ximix EC public key for encryption or signature verifications may look like this: 20 |

21 |     XimixRegistrar registrar = XimixRegistrarFactory.createServicesRegistrar(configFile);
22 | 
23 |     KeyService    keyFetcher = registrar.connect(KeyService.class);
24 | 
25 |     byte[] encPubKey = keyFetcher.fetchPublicKey("ECKEY");
26 |     
27 |

28 | See the JavaDoc for the service of interest for specific details. 29 | */ 30 | package org.cryptoworkshop.ximix.client; 31 | 32 | 33 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/verify/CommitmentVerificationException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client.verify; 17 | 18 | /** 19 | * Exception thrown on verification failure. 20 | */ 21 | public class CommitmentVerificationException 22 | extends Exception 23 | { 24 | /** 25 | * Create an exception with the given message. 26 | * 27 | * @param msg message to be associated with the exception. 28 | */ 29 | public CommitmentVerificationException(String msg) 30 | { 31 | super(msg); 32 | } 33 | 34 | /** 35 | * Create an exception with the given message and an associated cause. 36 | * 37 | * @param msg message to be associated with the exception. 38 | * @param cause the underlying cause of the exception. 39 | */ 40 | public CommitmentVerificationException(String msg, Throwable cause) 41 | { 42 | super(msg, cause); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/verify/TranscriptVerificationException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.client.verify; 17 | 18 | /** 19 | * Exception thrown on verification failure. 20 | */ 21 | public class TranscriptVerificationException 22 | extends Exception 23 | { 24 | /** 25 | * Create an exception with the given message. 26 | * 27 | * @param msg message to be associated with the exception. 28 | */ 29 | public TranscriptVerificationException(String msg) 30 | { 31 | super(msg); 32 | } 33 | 34 | /** 35 | * Create an exception with the given message and an associated cause. 36 | * 37 | * @param msg message to be associated with the exception. 38 | * @param cause the underlying cause of the exception. 39 | */ 40 | public TranscriptVerificationException(String msg, Throwable cause) 41 | { 42 | super(msg, cause); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /client/src/main/java/org/cryptoworkshop/ximix/client/verify/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Ximix transcript verification classes. 18 | */ 19 | package org.cryptoworkshop.ximix.client.verify; 20 | 21 | 22 | -------------------------------------------------------------------------------- /client/src/main/resources/org/cryptoworkshop/ximix/client/connection/d62003-159-158.param: -------------------------------------------------------------------------------- 1 | type d 2 | q 625852803282871856053922297323874661378036491717 3 | n 625852803282871856053923088432465995634661283063 4 | h 3 5 | r 208617601094290618684641029477488665211553761021 6 | a 239110483679451415355408117072309802450583283527 7 | b 576642191308215514272886942930789642552413183496 8 | k 6 9 | nk 60094290356408407130984161127310078516360031868417968262992864809623507269833854678414046779817844853757026858774966331434198257512457993293271849043664655146443229029069463392046837830267994222789160047337432075266619082657640364986415435746294498140589844832666082434658532589211525696 10 | hk 1380801711862212484403205699005242141541629761433899149236405232528956996854655261075303661691995273080620762287276051361446528504633283152278831183711301329765591450680250000592437612973269056 11 | coeff0 167735272244340890248413461294733530966113631081 12 | coeff1 188332945847808679523389681913294069067222011819 13 | coeff2 276225171725363903470966428623308273877799612855 14 | nqr 489829780399089087337095496766742416848202714236 15 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/asn1/XimixObjectIdentifiers.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.common.asn1; 17 | 18 | import org.bouncycastle.asn1.ASN1ObjectIdentifier; 19 | 20 | /** 21 | * ASN.1 object identifiers associated with Ximix. 22 | */ 23 | public interface XimixObjectIdentifiers 24 | { 25 | // 26 | // {iso(1) member-body(2) au(36) cryptoworkshop(50159983187) ximix(1) 27 | // 28 | static final ASN1ObjectIdentifier ximix = new ASN1ObjectIdentifier("1.2.36.50159983187.1"); 29 | 30 | static final ASN1ObjectIdentifier ximixAlgorithms = ximix.branch("1"); 31 | static final ASN1ObjectIdentifier ximixAlgorithmsExperimental = ximixAlgorithms.branch("0"); 32 | 33 | static final ASN1ObjectIdentifier ximixCertExtension = ximix.branch("2"); 34 | static final ASN1ObjectIdentifier ximixShareIdExtension = ximixCertExtension.branch("1"); 35 | } 36 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/asn1/board/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Helper ASN.1 Messages for producing byte arrays suitable for uploading to a message board. 18 | */ 19 | package org.cryptoworkshop.ximix.common.asn1.board; 20 | 21 | 22 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/asn1/message/IDMessage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.common.asn1.message; 17 | 18 | import org.bouncycastle.asn1.ASN1Object; 19 | import org.bouncycastle.asn1.ASN1Primitive; 20 | import org.bouncycastle.asn1.DERUTF8String; 21 | 22 | /** 23 | * Carrier message for a general string ID. 24 | */ 25 | public class IDMessage 26 | extends ASN1Object 27 | { 28 | private String id; 29 | private byte[] hash; 30 | 31 | /** 32 | * Base constructor. 33 | * 34 | * @param id the ID of the key being referred to. 35 | */ 36 | public IDMessage(String id) 37 | { 38 | this.id = id; 39 | } 40 | 41 | private IDMessage(DERUTF8String id) 42 | { 43 | this.id = id.getString(); 44 | } 45 | 46 | public static final IDMessage getInstance(Object o) 47 | { 48 | if (o instanceof IDMessage) 49 | { 50 | return (IDMessage)o; 51 | } 52 | else if (o != null) 53 | { 54 | return new IDMessage(DERUTF8String.getInstance(o)); 55 | } 56 | 57 | return null; 58 | } 59 | 60 | @Override 61 | public ASN1Primitive toASN1Primitive() 62 | { 63 | return new DERUTF8String(id); 64 | } 65 | 66 | public String getID() 67 | { 68 | return id; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/asn1/message/KeyIDMessage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.common.asn1.message; 17 | 18 | import org.bouncycastle.asn1.ASN1Object; 19 | import org.bouncycastle.asn1.ASN1Primitive; 20 | import org.bouncycastle.asn1.DERUTF8String; 21 | 22 | /** 23 | * Carrier message for a keyID. 24 | */ 25 | public class KeyIDMessage 26 | extends ASN1Object 27 | { 28 | private String keyID; 29 | private byte[] hash; 30 | 31 | /** 32 | * Base constructor. 33 | * 34 | * @param keyID the ID of the key being referred to. 35 | */ 36 | public KeyIDMessage(String keyID) 37 | { 38 | this.keyID = keyID; 39 | } 40 | 41 | private KeyIDMessage(DERUTF8String keyID) 42 | { 43 | this.keyID = keyID.getString(); 44 | } 45 | 46 | public static final KeyIDMessage getInstance(Object o) 47 | { 48 | if (o instanceof KeyIDMessage) 49 | { 50 | return (KeyIDMessage)o; 51 | } 52 | else if (o != null) 53 | { 54 | return new KeyIDMessage(DERUTF8String.getInstance(o)); 55 | } 56 | 57 | return null; 58 | } 59 | 60 | @Override 61 | public ASN1Primitive toASN1Primitive() 62 | { 63 | return new DERUTF8String(keyID); 64 | } 65 | 66 | public String getKeyID() 67 | { 68 | return keyID; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/asn1/message/MessageType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.common.asn1.message; 17 | 18 | /** 19 | * Marker interface for enums providing message types. 20 | */ 21 | public interface MessageType 22 | { 23 | } 24 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/asn1/message/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | ASN.1 messages for Ximix communications. 18 | */ 19 | package org.cryptoworkshop.ximix.common.asn1.message; 20 | 21 | 22 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/asn1/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | ASN.1 Support classes for messaging and object identification. 18 | */ 19 | package org.cryptoworkshop.ximix.common.asn1; 20 | 21 | 22 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/config/ConfigException.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.common.config; 17 | 18 | /** 19 | * Base configuration exception. 20 | */ 21 | public class ConfigException 22 | extends Exception 23 | { 24 | /** 25 | * Constructor for an exception with an underlying cause. 26 | * 27 | * @param message the message associated with the exception. 28 | * @param cause the throwable causing this exception.. 29 | */ 30 | public ConfigException(String message, Throwable cause) 31 | { 32 | super(message, cause); 33 | } 34 | 35 | /** 36 | * Basic constructor - a simple message, 37 | * 38 | * @param message 39 | */ 40 | public ConfigException(String message) 41 | { 42 | super(message); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/config/ConfigObjectFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.common.config; 17 | 18 | import org.w3c.dom.Node; 19 | 20 | /** 21 | * Factory interface for configuration object producers. 22 | * 23 | * @param the type of object resulting from parsing a specific configuration element. 24 | */ 25 | public interface ConfigObjectFactory 26 | { 27 | public T createObject(Node configNode) 28 | throws ConfigException; 29 | } 30 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/config/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Utility classes for producing Ximix configuration objects. 18 | */ 19 | package org.cryptoworkshop.ximix.common.config; 20 | 21 | 22 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/crypto/Algorithm.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.common.crypto; 17 | 18 | /** 19 | * Enumeration of currently supported algorithms. 20 | */ 21 | public enum Algorithm 22 | { 23 | /** 24 | * Elliptic Curve ElGamal 25 | */ 26 | EC_ELGAMAL, 27 | /** 28 | * Elliptc Curve DSA 29 | */ 30 | ECDSA, 31 | /** 32 | * BLS 33 | */ 34 | BLS 35 | } 36 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/crypto/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Cryptography support classes. 18 | */ 19 | package org.cryptoworkshop.ximix.common.crypto; 20 | 21 | 22 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/crypto/threshold/SplitSecret.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.common.crypto.threshold; 17 | 18 | import java.math.BigInteger; 19 | 20 | /** 21 | * A basic split secret for a BigInteger value. 22 | */ 23 | public class SplitSecret 24 | { 25 | private final BigInteger[] coefficients; 26 | private final BigInteger[] shares; 27 | 28 | /** 29 | * Base constructor. 30 | * 31 | * @param shares the shares the initial secret has been split into. 32 | * @param coefficients the coefficients associated with the shares. 33 | */ 34 | public SplitSecret(BigInteger[] shares, BigInteger[] coefficients) 35 | { 36 | this.shares = shares; 37 | this.coefficients = coefficients; 38 | } 39 | 40 | public BigInteger[] getCoefficients() 41 | { 42 | return coefficients; 43 | } 44 | 45 | public BigInteger[] getShares() 46 | { 47 | return shares; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/crypto/threshold/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Classes for support various forms of Secret Splitting required for threshold algorithms. 18 | */ 19 | package org.cryptoworkshop.ximix.common.crypto.threshold; 20 | 21 | 22 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/util/EventNotifier.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.common.util; 2 | 3 | /** 4 | * Standard interface for an event notifier implementation. 5 | */ 6 | public interface EventNotifier 7 | { 8 | public static enum Level 9 | { 10 | DEBUG, INFO, WARN, ERROR 11 | } 12 | 13 | /** 14 | * Notify of a throwable. 15 | * 16 | * @param level the level this event is at. 17 | * @param throwable the throwable causing the event. 18 | */ 19 | void notify(Level level, Throwable throwable); 20 | 21 | /** 22 | * General notification with a detail object, 23 | * 24 | * @param level the level this event is at. 25 | * @param detail the detail associated with this event notification. 26 | */ 27 | void notify(Level level, Object detail); 28 | 29 | /** 30 | * 31 | * @param level the level this event is at. 32 | * @param detail the detail associated with this event notification. 33 | * @param throwable the throwable causing the event. 34 | */ 35 | void notify(Level level, Object detail, Throwable throwable); 36 | } 37 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/util/IndexNumberGenerator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.common.util; 17 | 18 | /** 19 | * General interface for the generation of streams of index numbers. 20 | */ 21 | public interface IndexNumberGenerator 22 | { 23 | /** 24 | * Return true if there is another index number available 25 | * 26 | * @return true if another index number, false otherwise. 27 | */ 28 | boolean hasNext(); 29 | 30 | /** 31 | * Return the next index number 32 | * 33 | * @return an index number. 34 | */ 35 | int nextIndex(); 36 | } 37 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/util/ListenerHandler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.common.util; 17 | 18 | import java.lang.reflect.InvocationHandler; 19 | import java.util.Collection; 20 | 21 | /** 22 | * The basic interface for a ListenerHandler. 23 | * 24 | * @param the type of the interface notifications messages are passed to. 25 | */ 26 | public interface ListenerHandler 27 | extends InvocationHandler 28 | { 29 | /** 30 | * Return a notifier we can invoke. 31 | * 32 | * @return the notifier encapsulating any added listeners. 33 | */ 34 | T getNotifier(); 35 | 36 | /** 37 | * @return the available listeners 38 | */ 39 | Collection listeners(); 40 | 41 | /** 42 | * Add a listener to this handler. 43 | * 44 | * @param listener the listener to be added. 45 | */ 46 | void addListener(T listener); 47 | 48 | /** 49 | * Remove a listener from this handler. 50 | * 51 | * @param listener the listener to be removed. 52 | */ 53 | void removeListener(T listener); 54 | } 55 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/util/ListenerHandlerFactory.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.common.util; 17 | 18 | /** 19 | * Template interface for a listener handler factory. 20 | */ 21 | public interface ListenerHandlerFactory 22 | { 23 | /** 24 | * Create a handler for the passed in listenerClass. 25 | * 26 | * @param listenerClass the interface that notifications are sent on. 27 | * @param the type of the interface notifies are called on. 28 | * @return a ListenerHandler. 29 | */ 30 | ListenerHandler createHandler(Class listenerClass); 31 | } 32 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/util/OperationListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.common.util; 17 | 18 | /** 19 | * The basic operation listener interface. 20 | * 21 | * @param the type used to convey status and error details. 22 | */ 23 | public interface OperationListener 24 | { 25 | /** 26 | * Called whn the operation is completed. 27 | */ 28 | void completed(); 29 | 30 | /** 31 | * Called when a status message is sent. 32 | * 33 | * @param statusObject an object providing some status details. 34 | */ 35 | void status(E statusObject); 36 | 37 | /** 38 | * Called if the operation fails and will not complete. 39 | * 40 | * @param errorObject an object providing some error details. 41 | */ 42 | void failed(E errorObject); 43 | } 44 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/util/TranscriptType.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.common.util; 17 | 18 | /** 19 | * Class of data available for shuffle transcripts. 20 | */ 21 | public enum TranscriptType 22 | { 23 | /** 24 | * Transcript including commitments and commitment values. 25 | */ 26 | GENERAL, 27 | /** 28 | * Transcript of witness values. 29 | */ 30 | WITNESSES 31 | } 32 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/util/challenge/OddsEvensChallenger.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.common.util.challenge; 17 | 18 | import org.cryptoworkshop.ximix.common.util.IndexNumberGenerator; 19 | 20 | /** 21 | * A base class for a challenger that swaps between odds and even ranges of messages. 22 | */ 23 | public abstract class OddsEvensChallenger 24 | implements IndexNumberGenerator 25 | { 26 | protected final int stepNo; 27 | protected final boolean isOddStepNumber; 28 | protected final int range; 29 | protected final boolean isOddRange; 30 | 31 | /** 32 | * Base constructor. 33 | * 34 | * @param size the number of messages on the board we are issuing challenges on. 35 | * @param stepNo the number of the step in the shuffling process. 36 | * @param seed a random seed for creating index numbers to challenge on. 37 | */ 38 | public OddsEvensChallenger(Integer size, Integer stepNo, byte[] seed) 39 | { 40 | this.stepNo = stepNo; 41 | this.isOddStepNumber = ((stepNo.intValue() & 0x1) == 1); 42 | this.range = size / 2; 43 | this.isOddRange = ((size.intValue() & 0x1) == 1); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/util/challenge/SerialChallenger.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.common.util.challenge; 17 | 18 | import java.util.concurrent.atomic.AtomicInteger; 19 | 20 | import org.cryptoworkshop.ximix.common.util.IndexNumberGenerator; 21 | 22 | /** 23 | * A challenger that simply increments through the board contents. 24 | */ 25 | public class SerialChallenger 26 | implements IndexNumberGenerator 27 | { 28 | private final int size; 29 | 30 | private AtomicInteger counter; 31 | 32 | /** 33 | * Base constructor. 34 | * 35 | * @param size the number of messages on the board we are issuing challenges on. 36 | * @param stepNo the number of the step in the shuffling process. 37 | * @param seed a random seed for creating index numbers to challenge on. 38 | */ 39 | public SerialChallenger(Integer size, Integer stepNo, byte[] seed) 40 | { 41 | this.size = size; 42 | this.counter = new AtomicInteger(0); 43 | } 44 | 45 | @Override 46 | public boolean hasNext() 47 | { 48 | return counter.get() != size; 49 | } 50 | 51 | @Override 52 | public int nextIndex() 53 | { 54 | return counter.getAndIncrement(); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/util/challenge/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Basic challengers used for working out which messages/commitments to download. 18 | */ 19 | package org.cryptoworkshop.ximix.common.util.challenge; 20 | 21 | 22 | -------------------------------------------------------------------------------- /common/src/main/java/org/cryptoworkshop/ximix/common/util/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Utility classes for dealing with common issues such as event handling and listeners. 18 | */ 19 | package org.cryptoworkshop.ximix.common.util; 20 | 21 | 22 | -------------------------------------------------------------------------------- /common/src/test/java/org/cryptoworkshop/ximix/common/test/NodeStatusMessageTest.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.common.test; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.List; 6 | import java.util.Map; 7 | 8 | import junit.framework.TestCase; 9 | import org.bouncycastle.asn1.ASN1Primitive; 10 | import org.bouncycastle.asn1.util.ASN1Dump; 11 | import org.cryptoworkshop.ximix.common.asn1.message.NodeStatusMessage; 12 | import org.junit.Test; 13 | 14 | /** 15 | * Test for a node status message. 16 | */ 17 | public class NodeStatusMessageTest 18 | extends TestCase 19 | { 20 | 21 | @Test 22 | public void testEncodeDecode() 23 | throws Exception 24 | { 25 | 26 | List testList = new ArrayList<>(); 27 | testList.add("cats"); 28 | testList.add("dogs"); 29 | testList.add("fish"); 30 | testList.add("rabbit"); 31 | 32 | 33 | NodeStatusMessage.Builder builder = new NodeStatusMessage.Builder(NodeStatusMessage.Info.class); 34 | 35 | 36 | builder.put("a", "bar"); 37 | builder.put("b", 10); 38 | builder.put("list", testList); 39 | 40 | 41 | Map m = new HashMap<>(); 42 | 43 | m.put("foo", "bar"); 44 | m.put("cat", 1); 45 | 46 | 47 | builder.put("map", m); 48 | 49 | NodeStatusMessage nsm = builder.build(); 50 | 51 | 52 | ASN1Primitive prim = nsm.toASN1Primitive(); 53 | 54 | System.out.println(ASN1Dump.dumpAsString(prim, true)); 55 | 56 | 57 | NodeStatusMessage res = NodeStatusMessage.Info.getInstance(prim); 58 | TestCase.assertTrue(nsm.getValues().get("a").equals(res.getValues().get("a"))); 59 | TestCase.assertTrue(nsm.getValues().get("b").equals(res.getValues().get("b"))); 60 | 61 | int t = 0; 62 | for (String v : testList) 63 | { 64 | TestCase.assertEquals(v, ((List)res.getValues().get("list")).get(t++)); 65 | } 66 | 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /console/build.gradle.disabled: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(':common') 3 | compile project(':node') 4 | compile 'org.eclipse.jetty:jetty-server:9.0.3.v20130506' 5 | compile 'com.fasterxml.jackson.core:jackson-core:2.2.0' 6 | compile 'com.fasterxml.jackson.core:jackson-databind:2.2.0' 7 | compile 'com.fasterxml.jackson.core:jackson-annotations:2.2.0' 8 | } 9 | -------------------------------------------------------------------------------- /console/includes/ximix-console/bin/start.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | IF NOT EXIST "%XIMIX_CONSOLE_HOME%" ( 3 | SET XIMIX_CONSOLE_HOME=%~dp0..\ 4 | ) 5 | 6 | IF NOT EXIST "%XIMIX_CONSOLE_HOME%\libs" ( 7 | ECHO XIMIX_CONSOLE_HOME is incorrect could not find XIMIX_CONSOLE_HOME\libs 8 | goto END 9 | ) 10 | 11 | IF NOT EXIST "%JAVA_HOME%\bin\java.exe" ( 12 | ECHO JAVA_HOME is not set, it must point to a valid java 1.7 installation. 13 | goto END 14 | ) 15 | 16 | 17 | "%JAVA_HOME%\bin\java.exe" -cp "%XIMIX_CONSOLE_HOME%\libs\*" org.cryptoworkshop.ximix.console.Main %2 %1" 18 | 19 | :END 20 | 21 | -------------------------------------------------------------------------------- /console/includes/ximix-console/bin/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ -z "$XIMXI_CONSOLE_HOME" ]]; then 4 | L=`dirname $0` 5 | XIMIX_CONSOLE_HOME="$L/../" 6 | fi 7 | 8 | if [[ ! -d "$XIMIX_CONSOLE_HOME/libs" ]]; then 9 | echo "Could not find libs off XIMIX_CONSOLE_HOME ( $XIMIX_CONSOLE_HOME )" 10 | exit -1 11 | fi 12 | 13 | if [[ -z "$JAVA_HOME" ]]; then 14 | echo "JAVA_HOME is not specified"; 15 | fi 16 | 17 | MIX="$XIMIX_CONSOLE_HOME/conf/mixnet.xml" 18 | CONF="$XIMIX_CONSOLE_HOME/conf/console.xml" 19 | PIDFILE="$XIMIX_CONSOLE_HOME/console.pid" 20 | 21 | if [[ ! -f "$MIX" ]]; then 22 | echo "Network config not found, path was $MIX"; 23 | exit -1 24 | fi 25 | 26 | if [[ ! -f "$CONF" ]]; then 27 | echo "Node config was not found, path was $CONF"; 28 | exit -1; 29 | fi 30 | 31 | $JAVA_HOME/bin/java -cp "$XIMIX_CONSOLE_HOME/libs/*" org.cryptoworkshop.ximix.console.Main $CONF $MIX "$@" & 32 | PID=$! 33 | 34 | echo $PID > $PIDFILE 35 | -------------------------------------------------------------------------------- /console/includes/ximix-console/bin/stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ -z "$XIMXI_CONSOLE_HOME" ]]; then 4 | L=`dirname $0` 5 | XIMIX_CONSOLE_HOME="$L/../" 6 | 7 | fi 8 | 9 | if [[ ! -d "$XIMIX_CONSOLE_HOME/libs" ]]; then 10 | echo "Could not find libs directory off XIMIX_CONSOLE_HOME ( $XIMIX_CONSOLE_HOME )" 11 | exit -1 12 | fi 13 | 14 | PIDFILE="$XIMIX_CONSOLE_HOME/console.pid" 15 | 16 | if [[ ! -f "$PIDFILE" ]]; then 17 | echo "Pid file not found: $PIDFILE"; 18 | exit -1; 19 | fi 20 | 21 | PID=`cat $PIDFILE` 22 | 23 | if ps -p $PID > /dev/null; then 24 | COUNTER=12 25 | until [ $COUNTER -lt 0 ]; do 26 | echo "Sending kill -15 to Console ($PID)" 27 | kill -15 $PID 28 | sleep 5; 29 | let COUNTER-=1 30 | if ps -p $PID >/dev/null; then 31 | continue; 32 | fi 33 | echo "Stopped node $1"; 34 | exit 0; 35 | done 36 | 37 | echo "$1 not respoding to kill -15, sending kill -9" 38 | 39 | kill -9 $PID 40 | else 41 | echo "Console with pid $PID is not running." 42 | fi 43 | -------------------------------------------------------------------------------- /console/src/main/java/org/cryptoworkshop/ximix/console/config/HTTPConfig.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.console.config; 17 | 18 | import org.w3c.dom.Node; 19 | import org.w3c.dom.NodeList; 20 | 21 | /** 22 | * 23 | */ 24 | public class HTTPConfig 25 | { 26 | private int port = 1887; 27 | private String host = "localhost"; 28 | 29 | public HTTPConfig(Node n) 30 | { 31 | NodeList nl = n.getChildNodes(); 32 | for (int t = 0; t < nl.getLength(); t++) 33 | { 34 | Node node = nl.item(t); 35 | if ("bind-port".equals(node.getNodeName())) 36 | { 37 | this.port = Integer.valueOf(node.getTextContent().trim()); 38 | } 39 | 40 | if ("bind-host".equals(node.getNodeName())) 41 | { 42 | host = node.getTextContent(); 43 | } 44 | } 45 | } 46 | 47 | public int getPort() 48 | { 49 | return port; 50 | } 51 | 52 | public void setPort(int port) 53 | { 54 | this.port = port; 55 | } 56 | 57 | public String getHost() 58 | { 59 | return host; 60 | } 61 | 62 | public void setHost(String host) 63 | { 64 | this.host = host; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /console/src/main/java/org/cryptoworkshop/ximix/console/handlers/messages/StandardMessage.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.console.handlers.messages; 17 | 18 | /** 19 | * Base of all message objects. 20 | */ 21 | public class StandardMessage 22 | { 23 | 24 | private boolean successful = false; 25 | private int errorCode = 0; 26 | private String message = null; 27 | 28 | public StandardMessage() 29 | { 30 | 31 | } 32 | 33 | public StandardMessage(boolean successful, String message) 34 | { 35 | this.errorCode = 0; 36 | this.successful = successful; 37 | this.message = message; 38 | } 39 | 40 | public boolean isSuccessful() 41 | { 42 | return successful; 43 | } 44 | 45 | public void setSuccessful(boolean successful) 46 | { 47 | this.successful = successful; 48 | } 49 | 50 | public int getErrorCode() 51 | { 52 | return errorCode; 53 | } 54 | 55 | public void setErrorCode(int errorCode) 56 | { 57 | this.errorCode = errorCode; 58 | } 59 | 60 | public String getMessage() 61 | { 62 | return message; 63 | } 64 | 65 | public void setMessage(String message) 66 | { 67 | this.message = message; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /console/src/main/java/org/cryptoworkshop/ximix/console/model/AdapterInfo.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.console.model; 17 | 18 | /** 19 | * 20 | */ 21 | public class AdapterInfo implements Comparable 22 | { 23 | 24 | private String id = null; 25 | private String name = null; 26 | private String description = null; 27 | 28 | public AdapterInfo() 29 | { 30 | 31 | } 32 | 33 | public String getId() 34 | { 35 | return id; 36 | } 37 | 38 | public void setId(String id) 39 | { 40 | this.id = id; 41 | } 42 | 43 | public String getName() 44 | { 45 | return name; 46 | } 47 | 48 | public void setName(String name) 49 | { 50 | this.name = name; 51 | } 52 | 53 | public String getDescription() 54 | { 55 | return description; 56 | } 57 | 58 | public void setDescription(String description) 59 | { 60 | this.description = description; 61 | } 62 | 63 | @Override 64 | public int compareTo(AdapterInfo o) 65 | { 66 | if (o == null) 67 | { 68 | return -1; 69 | } 70 | 71 | return name.compareTo(o.getName()); 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /console/src/main/java/org/cryptoworkshop/ximix/console/util/Traversal.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.console.util; 2 | 3 | /** 4 | * Defines a basic traversal. 5 | */ 6 | public interface Traversal 7 | { 8 | void element(T element); 9 | } 10 | -------------------------------------------------------------------------------- /console/src/main/java/org/cryptoworkshop/ximix/tool/SHA1DigestCalculator.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.tool; 2 | 3 | import java.io.ByteArrayOutputStream; 4 | import java.io.OutputStream; 5 | 6 | import org.bouncycastle.asn1.oiw.OIWObjectIdentifiers; 7 | import org.bouncycastle.asn1.x509.AlgorithmIdentifier; 8 | import org.bouncycastle.crypto.Digest; 9 | import org.bouncycastle.crypto.digests.SHA1Digest; 10 | import org.bouncycastle.operator.DigestCalculator; 11 | 12 | class SHA1DigestCalculator 13 | implements DigestCalculator 14 | { 15 | private ByteArrayOutputStream bOut = new ByteArrayOutputStream(); 16 | 17 | public AlgorithmIdentifier getAlgorithmIdentifier() 18 | { 19 | return new AlgorithmIdentifier(OIWObjectIdentifiers.idSHA1); 20 | } 21 | 22 | public OutputStream getOutputStream() 23 | { 24 | return bOut; 25 | } 26 | 27 | public byte[] getDigest() 28 | { 29 | byte[] bytes = bOut.toByteArray(); 30 | 31 | bOut.reset(); 32 | 33 | Digest sha1 = new SHA1Digest(); 34 | 35 | sha1.update(bytes, 0, bytes.length); 36 | 37 | byte[] digest = new byte[sha1.getDigestSize()]; 38 | 39 | sha1.doFinal(digest, 0); 40 | 41 | return digest; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /console/src/main/java/org/cryptoworkshop/ximix/tool/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Command line tools for use with a running Ximix network. 18 | */ 19 | package org.cryptoworkshop.ximix.tool; 20 | 21 | 22 | -------------------------------------------------------------------------------- /console/src/main/resources/html/css/ui-lightness/images/animated-overlay.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/console/src/main/resources/html/css/ui-lightness/images/animated-overlay.gif -------------------------------------------------------------------------------- /console/src/main/resources/html/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/console/src/main/resources/html/css/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png -------------------------------------------------------------------------------- /console/src/main/resources/html/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/console/src/main/resources/html/css/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png -------------------------------------------------------------------------------- /console/src/main/resources/html/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/console/src/main/resources/html/css/ui-lightness/images/ui-bg_flat_10_000000_40x100.png -------------------------------------------------------------------------------- /console/src/main/resources/html/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/console/src/main/resources/html/css/ui-lightness/images/ui-bg_glass_100_f6f6f6_1x400.png -------------------------------------------------------------------------------- /console/src/main/resources/html/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/console/src/main/resources/html/css/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png -------------------------------------------------------------------------------- /console/src/main/resources/html/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/console/src/main/resources/html/css/ui-lightness/images/ui-bg_glass_65_ffffff_1x400.png -------------------------------------------------------------------------------- /console/src/main/resources/html/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/console/src/main/resources/html/css/ui-lightness/images/ui-bg_gloss-wave_35_f6a828_500x100.png -------------------------------------------------------------------------------- /console/src/main/resources/html/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/console/src/main/resources/html/css/ui-lightness/images/ui-bg_highlight-soft_100_eeeeee_1x100.png -------------------------------------------------------------------------------- /console/src/main/resources/html/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/console/src/main/resources/html/css/ui-lightness/images/ui-bg_highlight-soft_75_ffe45c_1x100.png -------------------------------------------------------------------------------- /console/src/main/resources/html/css/ui-lightness/images/ui-icons_222222_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/console/src/main/resources/html/css/ui-lightness/images/ui-icons_222222_256x240.png -------------------------------------------------------------------------------- /console/src/main/resources/html/css/ui-lightness/images/ui-icons_228ef1_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/console/src/main/resources/html/css/ui-lightness/images/ui-icons_228ef1_256x240.png -------------------------------------------------------------------------------- /console/src/main/resources/html/css/ui-lightness/images/ui-icons_ef8c08_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/console/src/main/resources/html/css/ui-lightness/images/ui-icons_ef8c08_256x240.png -------------------------------------------------------------------------------- /console/src/main/resources/html/css/ui-lightness/images/ui-icons_ffd27a_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/console/src/main/resources/html/css/ui-lightness/images/ui-icons_ffd27a_256x240.png -------------------------------------------------------------------------------- /console/src/main/resources/html/css/ui-lightness/images/ui-icons_ffffff_256x240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/console/src/main/resources/html/css/ui-lightness/images/ui-icons_ffffff_256x240.png -------------------------------------------------------------------------------- /console/src/main/resources/html/images/con.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/console/src/main/resources/html/images/con.gif -------------------------------------------------------------------------------- /console/src/main/resources/html/images/loader-lge.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/console/src/main/resources/html/images/loader-lge.gif -------------------------------------------------------------------------------- /console/src/main/resources/html/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/console/src/main/resources/html/images/logo.png -------------------------------------------------------------------------------- /console/src/main/resources/html/images/uncon.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/console/src/main/resources/html/images/uncon.gif -------------------------------------------------------------------------------- /console/src/main/resources/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 |
21 |
22 | Refresh Period: 28 |
29 |
30 |
31 |
    32 |
33 |
34 |
35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /console/src/main/resources/html/js/flot/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2007-2013 IOLA and Ole Laursen 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /console/src/main/resources/html/js/flot/jquery.flot.resize.min.js: -------------------------------------------------------------------------------- 1 | /* Flot plugin for automatically redrawing plots as the placeholder resizes. 2 | 3 | Copyright (c) 2007-2013 IOLA and Ole Laursen. 4 | Licensed under the MIT license. 5 | 6 | It works by listening for changes on the placeholder div (through the jQuery 7 | resize event plugin) - if the size changes, it will redraw the plot. 8 | 9 | There are no options. If you need to disable the plugin for some plots, you 10 | can just fix the size of their placeholders. 11 | 12 | *//* Inline dependency: 13 | * jQuery resize event - v1.1 - 3/14/2010 14 | * http://benalman.com/projects/jquery-resize-plugin/ 15 | * 16 | * Copyright (c) 2010 "Cowboy" Ben Alman 17 | * Dual licensed under the MIT and GPL licenses. 18 | * http://benalman.com/about/license/ 19 | */(function(e,t,n){function c(){s=t[o](function(){r.each(function(){var t=e(this),n=t.width(),r=t.height(),i=e.data(this,a);(n!==i.w||r!==i.h)&&t.trigger(u,[i.w=n,i.h=r])}),c()},i[f])}var r=e([]),i=e.resize=e.extend(e.resize,{}),s,o="setTimeout",u="resize",a=u+"-special-event",f="delay",l="throttleWindow";i[f]=250,i[l]=!0,e.event.special[u]={setup:function(){if(!i[l]&&this[o])return!1;var t=e(this);r=r.add(t),e.data(this,a,{w:t.width(),h:t.height()}),r.length===1&&c()},teardown:function(){if(!i[l]&&this[o])return!1;var t=e(this);r=r.not(t),t.removeData(a),r.length||clearTimeout(s)},add:function(t){function s(t,i,s){var o=e(this),u=e.data(this,a);u.w=i!==n?i:o.width(),u.h=s!==n?s:o.height(),r.apply(this,arguments)}if(!i[l]&&this[o])return!1;var r;if(e.isFunction(t))return r=t,s;r=t.handler,t.handler=s}}})(jQuery,this),function(e){function n(e){function t(){var t=e.getPlaceholder();if(t.width()==0||t.height()==0)return;e.resize(),e.setupGrid(),e.draw()}function n(e,n){e.getPlaceholder().resize(t)}function r(e,n){e.getPlaceholder().unbind("resize",t)}e.hooks.bindEvents.push(n),e.hooks.shutdown.push(r)}var t={};e.plot.plugins.push({init:n,options:t,name:"resize",version:"1.0"})}(jQuery); -------------------------------------------------------------------------------- /console/src/main/resources/html/js/flot/jquery.flot.symbol.min.js: -------------------------------------------------------------------------------- 1 | /* Flot plugin that adds some extra symbols for plotting points. 2 | 3 | Copyright (c) 2007-2013 IOLA and Ole Laursen. 4 | Licensed under the MIT license. 5 | 6 | The symbols are accessed as strings through the standard symbol options: 7 | 8 | series: { 9 | points: { 10 | symbol: "square" // or "diamond", "triangle", "cross" 11 | } 12 | } 13 | 14 | */(function(e){function t(e,t,n){var r={square:function(e,t,n,r,i){var s=r*Math.sqrt(Math.PI)/2;e.rect(t-s,n-s,s+s,s+s)},diamond:function(e,t,n,r,i){var s=r*Math.sqrt(Math.PI/2);e.moveTo(t-s,n),e.lineTo(t,n-s),e.lineTo(t+s,n),e.lineTo(t,n+s),e.lineTo(t-s,n)},triangle:function(e,t,n,r,i){var s=r*Math.sqrt(2*Math.PI/Math.sin(Math.PI/3)),o=s*Math.sin(Math.PI/3);e.moveTo(t-s/2,n+o/2),e.lineTo(t+s/2,n+o/2),i||(e.lineTo(t,n-o/2),e.lineTo(t-s/2,n+o/2))},cross:function(e,t,n,r,i){var s=r*Math.sqrt(Math.PI)/2;e.moveTo(t-s,n-s),e.lineTo(t+s,n+s),e.moveTo(t-s,n+s),e.lineTo(t+s,n-s)}},i=t.points.symbol;r[i]&&(t.points.symbol=r[i])}function n(e){e.hooks.processDatapoints.push(t)}e.plot.plugins.push({init:n,name:"symbols",version:"1.0"})})(jQuery); -------------------------------------------------------------------------------- /console/src/main/resources/html/js/lang/en_us.js: -------------------------------------------------------------------------------- 1 | // 2 | // EN US Language. 3 | // 4 | lang["name"] = "Name"; 5 | 6 | lang["ui.addplot"]="Plot"; 7 | lang["ui.plot.tooltip"]="Plot Statistic."; 8 | 9 | lang['info.title']="Node Information"; 10 | 11 | lang['vm.title']="Virtual Machine Info" 12 | lang['vm.plot.title']="Live Chart" 13 | lang["vm.vendor"] = "JVM"; 14 | lang["vm.vendor-name"] = "Vendor"; 15 | lang["vm.vendor-version"] = "Version"; 16 | lang["vm.available-processors"] = "Processors"; 17 | lang["vm.free-memory"] = "Free Memory"; 18 | lang["vm.start-time"] = "Start Time"; 19 | lang["vm.total-memory"] = "Total Memory"; 20 | lang["vm.used-memory"]="Used Memory"; 21 | lang["vm.up-time"] = "Up-Time"; 22 | lang["capabilities.title"] = "Capabilities"; 23 | 24 | 25 | 26 | lang['node.capabilities'] = "Node Capabilities"; 27 | 28 | lang['socket.title']="Listening Socket" 29 | lang['socket.port']="Listening Port"; 30 | lang['socket.bind-address']="Listening Address"; 31 | lang['socket.backlog']="Backlog"; 32 | 33 | 34 | lang['statistics.title']="Node Statistics"; 35 | 36 | lang['vm.gc.count.delta']="GC Count"; 37 | lang['vm.gc.time.delta']="GC Time"; 38 | 39 | 40 | // 41 | // Board hosting service statistics. 42 | // 43 | lang["bhs-title"]="Board Hosting Service" 44 | lang["bhs"] = {} 45 | lang["bhs"]["messages-on-board"]="Messages On Board"; 46 | 47 | 48 | // 49 | // prefix to type. 50 | // 51 | stype['bhs']="tab"; 52 | 53 | 54 | rtype["vm.free-memory"] = "mb"; 55 | rtype["vm.start-time"] = "time"; 56 | rtype["vm.total-memory"] = "mb"; 57 | rtype["vm.used-memory"] = "mb"; 58 | 59 | rtype["vm.up-time"] = "hms"; 60 | rtype["node.capabilities"] = "list"; 61 | rtype["node.metadata"] = "map"; 62 | rtype["board.hosting.service"] = "map"; 63 | 64 | 65 | // 66 | // Allow plot info. 67 | // 68 | allow_plot["vm.gc.count.delta"]={}; 69 | allow_plot["vm.gc.time.delta"] ={}; 70 | allow_plot["vm.free-memory"]={}; 71 | allow_plot["bhs!messages-on-board"]={}; 72 | allow_plot["vm.used-memory"]={}; 73 | 74 | // 75 | // Pre load graph. 76 | // 77 | default_plot.push("vm.free-memory"); 78 | default_plot.push("vm.gc.count.delta"); -------------------------------------------------------------------------------- /console/src/main/resources/html/js/lang/lang.js: -------------------------------------------------------------------------------- 1 | var languages = {}; 2 | var default_language="en_us"; 3 | 4 | languages.en_us = "/js/lang/en_us.js"; 5 | 6 | -------------------------------------------------------------------------------- /demo/build.gradle.disabled: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(':common') 3 | compile project(':crypto') 4 | compile project(':mixnet') 5 | compile project(':node') 6 | } 7 | -------------------------------------------------------------------------------- /demo/conf/console.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 1887 6 | 0.0.0.0 7 | 8 | 9 | 10 | org.cryptoworkshop.ximix.console.adapters.MixnetCommandServiceAdapter 11 | mixnetadmin 12 | Mixnet Admin 13 | Admin panel for the Mixnet 14 | 15 | 16 | 17 | 18 | 19 | ximix-console 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /demo/conf/mixnet.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | localhost 5 | 11000 6 | A 7 | 8 | 9 | localhost 10 | 11001 11 | B 12 | 13 | 14 | localhost 15 | 11002 16 | C 17 | 18 | 19 | localhost 20 | 11003 21 | D 22 | 23 | 24 | localhost 25 | 11004 26 | E 27 | 28 | 29 | -------------------------------------------------------------------------------- /demo/conf/node1/nodeCaStore.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/demo/conf/node1/nodeCaStore.p12 -------------------------------------------------------------------------------- /demo/conf/node1/trustCa.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIB/zCCAaQCAQEwCgYIKoZIzj0EAwIwgYoxCzAJBgNVBAYTAkFVMSAwHgYDVQQK 3 | DBdDcnlwdG8gV29ya3Nob3AgUHR5IEx0ZDEbMBkGA1UECwwSWGltaXggTm9kZSBU 4 | ZXN0IENBMRIwEAYDVQQHDAlNZWxib3VybmUxETAPBgNVBAgMCFZpY3RvcmlhMRUw 5 | EwYDVQQDDAxUcnVzdCBBbmNob3IwHhcNMTQwMjE1MDA0MDU5WhcNMTYwMjE1MDA0 6 | MTQ5WjCBijELMAkGA1UEBhMCQVUxIDAeBgNVBAoMF0NyeXB0byBXb3Jrc2hvcCBQ 7 | dHkgTHRkMRswGQYDVQQLDBJYaW1peCBOb2RlIFRlc3QgQ0ExEjAQBgNVBAcMCU1l 8 | bGJvdXJuZTERMA8GA1UECAwIVmljdG9yaWExFTATBgNVBAMMDFRydXN0IEFuY2hv 9 | cjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABL6UHYMIHxn0/iy+psDMrZ6i5taB 10 | iWdCBg4Sf2seMgcIulj7rfha+gccITdfhFvekd4TuzKnN9Kdx+r/ANN18ccwCgYI 11 | KoZIzj0EAwIDSQAwRgIhALY/gND++XVgMcJqm9QkcoKgyXrIcK+I3vYn2oU+wVdq 12 | AiEA8V2OyZcqC1RXWsSziD7ZCHAKO2XU9uUyfdppPIfN+eA= 13 | -----END CERTIFICATE----- 14 | -------------------------------------------------------------------------------- /demo/conf/node2/nodeCaStore.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/demo/conf/node2/nodeCaStore.p12 -------------------------------------------------------------------------------- /demo/conf/node2/trustCa.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIB/zCCAaQCAQEwCgYIKoZIzj0EAwIwgYoxCzAJBgNVBAYTAkFVMSAwHgYDVQQK 3 | DBdDcnlwdG8gV29ya3Nob3AgUHR5IEx0ZDEbMBkGA1UECwwSWGltaXggTm9kZSBU 4 | ZXN0IENBMRIwEAYDVQQHDAlNZWxib3VybmUxETAPBgNVBAgMCFZpY3RvcmlhMRUw 5 | EwYDVQQDDAxUcnVzdCBBbmNob3IwHhcNMTQwMjE1MDA0MDU5WhcNMTYwMjE1MDA0 6 | MTQ5WjCBijELMAkGA1UEBhMCQVUxIDAeBgNVBAoMF0NyeXB0byBXb3Jrc2hvcCBQ 7 | dHkgTHRkMRswGQYDVQQLDBJYaW1peCBOb2RlIFRlc3QgQ0ExEjAQBgNVBAcMCU1l 8 | bGJvdXJuZTERMA8GA1UECAwIVmljdG9yaWExFTATBgNVBAMMDFRydXN0IEFuY2hv 9 | cjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABL6UHYMIHxn0/iy+psDMrZ6i5taB 10 | iWdCBg4Sf2seMgcIulj7rfha+gccITdfhFvekd4TuzKnN9Kdx+r/ANN18ccwCgYI 11 | KoZIzj0EAwIDSQAwRgIhALY/gND++XVgMcJqm9QkcoKgyXrIcK+I3vYn2oU+wVdq 12 | AiEA8V2OyZcqC1RXWsSziD7ZCHAKO2XU9uUyfdppPIfN+eA= 13 | -----END CERTIFICATE----- 14 | -------------------------------------------------------------------------------- /demo/conf/node3/nodeCaStore.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/demo/conf/node3/nodeCaStore.p12 -------------------------------------------------------------------------------- /demo/conf/node3/trustCa.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIB/zCCAaQCAQEwCgYIKoZIzj0EAwIwgYoxCzAJBgNVBAYTAkFVMSAwHgYDVQQK 3 | DBdDcnlwdG8gV29ya3Nob3AgUHR5IEx0ZDEbMBkGA1UECwwSWGltaXggTm9kZSBU 4 | ZXN0IENBMRIwEAYDVQQHDAlNZWxib3VybmUxETAPBgNVBAgMCFZpY3RvcmlhMRUw 5 | EwYDVQQDDAxUcnVzdCBBbmNob3IwHhcNMTQwMjE1MDA0MDU5WhcNMTYwMjE1MDA0 6 | MTQ5WjCBijELMAkGA1UEBhMCQVUxIDAeBgNVBAoMF0NyeXB0byBXb3Jrc2hvcCBQ 7 | dHkgTHRkMRswGQYDVQQLDBJYaW1peCBOb2RlIFRlc3QgQ0ExEjAQBgNVBAcMCU1l 8 | bGJvdXJuZTERMA8GA1UECAwIVmljdG9yaWExFTATBgNVBAMMDFRydXN0IEFuY2hv 9 | cjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABL6UHYMIHxn0/iy+psDMrZ6i5taB 10 | iWdCBg4Sf2seMgcIulj7rfha+gccITdfhFvekd4TuzKnN9Kdx+r/ANN18ccwCgYI 11 | KoZIzj0EAwIDSQAwRgIhALY/gND++XVgMcJqm9QkcoKgyXrIcK+I3vYn2oU+wVdq 12 | AiEA8V2OyZcqC1RXWsSziD7ZCHAKO2XU9uUyfdppPIfN+eA= 13 | -----END CERTIFICATE----- 14 | -------------------------------------------------------------------------------- /demo/conf/node4/nodeCaStore.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/demo/conf/node4/nodeCaStore.p12 -------------------------------------------------------------------------------- /demo/conf/node4/trustCa.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIB/zCCAaQCAQEwCgYIKoZIzj0EAwIwgYoxCzAJBgNVBAYTAkFVMSAwHgYDVQQK 3 | DBdDcnlwdG8gV29ya3Nob3AgUHR5IEx0ZDEbMBkGA1UECwwSWGltaXggTm9kZSBU 4 | ZXN0IENBMRIwEAYDVQQHDAlNZWxib3VybmUxETAPBgNVBAgMCFZpY3RvcmlhMRUw 5 | EwYDVQQDDAxUcnVzdCBBbmNob3IwHhcNMTQwMjE1MDA0MDU5WhcNMTYwMjE1MDA0 6 | MTQ5WjCBijELMAkGA1UEBhMCQVUxIDAeBgNVBAoMF0NyeXB0byBXb3Jrc2hvcCBQ 7 | dHkgTHRkMRswGQYDVQQLDBJYaW1peCBOb2RlIFRlc3QgQ0ExEjAQBgNVBAcMCU1l 8 | bGJvdXJuZTERMA8GA1UECAwIVmljdG9yaWExFTATBgNVBAMMDFRydXN0IEFuY2hv 9 | cjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABL6UHYMIHxn0/iy+psDMrZ6i5taB 10 | iWdCBg4Sf2seMgcIulj7rfha+gccITdfhFvekd4TuzKnN9Kdx+r/ANN18ccwCgYI 11 | KoZIzj0EAwIDSQAwRgIhALY/gND++XVgMcJqm9QkcoKgyXrIcK+I3vYn2oU+wVdq 12 | AiEA8V2OyZcqC1RXWsSziD7ZCHAKO2XU9uUyfdppPIfN+eA= 13 | -----END CERTIFICATE----- 14 | -------------------------------------------------------------------------------- /demo/conf/node5/nodeCaStore.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/demo/conf/node5/nodeCaStore.p12 -------------------------------------------------------------------------------- /demo/conf/node5/trustCa.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIB/zCCAaQCAQEwCgYIKoZIzj0EAwIwgYoxCzAJBgNVBAYTAkFVMSAwHgYDVQQK 3 | DBdDcnlwdG8gV29ya3Nob3AgUHR5IEx0ZDEbMBkGA1UECwwSWGltaXggTm9kZSBU 4 | ZXN0IENBMRIwEAYDVQQHDAlNZWxib3VybmUxETAPBgNVBAgMCFZpY3RvcmlhMRUw 5 | EwYDVQQDDAxUcnVzdCBBbmNob3IwHhcNMTQwMjE1MDA0MDU5WhcNMTYwMjE1MDA0 6 | MTQ5WjCBijELMAkGA1UEBhMCQVUxIDAeBgNVBAoMF0NyeXB0byBXb3Jrc2hvcCBQ 7 | dHkgTHRkMRswGQYDVQQLDBJYaW1peCBOb2RlIFRlc3QgQ0ExEjAQBgNVBAcMCU1l 8 | bGJvdXJuZTERMA8GA1UECAwIVmljdG9yaWExFTATBgNVBAMMDFRydXN0IEFuY2hv 9 | cjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABL6UHYMIHxn0/iy+psDMrZ6i5taB 10 | iWdCBg4Sf2seMgcIulj7rfha+gccITdfhFvekd4TuzKnN9Kdx+r/ANN18ccwCgYI 11 | KoZIzj0EAwIDSQAwRgIhALY/gND++XVgMcJqm9QkcoKgyXrIcK+I3vYn2oU+wVdq 12 | AiEA8V2OyZcqC1RXWsSziD7ZCHAKO2XU9uUyfdppPIfN+eA= 13 | -----END CERTIFICATE----- 14 | -------------------------------------------------------------------------------- /demo/conf/trustCa.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIB/zCCAaQCAQEwCgYIKoZIzj0EAwIwgYoxCzAJBgNVBAYTAkFVMSAwHgYDVQQK 3 | DBdDcnlwdG8gV29ya3Nob3AgUHR5IEx0ZDEbMBkGA1UECwwSWGltaXggTm9kZSBU 4 | ZXN0IENBMRIwEAYDVQQHDAlNZWxib3VybmUxETAPBgNVBAgMCFZpY3RvcmlhMRUw 5 | EwYDVQQDDAxUcnVzdCBBbmNob3IwHhcNMTQwMjE1MDA0MDU5WhcNMTYwMjE1MDA0 6 | MTQ5WjCBijELMAkGA1UEBhMCQVUxIDAeBgNVBAoMF0NyeXB0byBXb3Jrc2hvcCBQ 7 | dHkgTHRkMRswGQYDVQQLDBJYaW1peCBOb2RlIFRlc3QgQ0ExEjAQBgNVBAcMCU1l 8 | bGJvdXJuZTERMA8GA1UECAwIVmljdG9yaWExFTATBgNVBAMMDFRydXN0IEFuY2hv 9 | cjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABL6UHYMIHxn0/iy+psDMrZ6i5taB 10 | iWdCBg4Sf2seMgcIulj7rfha+gccITdfhFvekd4TuzKnN9Kdx+r/ANN18ccwCgYI 11 | KoZIzj0EAwIDSQAwRgIhALY/gND++XVgMcJqm9QkcoKgyXrIcK+I3vYn2oU+wVdq 12 | AiEA8V2OyZcqC1RXWsSziD7ZCHAKO2XU9uUyfdppPIfN+eA= 13 | -----END CERTIFICATE----- 14 | -------------------------------------------------------------------------------- /demo/lt/bigvote.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 3 | 4 | 5 | 100000 6 | 60 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /demo/src/main/java/org/cryptoworkshop/ximix/demo/lt/LoadTester.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.demo.lt; 2 | 3 | import org.cryptoworkshop.ximix.common.config.Config; 4 | 5 | import java.io.File; 6 | 7 | /** 8 | * 9 | */ 10 | public class LoadTester 11 | { 12 | public static void main(String[] args) 13 | throws Exception 14 | { 15 | Config config = new Config(new File(args[0])); 16 | LoadTesterConfig cfg = (LoadTesterConfig)config.getConfigObjects("lt",new LoadTesterConfigFactory()); 17 | 18 | 19 | 20 | } 21 | 22 | 23 | } 24 | -------------------------------------------------------------------------------- /demo/src/main/java/org/cryptoworkshop/ximix/demo/lt/LoadTesterConfig.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.demo.lt; 2 | 3 | import org.w3c.dom.Node; 4 | import org.w3c.dom.NodeList; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | /** 10 | * 11 | */ 12 | public class LoadTesterConfig 13 | { 14 | private final List races = new ArrayList<>(); 15 | 16 | 17 | public List getRaces() 18 | { 19 | return races; 20 | } 21 | 22 | public LoadTesterConfig(Node parent) 23 | { 24 | NodeList nl = parent.getChildNodes(); 25 | 26 | for (int t = 0; t < nl.getLength(); t++) 27 | { 28 | Node node = nl.item(t); 29 | String n = node.getNodeName(); 30 | if ("races".equals(n)) 31 | { 32 | races.add(new RaceConfig(node)); 33 | } 34 | } 35 | 36 | 37 | 38 | } 39 | 40 | 41 | public static class RaceConfig 42 | { 43 | private int numBallots; 44 | private int candidates; 45 | 46 | public RaceConfig(Node parent) 47 | { 48 | NodeList nl = parent.getChildNodes(); 49 | for (int t = 0; t < nl.getLength(); t++) 50 | { 51 | Node node = nl.item(t); 52 | if ("number".equals(node.getNodeName())) 53 | { 54 | numBallots = Integer.valueOf(node.getTextContent()); 55 | } 56 | else if ("candidates".equals(node.getNodeName())) 57 | { 58 | candidates = Integer.valueOf(node.getTextContent()); 59 | } 60 | } 61 | } 62 | 63 | public int getNumBallots() 64 | { 65 | return numBallots; 66 | } 67 | 68 | public int getCandidates() 69 | { 70 | return candidates; 71 | } 72 | } 73 | 74 | } 75 | -------------------------------------------------------------------------------- /demo/src/main/java/org/cryptoworkshop/ximix/demo/lt/LoadTesterConfigFactory.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.demo.lt; 2 | 3 | import org.cryptoworkshop.ximix.common.config.ConfigObjectFactory; 4 | import org.w3c.dom.Node; 5 | 6 | /** 7 | * 8 | */ 9 | public class LoadTesterConfigFactory 10 | implements ConfigObjectFactory 11 | { 12 | @Override 13 | public LoadTesterConfig createObject(Node configNode) 14 | { 15 | return new LoadTesterConfig(configNode); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /docs/XimixOutline.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/docs/XimixOutline.pdf -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | libsJarPath=libs 2 | cryptoWorkshopLibsPrefix=http://www.cryptoworkshop.com/libs/ 3 | providerRemoteUrl=http://repo1.maven.org/maven2/org/bouncycastle/bcprov-jdk15on/1.51/bcprov-jdk15on-1.51.jar 4 | pkixRemoteUrl=http://repo1.maven.org/maven2/org/bouncycastle/bcpkix-jdk15on/1.51/bcpkix-jdk15on-1.51.jar 5 | jpbcRemoteUrl1=http://www.cryptoworkshop.com/libs/jpbc-api-1.2.1.jar 6 | jpbcRemoteUrl2=http://www.cryptoworkshop.com/libs/jpbc-crypto-1.2.1.jar 7 | jpbcRemoteUrl3=http://www.cryptoworkshop.com/libs/jpbc-plaf-1.2.1.jar 8 | jpbcRemoteUrl4=http://www.cryptoworkshop.com/libs/jpbc-pbc-1.2.1.jar 9 | mapdbRemoteUrl=http://repo1.maven.org/maven2/org/mapdb/mapdb/1.0.6/mapdb-1.0.6.jar 10 | -------------------------------------------------------------------------------- /installer/build.gradle.disabled: -------------------------------------------------------------------------------- 1 | dependencies { 2 | 3 | 4 | } 5 | 6 | 7 | 8 | 9 | jar { 10 | 11 | doFirst { 12 | File root = project(':installer').file("build/layout"); 13 | 14 | 15 | // 16 | // The image directory holds the files that are available for installation. 17 | // 18 | 19 | File node = new File(root, "node"); 20 | 21 | // Delete is exists. 22 | // 23 | if (root.exists()) { 24 | org.apache.commons.io.FileUtils.deleteDirectory(root); 25 | } 26 | 27 | root.mkdirs(); 28 | node.mkdirs(); 29 | 30 | File output = project(':installer').file("build/installers"); 31 | output.mkdirs(); 32 | 33 | 34 | 35 | File f = new File(node, "libs"); 36 | f.mkdirs(); 37 | 38 | // 39 | // Copy jars to target dir. 40 | // 41 | 42 | org.apache.commons.io.FileUtils.copyFile( 43 | project(':common').file("build/libs/common.jar"), 44 | new File(f, "common.jar")); 45 | 46 | org.apache.commons.io.FileUtils.copyFile( 47 | project(':crypto').file("build/libs/crypto.jar"), 48 | new File(f, "crypto.jar")); 49 | 50 | org.apache.commons.io.FileUtils.copyFile( 51 | project(':mixnet').file("build/libs/mixnet.jar"), 52 | new File(f, "mixnet.jar")); 53 | 54 | 55 | File confDir = new File(node,"conf"); 56 | confDir.mkdirs(); 57 | 58 | } 59 | 60 | from (project(':installer').file("build/layout/node")) { 61 | into "node" 62 | }; 63 | 64 | from (project(':installer').file("src/main/resources/install.xml")) { 65 | "/install.xml" 66 | } 67 | 68 | 69 | manifest { 70 | attributes("Main-Class": "org.cryptoworkshop.ximix.installer.Installer"); 71 | } 72 | 73 | } -------------------------------------------------------------------------------- /installer/includes/ximix/bin/start.bat: -------------------------------------------------------------------------------- 1 | echo off 2 | IF NOT EXIST "%XIMIX_HOME%" ( 3 | SET XIMIX_HOME=%~dp0..\ 4 | ) 5 | 6 | IF NOT EXIST "%XIMIX_HOME%\libs" ( 7 | ECHO XIMIX_HOME is incorrect could not find XIMIX_HOME\libs 8 | goto END 9 | ) 10 | 11 | IF NOT EXIST "%JAVA_HOME%\bin\java.exe" ( 12 | ECHO JAVA_HOME is not set, it must point to a valid java 1.7 installation. 13 | goto END 14 | ) 15 | 16 | IF NOT EXIST "%XIMIX_HOME%/%1" ( 17 | ECHO "NODE name has not been defined, eg: run.bat node1" 18 | goto END 19 | ) 20 | 21 | 22 | "%JAVA_HOME%\bin\java.exe" -cp "%XIMIX_HOME%\libs\*" org.cryptoworkshop.ximix.node.Main "%XIMIX_HOME%\%1\conf\mixnet.xml" "%XIMIX_HOME%\%1\conf\node.xml" 23 | 24 | :END 25 | 26 | -------------------------------------------------------------------------------- /installer/includes/ximix/bin/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ -z "$XIMIX_HOME" ]]; then 4 | L=`dirname $0` 5 | XIMIX_HOME="$L/../" 6 | fi 7 | 8 | 9 | if [[ -z "$XIMIX_JAVA_OPTS" ]]; then 10 | XIMIX_JAVA_OPTS=-Xmx768m 11 | fi 12 | 13 | if [[ "x$1" = "x" ]]; then 14 | echo "Parameter 1 must be node name, eg start.sh node1" 15 | exit -1 16 | fi 17 | 18 | if [[ ! -d "$XIMIX_HOME/libs" ]]; then 19 | echo "Could not find libs directory off XIMIX_HOME ( $XIMIX_HOME )" 20 | exit -1 21 | fi 22 | 23 | 24 | if [[ -z "$JAVA_HOME" ]]; then 25 | echo "JAVA_HOME is not specified"; 26 | fi 27 | 28 | 29 | if [[ ! -z "$1" ]]; then 30 | MIX="$XIMIX_HOME/$1/conf/mixnet.xml" 31 | NODE="$XIMIX_HOME/$1/conf/node.xml" 32 | PIDFILE="$XIMIX_HOME/$1/$1.pid" 33 | fi 34 | 35 | if [[ ! -f "$MIX" ]]; then 36 | echo "Network config not found for $1, path was $MIX"; 37 | exit -1 38 | fi 39 | 40 | if [[ ! -f "$NODE" ]]; then 41 | echo "Node config was not found for $1, path was $NODE"; 42 | exit -1; 43 | fi 44 | 45 | $JAVA_HOME/bin/java $XIMIX_JAVA_OPTS -cp "$XIMIX_HOME/libs/*" org.cryptoworkshop.ximix.node.Main $MIX $NODE "$@" & 46 | PID=$! 47 | 48 | echo $PID > $PIDFILE 49 | -------------------------------------------------------------------------------- /installer/includes/ximix/bin/stop.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ -z "$XIMXI_HOME" ]]; then 4 | L=`dirname $0` 5 | XIMIX_HOME="$L/../" 6 | 7 | fi 8 | 9 | if [[ "x$1" = "x" ]]; then 10 | echo "Parameter 1 must be node name, eg stop.sh node1" 11 | exit -1 12 | fi 13 | 14 | if [[ ! -d "$XIMIX_HOME/libs" ]]; then 15 | echo "Could not find libs directory off XIMIX_HOME ( $XIMIX_HOME )" 16 | exit -1 17 | fi 18 | 19 | PIDFILE="$XIMIX_HOME/$1/$1.pid" 20 | 21 | if [[ ! -f "$PIDFILE" ]]; then 22 | echo "Pid file not found: $PIDFILE"; 23 | exit -1; 24 | fi 25 | 26 | PID=`cat $PIDFILE` 27 | 28 | if ps -p $PID > /dev/null; then 29 | COUNTER=12 30 | until [ $COUNTER -lt 0 ]; do 31 | echo "Sending kill -15 to $1 ($PID)" 32 | kill -15 $PID 33 | sleep 5; 34 | let COUNTER-=1 35 | if ps -p $PID >/dev/null; then 36 | continue; 37 | fi 38 | echo "Stopped node $1"; 39 | exit 0; 40 | done 41 | 42 | echo "$1 not responding to kill -15, sending kill -9" 43 | 44 | kill -9 $PID 45 | else 46 | echo "$1 with pid $PID is not running." 47 | fi 48 | 49 | -------------------------------------------------------------------------------- /installer/manifest/MANIFEST.mf: -------------------------------------------------------------------------------- 1 | Main-Class: org.cryptoworkshop.ximix.installer.Installer 2 | -------------------------------------------------------------------------------- /installer/src/main/java/org/cryptoworkshop/ximix/installer/InstallerListener.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.installer; 2 | 3 | /** 4 | * 5 | */ 6 | public interface InstallerListener { 7 | void exception(String s, Exception ex); 8 | } 9 | -------------------------------------------------------------------------------- /installer/src/main/java/org/cryptoworkshop/ximix/installer/Util.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.installer; 2 | 3 | import org.w3c.dom.NamedNodeMap; 4 | import org.w3c.dom.Node; 5 | import org.w3c.dom.NodeList; 6 | 7 | import java.util.Enumeration; 8 | import java.util.zip.ZipEntry; 9 | import java.util.zip.ZipFile; 10 | 11 | 12 | /** 13 | * 14 | */ 15 | public class Util { 16 | 17 | 18 | /** 19 | * Traverse children. 20 | * 21 | * @param parent The parent. 22 | * @param traversal The traversal callback. 23 | */ 24 | public static void traverseChildren(Node parent, NodeTraversal traversal) { 25 | NodeList nl = parent.getChildNodes(); 26 | for (int t = 0; t < nl.getLength(); t++) { 27 | traversal.node(nl.item(t)); 28 | } 29 | } 30 | 31 | /** 32 | * Traverse the attributes of a node. 33 | * 34 | * @param parent The parent. 35 | * @param traversal The traversal callback. 36 | */ 37 | public static void traverseAttributes(Node parent, NodeTraversal traversal) { 38 | NamedNodeMap nnM = parent.getAttributes(); 39 | for (int t = 0; t < nnM.getLength(); t++) { 40 | traversal.node(nnM.item(t)); 41 | } 42 | } 43 | 44 | /** 45 | * NodeTraversal callback. 46 | */ 47 | public static interface NodeTraversal { 48 | void node(Node n); 49 | } 50 | 51 | 52 | public static interface ZipTraversal { 53 | void entry(ZipEntry ze); 54 | } 55 | 56 | 57 | public static void zipDir(String name, ZipFile file, ZipTraversal traversal) 58 | { 59 | Enumeration entries = file.entries(); 60 | while(entries.hasMoreElements()) 61 | { 62 | ZipEntry ze = entries.nextElement(); 63 | if (ze.getName().startsWith(name)) 64 | { 65 | traversal.entry(ze); 66 | } 67 | } 68 | 69 | 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /installer/src/main/java/org/cryptoworkshop/ximix/installer/ui/AbstractInstallerUI.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.installer.ui; 2 | 3 | import org.cryptoworkshop.ximix.installer.InstallerConfig; 4 | import org.cryptoworkshop.ximix.installer.ui.steps.AbstractInstallerStep; 5 | 6 | import java.util.HashMap; 7 | import java.util.Map; 8 | 9 | /** 10 | * 11 | */ 12 | public abstract class AbstractInstallerUI 13 | { 14 | private Map properties = new HashMap(); 15 | 16 | public abstract void init(InstallerConfig config) throws Exception; 17 | 18 | public Map getProperties() 19 | { 20 | return properties; 21 | } 22 | 23 | public abstract ShowResult show(AbstractInstallerStep step) throws Exception; 24 | 25 | public enum ShowResult 26 | { 27 | BACK, NEXT, CANCEL, EXIT 28 | } 29 | 30 | 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /installer/src/main/java/org/cryptoworkshop/ximix/installer/ui/MainConsole.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.installer.ui; 2 | 3 | import org.cryptoworkshop.ximix.installer.InstallerConfig; 4 | import org.cryptoworkshop.ximix.installer.ui.steps.AbstractInstallerStep; 5 | 6 | import java.io.PrintWriter; 7 | import java.util.concurrent.CountDownLatch; 8 | 9 | /** 10 | * 11 | */ 12 | public class MainConsole extends AbstractInstallerUI 13 | { 14 | private PrintWriter pw = null; 15 | 16 | 17 | public MainConsole() 18 | { 19 | pw = new PrintWriter(System.out); 20 | } 21 | 22 | @Override 23 | public void init(InstallerConfig config) throws Exception 24 | { 25 | 26 | } 27 | 28 | @Override 29 | public ShowResult show(AbstractInstallerStep step) throws Exception 30 | { 31 | 32 | return null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /installer/src/main/java/org/cryptoworkshop/ximix/installer/ui/steps/ConfirmStep.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.installer.ui.steps; 2 | 3 | import java.util.HashMap; 4 | 5 | /** 6 | * Confirm before install. 7 | */ 8 | public class ConfirmStep extends AbstractInstallerStep { 9 | 10 | public static final String ID = "confirm_step"; 11 | 12 | public ConfirmStep() { 13 | super(); 14 | this.title = "Confirm installation."; 15 | this.content = ""; 16 | userInputs.add(new UserInput("Summary", InputType.SUMMARY,"summary")); 17 | } 18 | 19 | @Override 20 | public String acceptValue(HashMap value) { 21 | return null; 22 | } 23 | 24 | @Override 25 | public Object getDefault() { 26 | return null; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /installer/src/main/java/org/cryptoworkshop/ximix/installer/ui/steps/SelectInstallLocation.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.installer.ui.steps; 2 | 3 | import java.io.File; 4 | import java.util.HashMap; 5 | 6 | /** 7 | * The location to install the nodes. 8 | */ 9 | public class SelectInstallLocation extends AbstractInstallerStep 10 | { 11 | 12 | File installLocation = new File("./ximix/"); 13 | 14 | public static final String ID = "installDir"; 15 | 16 | 17 | 18 | 19 | public SelectInstallLocation() 20 | { 21 | super(); 22 | 23 | FileInputConstraints constraints = new FileInputConstraints(); 24 | constraints.setOnlyDirectories(true); 25 | userInputs.add(new UserInput("Location:",InputType.FILE,ID).setToolTip("Installation directory").setConstraints(constraints)); 26 | title = "Installation location."; 27 | content="Select the path to the directory on your file system Ximix will be installed."; 28 | } 29 | 30 | 31 | @Override 32 | public String acceptValue(HashMap value) 33 | { 34 | installLocation = (File)value.get(ID); 35 | return null; 36 | } 37 | 38 | @Override 39 | public Object getDefault() 40 | { 41 | return installLocation; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /installer/src/main/java/org/cryptoworkshop/ximix/installer/ui/steps/SelectNumberOfNodes.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.installer.ui.steps; 2 | 3 | import java.util.HashMap; 4 | 5 | /** 6 | * 7 | */ 8 | public class SelectNumberOfNodes extends AbstractInstallerStep { 9 | 10 | private int count = 1; 11 | 12 | public static final String ID = "number_of_nodes"; 13 | 14 | public SelectNumberOfNodes() { 15 | super(); 16 | this.title = "Please select the number of nodes"; 17 | this.content = "This installer can install one of more nodes for testing, each node can be individually configured via its configuration file."; 18 | userInputs.add(new UserInput("Number of nodes", InputType.NUMBER, ID).setToolTip("Select the number of nodes to be installed.").setConstraints(new IntegerInputConstrains())); 19 | } 20 | 21 | @Override 22 | public Object getDefault() { 23 | return count; 24 | } 25 | 26 | @Override 27 | public String acceptValue(HashMap value) { 28 | try { 29 | int c = (Integer) value.get(ID); 30 | if (c < 1) { 31 | return "Value must be larger then 0"; 32 | } 33 | 34 | count = c; 35 | 36 | } catch (Exception ex) { 37 | return "Invalid value"; 38 | } 39 | 40 | return null; 41 | } 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /installer/src/main/resources/install.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Ximix 5 | Put description here.. 6 | install_1 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 1 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /installer/src/main/resources/install_node.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Ximix 5 | Put description here.. 6 | install_1 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 1 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /mirror.test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/mirror.test -------------------------------------------------------------------------------- /node/build.gradle.disabled: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(':common') 3 | compile project(':crypto') 4 | compile project(':mixnet') 5 | } 6 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/Main.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.node; 17 | 18 | import java.io.File; 19 | import java.io.FileNotFoundException; 20 | import java.security.Security; 21 | 22 | import org.bouncycastle.jce.provider.BouncyCastleProvider; 23 | import org.cryptoworkshop.ximix.common.config.ConfigException; 24 | import org.cryptoworkshop.ximix.node.core.XimixNodeBuilder; 25 | 26 | /** 27 | * Main class for starting up a node. 28 | */ 29 | public class Main 30 | { 31 | public static void main(String[] args) 32 | { 33 | Security.addProvider(new BouncyCastleProvider()); 34 | 35 | if (args.length < 2) 36 | { 37 | System.out.println("Ximix Node executable jar."); 38 | System.out.println("Usage: "); 39 | System.out.println("Example: java -jar XimixNode.jar mixnet.xml node.xml"); 40 | System.exit(0); 41 | } 42 | 43 | try 44 | { 45 | 46 | XimixNodeBuilder builder = new XimixNodeBuilder(new File(args[0])); 47 | 48 | XimixNode node = builder.build(new File(args[1])); 49 | 50 | node.start(); 51 | } 52 | catch (ConfigException e) 53 | { 54 | e.printStackTrace(); 55 | } 56 | catch (FileNotFoundException e) 57 | { 58 | e.printStackTrace(); 59 | } 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/XimixNode.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.node; 17 | 18 | import java.util.concurrent.TimeUnit; 19 | 20 | /** 21 | * The basic Ximix node interface. 22 | */ 23 | public interface XimixNode 24 | { 25 | /** 26 | * Start the node. 27 | */ 28 | void start(); 29 | 30 | /** 31 | * Shutdown the node, waiting no longer than timeout units. 32 | * 33 | * @param timeout the amount of units of time to wait. 34 | * @param unit the magnitude of a time unit. 35 | * @return true if shutdown successfully, false otherwise. 36 | * @throws InterruptedException if interrupted while waiting. 37 | */ 38 | boolean shutdown(int timeout, TimeUnit unit) 39 | throws InterruptedException; 40 | } 41 | 42 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/core/RemoteServicesListener.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.node.core; 2 | 3 | import org.cryptoworkshop.ximix.common.asn1.message.NodeInfo; 4 | 5 | public interface RemoteServicesListener 6 | { 7 | void nodeUpdate(NodeInfo nodeInfo); 8 | } 9 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/core/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Core node utility classes and objects. 18 | */ 19 | package org.cryptoworkshop.ximix.node.core; 20 | 21 | 22 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/crypto/key/KeyManagerListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.node.crypto.key; 17 | 18 | /** 19 | * Basic interface describing a listener for a KeyManager 20 | */ 21 | public interface KeyManagerListener 22 | { 23 | /** 24 | * Signal a key has been added. 25 | * 26 | * @param keyManager the key manager causing this event. 27 | * @param keyID the ID of the key that was added. 28 | */ 29 | void keyAdded(KeyManager keyManager, String keyID); 30 | } 31 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/crypto/key/KeyPairGenerator.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.node.crypto.key; 2 | 3 | /** 4 | * Marker class for key pair generators. 5 | */ 6 | public class KeyPairGenerator 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/crypto/key/message/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Internal Ximix messages related to key generation. 18 | */ 19 | package org.cryptoworkshop.ximix.node.crypto.key.message; 20 | 21 | 22 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/crypto/key/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Classes to support key generation. 18 | */ 19 | package org.cryptoworkshop.ximix.node.crypto.key; 20 | 21 | 22 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/crypto/key/util/PrivateKeyInfoFactory.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.node.crypto.key.util; 2 | 3 | import java.io.IOException; 4 | import java.math.BigInteger; 5 | 6 | import it.unisa.dia.gas.crypto.jpbc.signature.bls01.params.BLS01Parameters; 7 | import org.bouncycastle.asn1.ASN1Encodable; 8 | import org.bouncycastle.asn1.ASN1Integer; 9 | import org.bouncycastle.asn1.DEROctetString; 10 | import org.bouncycastle.asn1.DERSequence; 11 | import org.bouncycastle.asn1.DERUTF8String; 12 | import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; 13 | import org.bouncycastle.asn1.x509.AlgorithmIdentifier; 14 | import org.cryptoworkshop.ximix.common.asn1.XimixObjectIdentifiers; 15 | 16 | /** 17 | * Factory to create PrivateKeyInfo objects from private keys. 18 | */ 19 | public class PrivateKeyInfoFactory 20 | { 21 | /** 22 | * Return a PrivateKeyInfo object containing an encoding of BLS private key. 23 | * 24 | * @param value the private value associated with the private key. 25 | * @param parameters the parameters associated with the private key. 26 | * @return a PrivateKeyInfo object containing the value and parameters. 27 | * @throws IOException if the private key cannot be encoded. 28 | */ 29 | public static PrivateKeyInfo createPrivateKeyInfo(BigInteger value, BLS01Parameters parameters) 30 | throws IOException 31 | { 32 | return new PrivateKeyInfo(new AlgorithmIdentifier(XimixObjectIdentifiers.ximixAlgorithmsExperimental, new DERSequence( 33 | new ASN1Encodable[] 34 | { 35 | new DERUTF8String(parameters.getCurveParameters().toString()), 36 | new DEROctetString(parameters.getG().toBytes()) 37 | })), new ASN1Integer(value)); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/crypto/key/util/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Utility classes to support private and public key encoding. 18 | */ 19 | package org.cryptoworkshop.ximix.node.crypto.key.util; 20 | 21 | 22 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/crypto/operator/BLSPrivateKeyOperator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.node.crypto.operator; 17 | 18 | import it.unisa.dia.gas.crypto.jpbc.signature.bls01.params.BLS01Parameters; 19 | import org.cryptoworkshop.ximix.node.service.PrivateKeyOperator; 20 | 21 | /** 22 | * Base interface for a BLS private key operator. 23 | */ 24 | public interface BLSPrivateKeyOperator 25 | extends PrivateKeyOperator 26 | { 27 | BLS01Parameters getDomainParameters(); 28 | 29 | T transform(T value); 30 | } 31 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/crypto/operator/ECPrivateKeyOperator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.node.crypto.operator; 17 | 18 | import org.bouncycastle.crypto.params.ECDomainParameters; 19 | import org.cryptoworkshop.ximix.node.service.PrivateKeyOperator; 20 | 21 | /** 22 | * Base interface for an Elliptic Curve operator. 23 | */ 24 | public interface ECPrivateKeyOperator 25 | extends PrivateKeyOperator 26 | { 27 | ECDomainParameters getDomainParameters(); 28 | 29 | T transform(T value); 30 | } 31 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/crypto/operator/bc/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Encryption/Decryption/Signing operators implemented using the Bouncy Castle APIs. 18 | */ 19 | package org.cryptoworkshop.ximix.node.crypto.operator.bc; 20 | 21 | 22 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/crypto/operator/jpbc/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Signing operators implemented using the JPBC API. 18 | */ 19 | package org.cryptoworkshop.ximix.node.crypto.operator.jpbc; 20 | 21 | 22 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/crypto/operator/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Core interfaces used to provide public and private key operations to a Ximix node. 18 | */ 19 | package org.cryptoworkshop.ximix.node.crypto.operator; 20 | 21 | 22 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/crypto/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Classes supporting cryptography related Ximix services.. 18 | */ 19 | package org.cryptoworkshop.ximix.node.crypto; 20 | 21 | 22 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/crypto/service/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Classes encapsulating the various Ximiix cryptography related services in Ximix nodes. 18 | These are the classes that get added to a node's XML configuration file. 19 | */ 20 | package org.cryptoworkshop.ximix.node.crypto.service; 21 | 22 | 23 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/crypto/signature/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Classes to support signature generation. 18 | */ 19 | package org.cryptoworkshop.ximix.node.crypto.signature; 20 | 21 | 22 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/crypto/util/BigIntegerShare.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.node.crypto.util; 17 | 18 | import java.math.BigInteger; 19 | 20 | /** 21 | * Share object to provide support for constructing shares made up of BigInteger objects. 22 | */ 23 | public class BigIntegerShare 24 | extends Share 25 | { 26 | /** 27 | * Base constructor. 28 | * 29 | * @param sequenceNo the share's sequence number in the sharing process, 30 | * @param value the share's value. 31 | */ 32 | public BigIntegerShare(int sequenceNo, BigInteger value) 33 | { 34 | super(sequenceNo, value); 35 | } 36 | 37 | @Override 38 | public Share add(Share other) 39 | { 40 | return new BigIntegerShare(getSequenceNo(), getValue().add(other.getValue())); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/crypto/util/ECPointShare.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.node.crypto.util; 17 | 18 | import org.bouncycastle.math.ec.ECPoint; 19 | 20 | /** 21 | * Share object to provide support for constructing shares made up of ECPoint objects. 22 | */ 23 | public class ECPointShare 24 | extends Share 25 | { 26 | /** 27 | * Base constructor. 28 | * 29 | * @param sequenceNo the share's sequence number in the sharing process, 30 | * @param value the share's value. 31 | */ 32 | public ECPointShare(int sequenceNo, ECPoint value) 33 | { 34 | super(sequenceNo, value); 35 | } 36 | 37 | @Override 38 | public Share add(Share other) 39 | { 40 | return new ECPointShare(getSequenceNo(), getValue().add(other.getValue())); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/crypto/util/ElementShare.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.node.crypto.util; 17 | 18 | import it.unisa.dia.gas.jpbc.Element; 19 | 20 | /** 21 | * Share object to provide support for constructing shares made up of JPBC Element objects. 22 | */ 23 | public class ElementShare 24 | extends Share 25 | { 26 | /** 27 | * Base constructor. 28 | * 29 | * @param sequenceNo the share's sequence number in the sharing process, 30 | * @param value the share's value. 31 | */ 32 | public ElementShare(int sequenceNo, Element value) 33 | { 34 | super(sequenceNo, value); 35 | } 36 | 37 | @Override 38 | public Share add(Share other) 39 | { // just in case, Elements can be mutable 40 | return new ElementShare(getSequenceNo(), getValue().duplicate().mul(other.getValue())); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/crypto/util/Share.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.node.crypto.util; 17 | 18 | /** 19 | * Base class for a share. 20 | * 21 | * @param the value type the share is associated with. 22 | */ 23 | public abstract class Share 24 | { 25 | private final int sequenceNo; 26 | private final T value; 27 | 28 | /** 29 | * Base constructor. 30 | * 31 | * @param sequenceNo the share's sequence number in the sharing process, 32 | * @param value the share's value. 33 | */ 34 | protected Share(int sequenceNo, T value) 35 | { 36 | this.sequenceNo = sequenceNo; 37 | this.value = value; 38 | } 39 | 40 | public int getSequenceNo() 41 | { 42 | return sequenceNo; 43 | } 44 | 45 | public T getValue() 46 | { 47 | return value; 48 | } 49 | 50 | public abstract Share add(Share value); 51 | } 52 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/crypto/util/ShareMapListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.node.crypto.util; 17 | 18 | /** 19 | * Listener interface for events in a share map. 20 | * 21 | * @param the type of the key used to index the map. 22 | * @param the value type associated with the shares in the map. 23 | */ 24 | public interface ShareMapListener 25 | { 26 | /** 27 | * Notify that a share is fully built. 28 | * 29 | * @param shareMap the map containing the share. 30 | * @param id the share's key in the map. 31 | */ 32 | public void shareCompleted(ShareMap shareMap, K id); 33 | } 34 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/crypto/util/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Utility classes to support threshold storage and manipulation of shares used in decryption and signing operations.. 18 | */ 19 | package org.cryptoworkshop.ximix.node.crypto.util; 20 | 21 | 22 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/mixnet/board/BulletinBoardBackupListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.node.mixnet.board; 17 | 18 | /** 19 | * Listener for objects that back up board data. 20 | */ 21 | public interface BulletinBoardBackupListener 22 | { 23 | /** 24 | * Signal a board has been cleared. 25 | * 26 | * @param bulletinBoard the board that was cleared. 27 | */ 28 | void cleared(BulletinBoard bulletinBoard); 29 | 30 | /** 31 | * Signal a board has had a message posted to it. 32 | * 33 | * @param bulletinBoard the board that received the messages. 34 | * @param index the index the message was posted at. 35 | * @param message the data representing the message posted. 36 | */ 37 | void messagePosted(BulletinBoard bulletinBoard, int index, byte[] message); 38 | 39 | /** 40 | * Signal a board has had a batch of messages posted to it. 41 | * 42 | * @param bulletinBoard the board that received the messages. 43 | * @param startIndex the index the first message in the batch was posted at. 44 | * @param messages the data representing the message batch posted. 45 | */ 46 | void messagesPosted(BulletinBoard bulletinBoard, int startIndex, byte[][] messages); 47 | 48 | /** 49 | * Shutdown the listener freeing the resources. 50 | */ 51 | void shutdown(); 52 | } 53 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/mixnet/board/BulletinBoardChangeListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.node.mixnet.board; 17 | 18 | /** 19 | * Listener for objects that monitor board changes, 20 | */ 21 | public interface BulletinBoardChangeListener 22 | { 23 | /** 24 | * Signal the addition of messages. 25 | * 26 | * @param bulletinBoard the board that had the messages added. 27 | * @param count the number of messages added. 28 | */ 29 | void messagesAdded(BulletinBoard bulletinBoard, int count); 30 | 31 | /** 32 | * Signal the removal of messages. 33 | * 34 | * @param bulletinBoard the board that had the messages removed. 35 | * @param count the number of messages removed. 36 | */ 37 | void messagesRemoved(BulletinBoardImpl bulletinBoard, int count); 38 | } 39 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/mixnet/board/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Core bulletin board objects and listeners. 18 | */ 19 | package org.cryptoworkshop.ximix.node.mixnet.board; 20 | 21 | 22 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/mixnet/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Classes supporting Ximix MixNet related services. 18 | */ 19 | package org.cryptoworkshop.ximix.node.mixnet; 20 | 21 | 22 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/mixnet/service/BoardIndex.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.node.mixnet.service; 17 | 18 | import org.bouncycastle.asn1.ASN1Encodable; 19 | import org.cryptoworkshop.ximix.common.asn1.message.BoardCapabilities; 20 | import org.cryptoworkshop.ximix.common.asn1.message.CapabilityMessage; 21 | 22 | /** 23 | * Simple class for providing lookup of board presence based on caoability messages. 24 | */ 25 | public class BoardIndex 26 | { 27 | private final CapabilityMessage capabilityMessage; 28 | 29 | public BoardIndex(CapabilityMessage capabilityMessage) 30 | { 31 | this.capabilityMessage = capabilityMessage; 32 | } 33 | 34 | public boolean hasBoard(String boardName) 35 | { 36 | 37 | for (ASN1Encodable enc : capabilityMessage.getDetails()) 38 | { 39 | BoardCapabilities details = BoardCapabilities.getInstance(enc); 40 | 41 | if (details.getBoardName().equals(boardName)) 42 | { 43 | return true; 44 | } 45 | } 46 | 47 | return false; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/mixnet/service/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Ximix node board related services. 18 | */ 19 | package org.cryptoworkshop.ximix.node.mixnet.service; 20 | 21 | 22 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/mixnet/shuffle/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Ximix message shuffling tasks and support objects. 18 | */ 19 | package org.cryptoworkshop.ximix.node.mixnet.shuffle; 20 | 21 | 22 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/mixnet/transform/NullTransform.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.node.mixnet.transform; 17 | 18 | /** 19 | * A "do nothing" transform. 20 | */ 21 | public class NullTransform 22 | implements Transform 23 | { 24 | public static final String NAME = "NullTransform"; 25 | 26 | public String getName() 27 | { 28 | return NAME; 29 | } 30 | 31 | public void init(Object o) 32 | { 33 | // ignore 34 | } 35 | 36 | public byte[] transform(byte[] message) 37 | { 38 | return message; 39 | } 40 | 41 | @Override 42 | public byte[] getLastDetail() 43 | { 44 | return new byte[0]; 45 | } 46 | 47 | @SuppressWarnings({"CloneDoesntCallSuperClone", "CloneDoesntDeclareCloneNotSupportedException"}) 48 | @Override 49 | public Transform clone() 50 | { 51 | return new NullTransform(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/mixnet/transform/Transform.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.node.mixnet.transform; 17 | 18 | /** 19 | * Base interface a transform should conform to. 20 | */ 21 | public interface Transform 22 | extends Cloneable 23 | { 24 | /** 25 | * Return the name of the transform. 26 | * 27 | * @return the transform's name. 28 | */ 29 | String getName(); 30 | 31 | /** 32 | * Initialise the transform. 33 | * 34 | * @param o an appropriate initialisation object. 35 | */ 36 | void init(Object o); 37 | 38 | /** 39 | * Transform a message. 40 | * 41 | * @param message the data representing the message to be transformed. 42 | * @return the transformed message as a byte array. 43 | */ 44 | byte[] transform(byte[] message); 45 | 46 | /** 47 | * Return any data generated during the last transform that could be used to verify the transform later. 48 | * 49 | * @return data related to the last transform carried out as a byte array. 50 | */ 51 | byte[] getLastDetail(); 52 | 53 | /** 54 | * Return a deep copy of the transform object suitable for use by an individual thread. 55 | * 56 | * @return transform deep copy. 57 | */ 58 | @SuppressWarnings({"CloneDoesntDeclareCloneNotSupportedException"}) 59 | public Transform clone(); 60 | } 61 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/mixnet/transform/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Supported transformations that can be applied during a message shuffle. 18 | */ 19 | package org.cryptoworkshop.ximix.node.mixnet.transform; 20 | 21 | 22 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/mixnet/util/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | General utility classes and interfaces connected with bulletin boards and shuffling methods. 18 | */ 19 | package org.cryptoworkshop.ximix.node.mixnet.util; 20 | 21 | 22 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/monitor/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Node monitoring service and support objects. 18 | */ 19 | package org.cryptoworkshop.ximix.node.monitor; 20 | 21 | 22 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Main XimixNode interface and Main controller. 18 | */ 19 | package org.cryptoworkshop.ximix.node; 20 | 21 | 22 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/service/Decoupler.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.node.service; 17 | 18 | /** 19 | * An enum representing the available single threaded decouplers in a node. 20 | */ 21 | public enum Decoupler 22 | { 23 | LISTENER, 24 | SHARING, 25 | SERVICES, 26 | MONITOR, 27 | BOARD_REGISTRY, 28 | BOARD_LISTENER 29 | } 30 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/service/PrivateKeyOperator.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.node.service; 17 | 18 | /** 19 | * Base interface for a private key operator. 20 | */ 21 | public interface PrivateKeyOperator 22 | { 23 | /** 24 | * Return this operator's private secret position in the sharing sequence calculation. 25 | * 26 | * @return the sequence position of the private secret. 27 | */ 28 | int getSequenceNo(); 29 | } 30 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/service/ServiceEvent.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.node.service; 17 | 18 | /** 19 | * Carrier class to link service event types with parameters. 20 | */ 21 | public class ServiceEvent 22 | { 23 | public static enum Type 24 | { 25 | PUBLISH_STATISTICS 26 | } 27 | 28 | private final Type type; 29 | private final Object parameter; 30 | 31 | /** 32 | * Base constructor. 33 | * 34 | * @param type the type of the service event. 35 | * @param parameter the parameters required to handle the event. 36 | */ 37 | public ServiceEvent(Type type, Object parameter) 38 | { 39 | this.type = type; 40 | this.parameter = parameter; 41 | } 42 | 43 | public Type getType() 44 | { 45 | return type; 46 | } 47 | 48 | public Object getParameter() 49 | { 50 | return parameter; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/service/ServiceStatisticsListener.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.node.service; 17 | 18 | import java.util.Map; 19 | 20 | /** 21 | * General interface that a listener of service statistics conforms to. 22 | */ 23 | public interface ServiceStatisticsListener 24 | { 25 | /** 26 | * Notify of an update in some service related statistics. 27 | * 28 | * @param nodeService the service causing the update. 29 | * @param details the details of the statistics updated. 30 | */ 31 | void statisticsUpdate(NodeService nodeService, Map details); 32 | } 33 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/service/ThresholdKeyPairGenerator.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.node.service; 2 | 3 | /** 4 | * Marker interface for threshold key pair generators. 5 | */ 6 | public interface ThresholdKeyPairGenerator 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /node/src/main/java/org/cryptoworkshop/ximix/node/service/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | /** 17 | Main XimixNode interface and Main controller. 18 | */ 19 | package org.cryptoworkshop.ximix.node.service; 20 | 21 | 22 | -------------------------------------------------------------------------------- /node/src/main/resources/org/cryptoworkshop/ximix/node/crypto/key/d62003-159-158.param: -------------------------------------------------------------------------------- 1 | type d 2 | q 625852803282871856053922297323874661378036491717 3 | n 625852803282871856053923088432465995634661283063 4 | h 3 5 | r 208617601094290618684641029477488665211553761021 6 | a 239110483679451415355408117072309802450583283527 7 | b 576642191308215514272886942930789642552413183496 8 | k 6 9 | nk 60094290356408407130984161127310078516360031868417968262992864809623507269833854678414046779817844853757026858774966331434198257512457993293271849043664655146443229029069463392046837830267994222789160047337432075266619082657640364986415435746294498140589844832666082434658532589211525696 10 | hk 1380801711862212484403205699005242141541629761433899149236405232528956996854655261075303661691995273080620762287276051361446528504633283152278831183711301329765591450680250000592437612973269056 11 | coeff0 167735272244340890248413461294733530966113631081 12 | coeff1 188332945847808679523389681913294069067222011819 13 | coeff2 276225171725363903470966428623308273877799612855 14 | nqr 489829780399089087337095496766742416848202714236 15 | -------------------------------------------------------------------------------- /node/src/test/java/org/cryptoworkshop/ximix/node/crypto/test/TestNotifier.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.node.crypto.test; 2 | 3 | import org.cryptoworkshop.ximix.common.util.EventNotifier; 4 | 5 | /** 6 | * 7 | */ 8 | public class TestNotifier 9 | implements EventNotifier 10 | { 11 | 12 | 13 | @Override 14 | public void notify(Level level, Throwable throwable) 15 | { 16 | System.err.println(level); 17 | throwable.printStackTrace(System.err); 18 | } 19 | 20 | @Override 21 | public void notify(Level level, Object detail) 22 | { 23 | System.err.println(level + ": " + detail); 24 | } 25 | 26 | @Override 27 | public void notify(Level level, Object detail, Throwable throwable) 28 | { 29 | System.err.println(level + ": " + detail); 30 | throwable.printStackTrace(System.err); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /node/src/test/resources/conf/nodeCaStore.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/node/src/test/resources/conf/nodeCaStore.p12 -------------------------------------------------------------------------------- /node/src/test/resources/conf/trustCa.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIB/zCCAaQCAQEwCgYIKoZIzj0EAwIwgYoxCzAJBgNVBAYTAkFVMSAwHgYDVQQK 3 | DBdDcnlwdG8gV29ya3Nob3AgUHR5IEx0ZDEbMBkGA1UECwwSWGltaXggTm9kZSBU 4 | ZXN0IENBMRIwEAYDVQQHDAlNZWxib3VybmUxETAPBgNVBAgMCFZpY3RvcmlhMRUw 5 | EwYDVQQDDAxUcnVzdCBBbmNob3IwHhcNMTQwMjE1MDA0MDU5WhcNMTYwMjE1MDA0 6 | MTQ5WjCBijELMAkGA1UEBhMCQVUxIDAeBgNVBAoMF0NyeXB0byBXb3Jrc2hvcCBQ 7 | dHkgTHRkMRswGQYDVQQLDBJYaW1peCBOb2RlIFRlc3QgQ0ExEjAQBgNVBAcMCU1l 8 | bGJvdXJuZTERMA8GA1UECAwIVmljdG9yaWExFTATBgNVBAMMDFRydXN0IEFuY2hv 9 | cjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABL6UHYMIHxn0/iy+psDMrZ6i5taB 10 | iWdCBg4Sf2seMgcIulj7rfha+gccITdfhFvekd4TuzKnN9Kdx+r/ANN18ccwCgYI 11 | KoZIzj0EAwIDSQAwRgIhALY/gND++XVgMcJqm9QkcoKgyXrIcK+I3vYn2oU+wVdq 12 | AiEA8V2OyZcqC1RXWsSziD7ZCHAKO2XU9uUyfdppPIfN+eA= 13 | -----END CERTIFICATE----- 14 | -------------------------------------------------------------------------------- /scripts/mkconsoleinstaller.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Generate a mixnet console installer jar for one or more nodes using a gradle task 4 | # 5 | 6 | set -e # Exit on any error 7 | base=`/usr/bin/dirname $0` 8 | cwd=`pwd` 9 | 10 | mixnet=$cwd/$1 11 | 12 | conf=$cwd/$2 13 | 14 | cd $base/../ 15 | 16 | 17 | if [ -n "$1" ] && [ -n "$2" ] 18 | then 19 | gradle clean jar make_console_installer "-Dmixnet=$mixnet" "-Dconfig=$conf" 20 | else 21 | echo "Usage: mkconsoleinstaller /path/to/mixnet.xml /path/to/console.xml" 22 | 23 | fi 24 | -------------------------------------------------------------------------------- /scripts/mkinstaller.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # Generate a mixnet installer jar for one or more nodes using a gradle task 4 | # 5 | 6 | set -e # Exit on any error 7 | base=`/usr/bin/dirname $0` 8 | cwd=`pwd` 9 | 10 | mixnet=$cwd/$1 11 | 12 | while shift 13 | do 14 | if [ -n "$1" ] 15 | then 16 | node=`echo $node,$cwd/$1` 17 | fi 18 | done 19 | 20 | cd $base/../ 21 | 22 | 23 | if [ -n "$mixnet" ] 24 | then 25 | gradle clean jar make_node_installer "-Dnetwork=$mixnet$node" 26 | else 27 | echo "Confirm generation of a basic installer with NO inbuilt configuration: [No]" 28 | read conf 29 | 30 | case $conf in 31 | y*|Y*) 32 | gradle clean jar make_node_installer 33 | ;; 34 | esac 35 | fi 36 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include "common" 2 | include "client" 3 | include "node" 4 | include "installer" 5 | include "console" 6 | include "demo" 7 | include "test" 8 | -------------------------------------------------------------------------------- /test/build.gradle.disabled: -------------------------------------------------------------------------------- 1 | dependencies { 2 | compile project(':common') 3 | compile project(':crypto') 4 | compile project(':mixnet') 5 | compile project(':node') 6 | } 7 | 8 | 9 | test { 10 | testLogging.showStandardStreams = true 11 | } 12 | -------------------------------------------------------------------------------- /test/src/main/java/org/cryptoworkshop/ximix/test/node/ResourceAnchor.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.test.node; 2 | 3 | import java.io.File; 4 | import java.io.FileOutputStream; 5 | import java.io.IOException; 6 | import java.io.InputStream; 7 | 8 | import org.cryptoworkshop.ximix.common.config.Config; 9 | import org.cryptoworkshop.ximix.common.config.ConfigException; 10 | 11 | /** 12 | * 13 | */ 14 | public class ResourceAnchor 15 | { 16 | public static Config load(String path) 17 | throws ConfigException 18 | { 19 | return new Config(ResourceAnchor.class.getResourceAsStream(path)); 20 | } 21 | 22 | public static Config load(File homeDirectory, String path) 23 | throws ConfigException, IOException 24 | { 25 | createFile(ResourceAnchor.class.getResourceAsStream("/conf/" + path.substring(path.lastIndexOf('/') + 1, path.lastIndexOf('.')) + "CaStore.p12"), homeDirectory, "nodeCaStore.p12"); 26 | createFile(ResourceAnchor.class.getResourceAsStream("/conf/trustCa.pem"), homeDirectory, "trustCa.pem"); 27 | 28 | InputStream cIn = ResourceAnchor.class.getResourceAsStream(path); 29 | 30 | File confFile = createFile(cIn, homeDirectory, path.substring(path.lastIndexOf('/') + 1)); 31 | 32 | return new Config(confFile); 33 | } 34 | 35 | private static File createFile(InputStream in, File homeDirectory, String name) 36 | throws IOException 37 | { 38 | File confFile = new File(homeDirectory, name); 39 | FileOutputStream fOut = new FileOutputStream(confFile); 40 | 41 | int ch; 42 | while ((ch = in.read()) >= 0) 43 | { 44 | fOut.write(ch); 45 | } 46 | 47 | fOut.close(); 48 | return confFile; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /test/src/main/java/org/cryptoworkshop/ximix/test/node/SquelchingThrowableHandler.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.test.node; 2 | 3 | import java.util.ArrayList; 4 | import java.util.List; 5 | 6 | import org.cryptoworkshop.ximix.common.util.EventNotifier; 7 | 8 | /** 9 | * Test throwable handler. 10 | */ 11 | public class SquelchingThrowableHandler implements EventNotifier 12 | { 13 | private List squelchTypes = new ArrayList(); 14 | private boolean printOnly = false; 15 | 16 | @Override 17 | public void notify(Level level, Throwable throwable) 18 | { 19 | notify(level,null, throwable); 20 | } 21 | 22 | @Override 23 | public void notify(Level level, Object detail) 24 | { 25 | if (level != Level.DEBUG) 26 | { 27 | System.err.println(level+" "+detail); 28 | } 29 | } 30 | 31 | @Override 32 | public void notify(Level level, Object detail, Throwable throwable) 33 | { 34 | if (squelchTypes.contains(throwable.getClass())) 35 | { 36 | System.out.println("SQUELCH: "+throwable.getMessage()); 37 | return; 38 | } 39 | if (printOnly) 40 | { 41 | System.err.println(level+" "+detail); 42 | throwable.printStackTrace(System.err); 43 | } 44 | else 45 | { 46 | throw new RuntimeException(throwable); 47 | } 48 | } 49 | 50 | public SquelchingThrowableHandler squelchType(Class type) 51 | { 52 | squelchTypes.add(type); 53 | return this; 54 | } 55 | 56 | public List getSquelchTypes() 57 | { 58 | return squelchTypes; 59 | } 60 | 61 | public void setSquelchTypes(List squelchTypes) 62 | { 63 | this.squelchTypes = squelchTypes; 64 | } 65 | 66 | public boolean isPrintOnly() 67 | { 68 | return printOnly; 69 | } 70 | 71 | public void setPrintOnly(boolean printOnly) 72 | { 73 | this.printOnly = printOnly; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /test/src/main/java/org/cryptoworkshop/ximix/test/node/TestNotifier.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.test.node; 2 | 3 | import org.cryptoworkshop.ximix.common.util.EventNotifier; 4 | 5 | /** 6 | * 7 | */ 8 | public class TestNotifier implements EventNotifier 9 | { 10 | 11 | 12 | @Override 13 | public void notify(Level level, Throwable throwable) 14 | { 15 | System.err.println(level); 16 | throwable.printStackTrace(System.err); 17 | } 18 | 19 | @Override 20 | public void notify(Level level, Object detail) 21 | { 22 | if (level != Level.DEBUG) 23 | { 24 | System.err.println(level + ": " + detail); 25 | } 26 | } 27 | 28 | @Override 29 | public void notify(Level level, Object detail, Throwable throwable) 30 | { 31 | System.err.println(level + ": " + detail); 32 | throwable.printStackTrace(System.err); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /test/src/main/java/org/cryptoworkshop/ximix/test/node/TestXimixNodeFactory.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.test.node; 2 | 3 | import java.io.File; 4 | import java.io.FileNotFoundException; 5 | 6 | import org.cryptoworkshop.ximix.common.config.Config; 7 | import org.cryptoworkshop.ximix.common.config.ConfigException; 8 | import org.cryptoworkshop.ximix.node.core.XimixNodeBuilder; 9 | 10 | /** 11 | * 12 | */ 13 | public class TestXimixNodeFactory extends XimixNodeBuilder 14 | { 15 | public TestXimixNodeFactory(Config peersConfig) 16 | { 17 | super(peersConfig); 18 | } 19 | 20 | public TestXimixNodeFactory(File file) 21 | throws ConfigException, FileNotFoundException 22 | { 23 | super(file); 24 | } 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /test/src/main/java/org/cryptoworkshop/ximix/test/node/ValueObject.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.test.node; 2 | 3 | /** 4 | * Utility class to allow setting of values from within inner classes and situations where 5 | * the actual instance may be declared final. 6 | */ 7 | public class ValueObject 8 | { 9 | private T value; 10 | 11 | public ValueObject() 12 | { 13 | value = null; 14 | } 15 | 16 | public ValueObject(T initValue) 17 | { 18 | this.value = initValue; 19 | } 20 | 21 | 22 | public T get() 23 | { 24 | return value; 25 | } 26 | 27 | public void set(T newValue) 28 | { 29 | this.value = newValue; 30 | } 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /test/src/test/java/org/cryptoworkshop/ximix/test/tests/NodeStartStopTest.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2013 Crypto Workshop Pty Ltd 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package org.cryptoworkshop.ximix.test.tests; 17 | 18 | import java.util.concurrent.TimeUnit; 19 | 20 | import junit.framework.TestCase; 21 | import org.cryptoworkshop.ximix.node.XimixNode; 22 | import org.cryptoworkshop.ximix.test.node.NodeTestUtil; 23 | 24 | /** 25 | * Tests for basic node stopping and starting. 26 | */ 27 | public class NodeStartStopTest 28 | { 29 | 30 | 31 | /** 32 | * Tests that when stop is called the FutureComplete handler is called when the node shuts down completely. 33 | * 34 | * @throws Exception 35 | */ 36 | @org.junit.Test 37 | public void testNodeStopWithFutureHandler() 38 | throws Exception 39 | { 40 | 41 | final XimixNode node = NodeTestUtil.getXimixNode("/conf/mixnet.xml", "/conf/node1.xml"); 42 | 43 | 44 | Thread th = new Thread(new Runnable() 45 | { 46 | @Override 47 | public void run() 48 | { 49 | node.start(); 50 | } 51 | }); 52 | th.setPriority(Thread.MIN_PRIORITY); 53 | th.start(); 54 | 55 | Thread.sleep(1000); 56 | TestCase.assertTrue(node.shutdown(15, TimeUnit.SECONDS)); 57 | } 58 | 59 | 60 | } 61 | -------------------------------------------------------------------------------- /test/src/test/java/org/cryptoworkshop/ximix/test/tests/RegistrarTest.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.test.tests; 2 | 3 | import junit.framework.TestCase; 4 | import org.cryptoworkshop.ximix.client.KeyGenerationOptions; 5 | import org.cryptoworkshop.ximix.client.KeyGenerationService; 6 | import org.cryptoworkshop.ximix.client.connection.ServiceConnectionException; 7 | import org.cryptoworkshop.ximix.client.connection.XimixRegistrar; 8 | import org.cryptoworkshop.ximix.client.connection.XimixRegistrarFactory; 9 | import org.cryptoworkshop.ximix.common.crypto.Algorithm; 10 | import org.cryptoworkshop.ximix.test.node.ResourceAnchor; 11 | import org.cryptoworkshop.ximix.test.node.TestNotifier; 12 | import org.junit.Test; 13 | 14 | /** 15 | * 16 | */ 17 | public class RegistrarTest 18 | { 19 | 20 | /** 21 | * Test the correct exception is thrown when the admin service cannot find a node. 22 | * 23 | * @throws Exception 24 | */ 25 | @Test 26 | public void testRegistrarWithNoStart() 27 | throws Exception 28 | { 29 | 30 | XimixRegistrar adminRegistrar = XimixRegistrarFactory.createAdminServiceRegistrar(ResourceAnchor.load("/conf/mixnet.xml"), new TestNotifier()); 31 | KeyGenerationService keyGenerationService = adminRegistrar.connect(KeyGenerationService.class); 32 | try 33 | { 34 | 35 | KeyGenerationOptions keyGenOptions = new KeyGenerationOptions.Builder(Algorithm.EC_ELGAMAL, "secp256r1") 36 | .withThreshold(2) 37 | .withNodes("A", "B") 38 | .build(); 39 | byte[] encPubKey = keyGenerationService.generatePublicKey("ECKEY", keyGenOptions); 40 | 41 | TestCase.fail(); 42 | } 43 | catch (ServiceConnectionException rse) 44 | { 45 | TestCase.assertTrue(true); 46 | } 47 | 48 | keyGenerationService.shutdown(); 49 | 50 | 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /test/src/test/java/org/cryptoworkshop/ximix/test/tests/TestUtil.java: -------------------------------------------------------------------------------- 1 | package org.cryptoworkshop.ximix.test.tests; 2 | 3 | import java.util.concurrent.atomic.AtomicReference; 4 | 5 | import org.junit.Assert; 6 | 7 | public class TestUtil 8 | { 9 | 10 | static void checkThread(AtomicReference threadHolder) 11 | { 12 | Object thread; 13 | 14 | if ((thread = threadHolder.getAndSet(Thread.currentThread())) != null) 15 | { 16 | Assert.assertEquals(thread, Thread.currentThread()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /test/src/test/resources/conf/mixnet.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | localhost 5 | 12000 6 | A 7 | 8 | 9 | localhost 10 | 12001 11 | B 12 | 13 | 14 | localhost 15 | 12002 16 | C 17 | 18 | 19 | localhost 20 | 12003 21 | D 22 | 23 | 24 | localhost 25 | 12004 26 | E 27 | 28 | 29 | -------------------------------------------------------------------------------- /test/src/test/resources/conf/node1CaStore.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/test/src/test/resources/conf/node1CaStore.p12 -------------------------------------------------------------------------------- /test/src/test/resources/conf/node2CaStore.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/test/src/test/resources/conf/node2CaStore.p12 -------------------------------------------------------------------------------- /test/src/test/resources/conf/node3CaStore.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/test/src/test/resources/conf/node3CaStore.p12 -------------------------------------------------------------------------------- /test/src/test/resources/conf/node4CaStore.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/test/src/test/resources/conf/node4CaStore.p12 -------------------------------------------------------------------------------- /test/src/test/resources/conf/node5CaStore.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/test/src/test/resources/conf/node5CaStore.p12 -------------------------------------------------------------------------------- /test/src/test/resources/conf/nodeCaStore.p12: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cwgit/ximix/88e142d8baa567c3699d5eb6d45c9a6bb56b988f/test/src/test/resources/conf/nodeCaStore.p12 -------------------------------------------------------------------------------- /test/src/test/resources/conf/trustCa.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIB/zCCAaQCAQEwCgYIKoZIzj0EAwIwgYoxCzAJBgNVBAYTAkFVMSAwHgYDVQQK 3 | DBdDcnlwdG8gV29ya3Nob3AgUHR5IEx0ZDEbMBkGA1UECwwSWGltaXggTm9kZSBU 4 | ZXN0IENBMRIwEAYDVQQHDAlNZWxib3VybmUxETAPBgNVBAgMCFZpY3RvcmlhMRUw 5 | EwYDVQQDDAxUcnVzdCBBbmNob3IwHhcNMTQwMjE1MDA0MDU5WhcNMTYwMjE1MDA0 6 | MTQ5WjCBijELMAkGA1UEBhMCQVUxIDAeBgNVBAoMF0NyeXB0byBXb3Jrc2hvcCBQ 7 | dHkgTHRkMRswGQYDVQQLDBJYaW1peCBOb2RlIFRlc3QgQ0ExEjAQBgNVBAcMCU1l 8 | bGJvdXJuZTERMA8GA1UECAwIVmljdG9yaWExFTATBgNVBAMMDFRydXN0IEFuY2hv 9 | cjBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABL6UHYMIHxn0/iy+psDMrZ6i5taB 10 | iWdCBg4Sf2seMgcIulj7rfha+gccITdfhFvekd4TuzKnN9Kdx+r/ANN18ccwCgYI 11 | KoZIzj0EAwIDSQAwRgIhALY/gND++XVgMcJqm9QkcoKgyXrIcK+I3vYn2oU+wVdq 12 | AiEA8V2OyZcqC1RXWsSziD7ZCHAKO2XU9uUyfdppPIfN+eA= 13 | -----END CERTIFICATE----- 14 | --------------------------------------------------------------------------------