Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Denis Arrivault
committed
Jan 31, 2017
1 parent
c34aa12
commit 7aa442d
Showing
24 changed files
with
1,337 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
language: java | ||
|
||
before_install: | ||
- sudo apt-get update -qq | ||
- sudo apt-get install default-jdk | ||
|
||
script: ./gradlew test | ||
|
||
branches: | ||
only: | ||
- master |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package controller; | ||
|
||
import javax.ws.rs.GET; //REST-related dependencies | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.PathParam; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
import java.io.File; | ||
import java.nio.file.Files; | ||
import java.nio.file.Paths; | ||
|
||
import rest.api.ServletPath; | ||
|
||
@ServletPath("/.well-know/acme-challenge/*") | ||
@Path("/") | ||
public class CASingingRequest { | ||
@GET | ||
@Path("/{input}") | ||
public String hash(@PathParam("input") String input) throws Exception | ||
{ | ||
//Send the file for the CA. (let's encrypt) | ||
File file = new File("." + input); | ||
if( file.exists() ) | ||
{ | ||
String res = new String(Files.readAllBytes(file.toPath())); | ||
return res; | ||
} | ||
else | ||
return "404 not found"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package controller; | ||
|
||
import javax.ws.rs.GET; //REST-related dependencies | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.PathParam; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
import crypt.api.hashs.Hasher; //module to test dependencies | ||
import crypt.factories.HasherFactory; | ||
import rest.api.ServletPath; | ||
|
||
@ServletPath("/command/hash/*") //url path. PREFIX WITH COMMAND/ !!! | ||
@Path("/") | ||
public class CryptCommander { | ||
@GET | ||
@Path("/{input}") //a way to name the pieces of the query | ||
public String hash(@PathParam("input") String input) { //this argument will be initialized with the piece of the query | ||
Hasher hasher = HasherFactory.createDefaultHasher(); | ||
return new String(hasher.getHash(input.getBytes())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/main/java/crypt/api/certificate/CertificateGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package crypt.api.certificate; | ||
|
||
import java.security.KeyPair; | ||
import java.security.cert.Certificate; | ||
|
||
/** | ||
* Use to create Certificate (objet and file (jks) | ||
* @author Sébastien Pelletier | ||
* | ||
*/ | ||
public interface CertificateGenerator | ||
{ | ||
/** | ||
* Get the keyPair used for the certificate. | ||
* @author Sébastien Pelletier | ||
*/ | ||
public KeyPair getKeysPair() throws Exception; | ||
|
||
/** | ||
* Get the Keystore password | ||
* @author Sébastien Pelletier | ||
*/ | ||
public String getKsPassword() throws Exception; | ||
|
||
/** | ||
* Set the configuration file. (containing certificate information). | ||
* @param file Path to the configuration file. | ||
* @author Sébastien Pelletier | ||
*/ | ||
public void setConfigFile(String file) throws Exception; | ||
|
||
/** | ||
* Initalization of datas from file. | ||
* @author Sébastien Pelletier | ||
*/ | ||
public void initDatas() throws Exception; | ||
|
||
/** | ||
* Create the certificate and keys for it. | ||
* @param Signature specifie what signature you want. | ||
* @return Return the newly created certificate. | ||
* @author Sébastien Pelletier, Antoine Boudermine | ||
*/ | ||
public Certificate CreateCertificate(String signature) throws Exception; | ||
|
||
/** | ||
* Create a certificate chain of one certificate. | ||
* @author Sébastien Pelletier | ||
*/ | ||
public Certificate[] CreateChainCertificate() throws Exception; | ||
|
||
/** | ||
* Store the created certificate in the specified file (keystore). | ||
* @param file_name The keystore file. | ||
* #Author Pelletier Sébastien | ||
*/ | ||
public void StoreInKeystore(String file_name) throws Exception; | ||
|
||
|
||
} |
Oops, something went wrong.