Skip to content

Commit

Permalink
fixes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
elbosso committed Nov 2, 2019
1 parent 38b099f commit 0a0f345
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 6 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
Changelog of this project.


**fixes #1**


[38b099f7e8708e5](https://github.com/<user>/<project>>/commit/38b099f7e8708e5) Juergen Key *2019-11-02 05:43:12*

**re #1**


[dc6973ab044a700](https://github.com/<user>/<project>>/commit/dc6973ab044a700) Juergen Key *2019-11-01 08:59:19*

**re #1**


Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ some default port.

## Working with it

Verweis auf [expect-dialog-ca](https://github.com/elbosso/expect-dialog-ca)

The project offers some resources to make it easier working with timestamps:
One of them is available under `http://<host>:<port>/tsa.conf`.
It is a configuration that can be used with
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class App {
public static void main(String[] args) {
Security.addProvider(new BouncyCastleProvider());
Javalin app = Javalin.create().start(7000);
app.config.addStaticFiles("/site");
/* app.get("/", ctx -> {
System.out.println("get");
ctx.result("Hello World");
Expand Down Expand Up @@ -68,15 +69,15 @@ public static void main(String[] args) {
if(ctx.contentType().equals("application/timestamp-query"))
{
//curl -H "Content-Type: application/timestamp-query" --data-binary '@../../work/expect-dialog-ca.git/_priv/create_ca.sh.tsq' http://localhost:7000/
System.out.println("body " + ctx.bodyAsBytes().length);
//System.out.println("body " + ctx.bodyAsBytes().length);
tsq=ctx.bodyAsBytes();
}
else if(ctx.contentType().startsWith("multipart/form-data"))
{
//curl -F "tsq=@../../work/expect-dialog-ca.git/_priv/create_ca.sh.tsq" http://localhost:7000/
if(ctx.uploadedFile("tsq")!=null)
{
System.out.println("tsq "+ctx.uploadedFile("tsq").getContentLength());
//System.out.println("tsq "+ctx.uploadedFile("tsq").getContentLength());
java.io.InputStream is=ctx.uploadedFile("tsq").getContent();
java.io.ByteArrayOutputStream baos=new java.io.ByteArrayOutputStream();
de.elbosso.util.Utilities.copyBetweenStreams(is,baos,true);
Expand Down Expand Up @@ -140,12 +141,12 @@ else if(ctx.contentType().startsWith("multipart/form-data"))
ctx.status(500);
}
});
app.before(ctx -> {
/* app.before(ctx -> {
System.out.println("before");
System.out.println(ctx.contentType());
System.out.println(ctx.req.getMethod());
});
}
*/ }
byte[] createTspResponse(PrivateKey tspSigningKey, X509Certificate tspSigningCert, byte[] encRequest)
throws TSPException, OperatorCreationException, GeneralSecurityException, IOException
{
Expand Down
77 changes: 77 additions & 0 deletions src/main/resources/site/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<!DOCTYPE html>
<html>
<title>RFC 3161 Timestamp Server</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://www.w3schools.com/lib/w3-theme-teal.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.3.0/css/font-awesome.min.css">
<body>

<!-- Header -->
<header class="w3-container w3-theme w3-padding" id="myHeader">
<!--i onclick="w3_open()" class="fa fa-bars w3-xlarge w3-button w3-theme"></i-->
<div class="w3-center">
<h4>by Jürgen "EL BOSSO" Key</h4>
<h1 class="w3-xxxlarge w3-animate-bottom">RFC 3161 Timestamp Server</h1>
<div class="w3-padding-16">
<a class="w3-btn w3-large w3-theme-dark w3-hover-teal" href="https://github.com/elbosso/rfc3161timestampingserver">Visit project website!</a>
</div>
<div class="w3-padding-16">
<a class="w3-btn w3-large w3-theme-dark w3-hover-teal" href="https://elbosso.github.io">Visit authors website!</a>
</div>
</div>
</header>

<div class="w3-row-padding w3-margin-top">
<div class="w3-twothird">
<div class="w3-card w3-container" style="min-height:500px">
<h3>Usage</h3>
<p>The OpenSSL configuration provided as ressource can be used with
<a href="https://www.openssl.org/" rel="nofollow">OpenSSL</a> to create a certificate
request like so:</p>
<div class="w3-panel w3-leftbar w3-sand w3-tiny w3-mono">openssl ts -query -config tsa.conf -cert -sha512 -data &lt;path&gt;/&lt;some_file&gt; -no_nonce -out &lt;request_path&gt;/&lt;request&gt;.tsq</div>
<p>This request can be sent using a HTTP POST request as multipart form data
(for example from a file upload form inside a web page):</p>
<div class="w3-panel w3-leftbar w3-sand w3-tiny w3-mono">curl -F "tsq=@&lt;request&gt;.tsq" http://&lt;host&gt;:&lt;port&gt;/ &gt;&lt;reply&gt;.tsr</div>
<p>The file <em>reply.tsr</em> contains the timestamp. Alternatively,
this also works with a POST request containing the timestamp query in
the body of said request having the correct mime-type:</p>
<div class="w3-panel w3-leftbar w3-sand w3-tiny w3-mono">curl -H "Content-Type: application/timestamp-query" --data-binary '@&lt;request&gt;.tsq' http://&lt;host&gt;:&lt;port&gt;/ &gt;&lt;reply&gt;.tsr</div>
<p>The content of the timestamp (useful for ascertaining the time and date
for example) can be displayed for example with the help of
OpenSSL command line tools like so:</p>
<div class="w3-panel w3-leftbar w3-sand w3-tiny w3-mono">openssl ts -config tsa.conf -reply -in &lt;reply&gt;.tsr -text</div>
<p>To verify the timestamp, OpenSSL can help too:</p>
<div class="w3-panel w3-leftbar w3-sand w3-tiny w3-mono">openssl ts -verify -config tsa.conf -queryfile &lt;request&gt;.tsq -in &lt;reply&gt;.tsr -CAfile chain.pem</div>
</div>
</div>

<div class="w3-third">
<div class="w3-card w3-container" style="min-height:500px">
<h3>Ressources</h3><br>
<p><a href="/tsa.crt">Timestamping Authority (TSA) Certificate</a></p>
<p><a href="/chain.pem">Certificate Chain for TSA</a></p>
<p><a href="/tsa.conf">OpenSSL configuration for client operations</a></p>
<p></p>
</div>
</div>

</div>


<!-- Footer -->
<footer class="w3-container w3-theme-dark">
<!--h3>Footer</h3-->
<p>Powered by <a href="https://www.w3schools.com/w3css/default.asp" target="_blank">w3.css</a></p>
<!--div style="position:relative;bottom:55px;" class="w3-tooltip w3-right">
Go To Top&nbsp;
<a class="w3-text-white" href="#myHeader">
<i class="fa fa-chevron-circle-up"></i></a>
</div>
<p>Remember to check out our&nbsp;&nbsp;<a href="w3css_references.asp" class="w3-btn w3-theme" target="_blank">W3.CSS Reference</a></p-->
</footer>


</body>
</html>

0 comments on commit 0a0f345

Please sign in to comment.