PEM Converter Maven Plugin

A Maven plugin that converts OpenSSL PEM-formatted root certificate files to a format more easily loadable in a Java program.

License

License

MIT
Categories

Categories

Maven Build Tools
GroupId

GroupId

com.dropbox.maven
ArtifactId

ArtifactId

pem-converter-maven-plugin
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

maven-plugin
Description

Description

PEM Converter Maven Plugin
A Maven plugin that converts OpenSSL PEM-formatted root certificate files to a format more easily loadable in a Java program.
Project URL

Project URL

https://github.com/dropbox/pem-converter-maven-plugin
Source Code Management

Source Code Management

https://github.com/dropbox/pem-converter-maven-plugin

Download pem-converter-maven-plugin

How to add to project

<plugin>
    <groupId>com.dropbox.maven</groupId>
    <artifactId>pem-converter-maven-plugin</artifactId>
    <version>1.0</version>
</plugin>

Dependencies

compile (2)

Group / Artifact Type Version
org.apache.maven : maven-plugin-api jar 2.0
org.apache.maven.plugin-tools : maven-plugin-annotations jar 3.2

Project Modules

There are no modules declared in this project.

PEM Converter Maven Plugin

A Maven plugin that converts OpenSSL PEM-formatted root certificate files to a format more easily and efficiently readable in a Java program.

1. In your Maven build:

Add this to the <build><plugins>...</plugins></build> section of your "pom.xml":

<plugin>
    <groupId>com.dropbox.maven</groupId>
    <artifactId>pem-converter-maven-plugin</artifactId>
    <version>1.0</version>
    <executions>
        <execution>
            <configuration>
                <input>whatever.pem</input>
                <output>${project.build.directory}/generated-resources/certs/whatever.raw</output>
            </configuration>
            <goals>
                <goal>convert</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Add this to the <build><resources>...</resources></build> section of your "pom.xml":

<resource>
    <directory>${project.build.directory}/generated-resources/certs</directory>
</resource>

2. In your program:

Use getResourceAsStream to read the generated resource file:

InputStream in = MyClass.class.getResourceAsStream("whatever.raw");
if (in == null) {
    throw new AssertionError("Couldn't find resource \"whatever.raw\");
}

Then load the certificates from an InputStream into a KeyStore. Example code you can copy: RawLoader.java

Command-Line Script

There's also a command-line script that will run the conversion.

  1. mvn compile
  2. ./run
com.dropbox.maven

Dropbox

Versions

Version
1.0