Fork me on GitHub

Using the Maven Crypto Plugin

The first step we'll add the plugin to the POM and configure it to encrypt a file foo.jar.

<build>
  ...
  <plugins>
    <plugin>
      <groupId>de.m3y.maven</groupId>
      <artifactId>crypto-maven-plugin</artifactId>
      <version>1.0</version>
      <configuration>
        <fileSets>
          <fileSet>
            <directory>src/test/example</directory>
            <includes>
              <include>foo.jar</include>
            </includes>
          </fileSet>
        </fileSets>
        <cipherOptions>
          <operationMode>encrypt</operationMode>
          <algorithm>AES</algorithm>
          <algorithmMode>CBC</algorithmMode>
          <algorithmPadding>PKCS5Padding</algorithmPadding>
          <secret>my secret</secret>
          <keyDigest>MD5</keyDigest>
        </cipherOptions>
      </configuration>
    </plugin>
  </plugins>
  ...
</build>

Now you can invoke the plugin using mvn crypto:crypto :

Example invocation of crypto goal

For usage details see the crypto goal description.