Skip to content

Commit

Permalink
Add BouncyCastle 1.59 builder Dockerfile and instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
colltoaction committed Jul 16, 2018
1 parent 31e5b0e commit 663238c
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 0 deletions.
45 changes: 45 additions & 0 deletions bouncycastle/1.59/0001-Add-lcrypto-as-an-output-JAR.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From f2beb14d765503e80b5caf333fc50044ea8ec2d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mart=C3=ADn=20Coll?= <martingonzalezcoll@gmail.com>
Date: Mon, 16 Jul 2018 11:59:56 -0300
Subject: [PATCH] Add lcrypto as an output JAR

---
ant/bc+-build.xml | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/ant/bc+-build.xml b/ant/bc+-build.xml
index 295ba7485..bc0750775 100644
--- a/ant/bc+-build.xml
+++ b/ant/bc+-build.xml
@@ -257,6 +257,7 @@
<!--
Lightweight Libraries
-->
+ <property name="lcrypto" value="bclcrypto-${target.name}" />

<mkdir dir="${lcrypto.target.dir}" />
<mkdir dir="${lcrypto.target.src.dir}" />
@@ -288,6 +289,20 @@
<path refid="project.classpath" />
</classpath>
</javac>
+
+ <packJar jarbase="${artifacts.jars.dir}/${lcrypto}">
+ <manifest-element>
+ <manifest>
+ <attribute name="Manifest-Version" value="1.0" />
+ </manifest>
+ </manifest-element>
+ <fileset-element>
+ <fileset dir="${lcrypto.target.classes.dir}">
+ <include name="**/*.class"/>
+ <include name="**/*.properties"/>
+ </fileset>
+ </fileset-element>
+ </packJar>
</target>

<!--
--
2.17.1

24 changes: 24 additions & 0 deletions bouncycastle/1.59/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
FROM openjdk:8u171

RUN apt update
RUN apt install -y --no-install-recommends ant git unzip wget strip-nondeterminism file

RUN mkdir -p /opt/junit
RUN wget http://central.maven.org/maven2/junit/junit/4.12/junit-4.12.jar -O /opt/junit/junit.jar

RUN mkdir -p /opt/javamail
RUN wget http://central.maven.org/maven2/javax/mail/javax.mail-api/1.6.1/javax.mail-api-1.6.1.jar -O /opt/javamail/mail.jar

RUN mkdir -p /opt/jaf
RUN wget http://central.maven.org/maven2/javax/activation/activation/1.1.1/activation-1.1.1.jar -O /opt/jaf/activation.jar

RUN git clone https://github.com/bcgit/bc-java.git /code/bc-java

WORKDIR /code/bc-java
RUN git checkout r1rv59
ADD 0001-Add-lcrypto-as-an-output-JAR.patch /code/bc-java
RUN git apply 0001-Add-lcrypto-as-an-output-JAR.patch

RUN ant -f ant/jdk15+.xml build-lw
RUN strip-nondeterminism ./build/artifacts/jdk1.5/jars/bclcrypto-jdk15on-159.jar

26 changes: 26 additions & 0 deletions bouncycastle/1.59/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# BouncyCastle 1.59

* Source: https://github.com/bcgit/bc-java
* Tag: `r1rv59`

## Build

```
$ docker build -t bouncycastle-r1rv59-reproducible .
```

## Verify

```
$ docker run --rm bouncycastle-r1rv59-reproducible sha256sum /code/bc-java/build/artifacts/jdk1.5/jars/bclcrypto-jdk15on-159.jar
7d03ba37df4d0ddc4ea40d56554324c6f18062a930edadb0a1b3acbbbea28efc /code/bc-java/build/artifacts/jdk1.5/jars/bclcrypto-jdk15on-159.jar
```

## (Optional) Extract JAR from image

```
$ docker run --name temp-container bouncycastle-r1rv59-reproducible /bin/true
$ docker cp temp-container:/code/bc-java/build/artifacts/jdk1.5/jars/bclcrypto-jdk15on-159.jar ./bclcrypto-jdk15on-159.jar
$ docker rm temp-container
```

0 comments on commit 663238c

Please sign in to comment.