Skip to content

Commit

Permalink
Create crypto package
Browse files Browse the repository at this point in the history
- Part of #32
- Closes #36
  • Loading branch information
masomel committed Feb 8, 2018
1 parent fda135e commit e0b2ba5
Show file tree
Hide file tree
Showing 34 changed files with 1,806 additions and 826 deletions.
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.DS_Store
coniks_common/src/org/coniks/coniks_common/*.class
coniks_common/src/com/google/protobuf/*.java
coniks_server/src/org/coniks/coniks_server/*.class
coniks_test_client/src/org/coniks/coniks_test_client/*.class
target
bin
logs
7 changes: 6 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ env:
global:
secure: B5ZEHKFRa11V7e9JZwr4vGFSdo1lvnbxijd00mm41qbvwT5YFSMZhEQLRVlDmxhsqcc6guC84Q49LsY3/4rlzspHe8fkByY2sQUM3aXuK13/lJJT8CeDXxYAicWMPBLvybpt3ML1wXcbskQzv5C7oNLgkeMwvpd2zw5pYMV2dHwRhRkfsYgH7hzlVgCOMnPLHfPiDgjuQK6KJUr1qlO4Y9vmFsCiCi94fLHIxu+MsvFy3XRnnlTERTGQCeBD2GGHTH5wjiwTL0GHdKX/ntpODyWZAnbYs8OYsLuCq7QQHJDk4uBVCnMIj1zt6lwxa0iiz+uuvxnL6msSeF/BkIWG/yxRkBjdVtdJL0WBEIDmfzeEugdNFke1I2dsH68Fe+R2syUwIjJ654HSoLZ/xL9Dbnxo8wmix2cO46ictXN3WVNrWwB4KUV5N+aGW/hB0KRqSsO2iUmXqweifJz7qfWm20Y//pgtMtVTnZVTneiSCPucY1QWQmiOgC0jcseV+oIbpFjbYArxGhhPhqJqAWYhJeR/7uX872zMwPqpyHRF3y1XQ+C2xI9IWC2SqjinCsgUnZei1pu7A4Qd34Isd8uCICrLMu8JPe98+Dc+jksGrH/SgOcDI/pffnD2rk/ablNU7JY8yE2t5me9B6SAxOEOyle60i5WiRHcM+pZukBwvwU=

script: mvn test
script:
# TODO check style
- mvn test

notifications:
# Email notifications are disabled to not annoy anybody.
# See http://about.travis-ci.org/docs/user/build-configuration/ to learn more
# about configuring notification recipients and more.
email: false
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ http://coniks.org
CONIKS is a key management system that provides transparency and privacy for end-user public keys. CONIKS protects end-to-end encrypted communications against malicious or compromised communication providers and surveillance by storing users' encryption keys in tamper-evident and publicly auditable key directories on the server side. This allows messaging clients to verify the identity of users automatically, and prevents malicious/compromised servers from hijacking secure communications without getting caught.

##Java Library
This software package serves as a Java library for the CONIKS system and includes reference implementations for the CONIKS server and client. The basic [CONIKS server](https://github.com/coniks-sys/coniks-java/tree/master/coniks_server) and simple [CONIKS test client](https://github.com/coniks-sys/coniks-java/tree/master/coniks_test_client) demonstrate the functionality of the system and the CONIKS protocols, so anyone interested in deploying CONIKS in their secure messaging system can then use this software package as a reference when implementing the service. This package also contains the [common message format definitions](https://github.com/coniks-sys/coniks-java/tree/master/coniks_common) that CONIKS servers and clients use to communicate.
This software package serves as a Java library for the CONIKS system and includes reference implementations for the CONIKS server and client. The basic [CONIKS server](https://github.com/coniks-sys/coniks-java/tree/master/coniks_server) and simple [CONIKS test client](https://github.com/coniks-sys/coniks-java/tree/master/coniks_test_client) demonstrate the functionality of the system and the CONIKS protocols, so anyone interested in deploying CONIKS in their secure messaging system can then use this software package as a reference when implementing the service. This package also contains the [common message format definitions](https://github.com/coniks-sys/coniks-java/tree/master/coniks_common) that CONIKS servers and clients use to communicate.

## Disclaimer
Please keep in mind that this CONIKS reference implementation is under active development. The repository may contain experimental features that aren't fully tested. We recommend using a [tagged release](https://github.com/coniks-sys/coniks-java/releases).
Please keep in mind that this CONIKS Java implementation is under active development. The repository may contain experimental features that aren't fully tested. We recommend using a [tagged release](https://github.com/coniks-sys/coniks-java/releases).

##Documentation
[Read the package's Java API (javadoc)](https://coniks-sys.github.io/coniks-java/)
Expand Down
2 changes: 1 addition & 1 deletion coniks_common/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ The coniks_common build is managed using Maven. (Instructions for building witho
These instructions will install the ``coniks_common`` Maven artifact.

## Disclaimer
Please keep in mind that this CONIKS reference implementation is under active development. The repository may contain experimental features that aren't fully tested. We recommend using a [tagged release](https://github.com/coniks-sys/coniks-java/releases).
Please keep in mind that this CONIKS Java implementation is under active development. The repository may contain experimental features that aren't fully tested. We recommend using a [tagged release](https://github.com/coniks-sys/coniks-java/releases).

##Documentation
[Read the common files' Java API (javadoc)](https://coniks-sys.github.io/coniks-java/org/coniks/coniks_common/package-summary.html)
15 changes: 5 additions & 10 deletions coniks_common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,19 @@
<parent>
<groupId>org.coniks</groupId>
<artifactId>coniks-java</artifactId>
<version>1.2-SNAPSHOT</version>
<version>1.3-SNAPSHOT</version>
</parent>

<groupId>org.coniks.coniks_common</groupId>
<artifactId>coniks_common</artifactId>
<version>1.3-SNAPSHOT</version>
<packaging>jar</packaging>
<version>1.2-SNAPSHOT</version>
<name>coniks_common</name>

<name>CONIKS [Common]</name>
<url>http://coniks.org</url>
<description>Common message spec and encoding library for CONIKS.</description>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
Expand Down
46 changes: 26 additions & 20 deletions coniks_server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,24 @@ The coniks_server build is managed using Maven. (Instructions for building witho
1) Install Apache Maven, if you don't have it. Visit the [Maven downloads page](https://maven.apache.org/download.cgi) for details.

2) Install the library into your Maven repository:

```$ mvn install```

3) If you don't use Maven to manage your own build, you can build a .jar file to use:

```$ mvn package```

These instructions will install the ``coniks_server`` Maven artifact.
The build configuration for coniks_server assembles all dependencies,
and includes them in the generated .jar file, so you can run the server
only using the coniks_server .jar file.

##Using the Server

The CONIKS server has two operating modes: Test Mode and Full Operation.
Running the server in test mode allows you to still test all CONIKS protocols and operations,
but requires less setup as you can simply use the default configuration in the included *config* file.
The CONIKS server has two operating modes: Test Mode and Full Operation.
Running the server in test mode allows you to still test all CONIKS
protocols and operations, but requires less setup as you can simply use
the default configuration in the included *config* file.
**Note:** You must be running the test client in the same operating mode.

### Setup
Expand All @@ -32,21 +38,20 @@ Run the following command, using the default settings if setting up test mode:
```
keytool -genkeypair -alias <alias> -keyalg RSA -validity 365 -keystore <keystore>
```
Follow the prompts and enter suitable information. Make sure to enter legitimate information if running
in full operation mode. Notice that the key pair is set to expire within 365 days here, but you may
change this setting when running this command.
- Full operation mode only: Generate self-signed certificates for SSL/TLS communication,
if you don't already have certs for your server:
Make sure the alias and the keystore used in this step match the values used when generating the
signing key pair in the previous step.
Follow the prompts and enter suitable information. Make sure to enter
legitimate information if running
in full operation mode. Notice that the key pair is set to expire within 365 days here, but you may change this setting when running this command.
- Full operation mode only: Generate self-signed certificates for SSL/TLS
communication, if you don't already have certs for your server:
Make sure the alias and the keystore used in this step match the values used when generating the signing key pair in the previous step.
```
keytool -export -alias <alias> -keystore <keystore> -rfc -file <alias>.cer
keytool -import -alias <alias> -file <alias>.cer -keystore <truststore>
```
- Set all of the configurations in the config file:
Defaults are already set, except for the absolute path to the keystore generated in the
previous step along with its password. You'll have to set these using the format
described below.
Defaults are already set, except for the absolute path to the
keystore generated in the previous step along with its password.
You'll have to set these using the format described below.
You may write your own config file, but it must follow the following format:
```
<port number> (must be the same in the CONIKS client config)
Expand All @@ -58,19 +63,20 @@ You may write your own config file, but it must follow the following format:
<path to truststore>/<truststore> (not used in test mode)
<truststore password> (not used for test mode)
```
Especially if you're running in full operating mode, make sure the config file is only readable
by the users allowed to run the CONIKS server to protect your keystore password.
Especially if you're running in full operating mode, make sure the
config file is only readable by the users allowed to run the CONIKS
server to protect your keystore password.
- Set all of the configs in the run script *coniks_server.sh*:
Defaults are already set, but you may change the following variables:
```CLASS_DEST``` if you used a different classpath when building the server.
```CLASS_DEST``` if you've changed configurations such as the artifactID or version in the server's pom.xml file before building.
```CONIKS_SERVERCONFIG``` if you're using a different config file
```CONIKS_SERVERLOGS``` to store the server logs somewhere other than a *logs* directory

###Running
We provide a run script for the CONIKS server *coniks_server.sh*, which allows you to run the server in
full operation mode and test mode.
We provide a run script for the CONIKS server *coniks_server.sh*,
which allows you to run the server in full operation mode and test mode.

The run script supports four commands:
The run script supports four commands:
- ```start```: start the server in full operation mode (runs in background).
- ```test```: start the server in test mode (runs in foreground).
- ```stop```: stop the server.
Expand All @@ -80,7 +86,7 @@ For example, to start the server in full operation mode, use
Analogously to test and stop the server, and remove the logs.

## Disclaimer
Please keep in mind that this CONIKS reference implementation is under active development. The repository may contain experimental features that aren't fully tested. We recommend using a [tagged release](https://github.com/coniks-sys/coniks-java/releases).
Please keep in mind that this CONIKS Java implementation is under active development. The repository may contain experimental features that aren't fully tested. We recommend using a [tagged release](https://github.com/coniks-sys/coniks-java/releases).

##Documentation
[Read the server's Java API (javadoc)](https://coniks-sys.github.io/coniks-java/org/coniks/coniks_server/package-summary.html)
39 changes: 20 additions & 19 deletions coniks_server/coniks_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,37 +4,38 @@
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# modification, are permitted provided that the following conditions are
# met:
# * Redistributions of source code must retain the above copyright
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Princeton University nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

## Runs or stops a CONIKS server instance

# Set all the configs here
CLASS_DEST="bin" #change this if you built the server somewhere else
# mvn builds our jar with dependencies
CLASS_DEST="./target/coniks_server-1.3-SNAPSHOT.jar"
CLASSPATH="-cp $CLASS_DEST"
SERVER_BIN="org.coniks.coniks_server.ConiksServer"
CONIKS_SERVERCONFIG="config" #change this if using a different config file
Expand Down Expand Up @@ -100,7 +101,7 @@ elif [ "$CMD" = "stop" ]; then
fi

echo "Stopping the CONIKS server."

kill `cat $CONIKS_SERVERLOGS/pid` >/dev/null
rm -f $CONIKS_SERVERLOGS/pid

Expand All @@ -112,7 +113,7 @@ elif [ "$CMD" = "clean" ]; then
# write to one of the logs
if [ `ps ax | grep -c $SERVER_BIN` -gt 1 ]; then
echo "Stopping the CONIKS server."

kill `cat $CONIKS_SERVERLOGS/pid` >/dev/null
rm -f $CONIKS_SERVERLOGS/pid
fi
Expand Down
45 changes: 35 additions & 10 deletions coniks_server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,31 @@
<parent>
<groupId>org.coniks</groupId>
<artifactId>coniks-java</artifactId>
<version>1.2-SNAPSHOT</version>
<version>1.3-SNAPSHOT</version>
</parent>

<groupId>org.coniks.coniks_server</groupId>
<artifactId>coniks_server</artifactId>
<version>1.3-SNAPSHOT</version>
<packaging>jar</packaging>
<version>1.2-SNAPSHOT</version>
<name>coniks_server</name>

<name>CONIKS [Reference Server]</name>
<url>http://coniks.org</url>
<description>CONIKS server library and reference implementation.
</description>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
<groupId>org.coniks.coniks_common</groupId>
<artifactId>coniks_common</artifactId>
<version>1.3-SNAPSHOT</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.coniks.coniks_common</groupId>
<artifactId>coniks_common</artifactId>
<version>1.2-SNAPSHOT</version>
<groupId>org.coniks.crypto</groupId>
<artifactId>coniks-crypto</artifactId>
<version>1.3-SNAPSHOT</version>
<scope>compile</scope>
</dependency>

Expand All @@ -48,4 +51,26 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<plugins>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
</plugin>
</plugins>
</build>
</project>
Loading

0 comments on commit e0b2ba5

Please sign in to comment.