Example

Crypto

Demonstrates how the helix-crypto modules cover hashing, encryption, MAC validation, and shared-secret exchange. Shows helix-crypto-bcrypt, helix-crypto-aead, helix-crypto-mac, and helix-crypto-diffiehellman in one small workflow.
Group
Library
Path
examples/library/crypto

Overview

Helix Java application that shows how to use the different crypto modules under helix-crypto.

Run this example from the shared examples build:

Run

Run this example from the shared examples build


./gradlew -p examples runExample -Pexample=library/crypto --init-script "$(pwd)/helix.init.gradle"

What It Shows

  • hashing and verifying secrets with helix-crypto-bcrypt
  • encrypting and decrypting data with helix-crypto-aead
  • computing and verifying message authentication codes with helix-crypto-mac
  • generating key pairs and a shared secret with helix-crypto-diffiehellman
  • combining the modules in one small workflow-oriented example application

Example Output

Helix crypto example
bcrypt.match=true
aead.roundtrip=card-token-123
mac.verified=true
diffieHellman.sharedSecretMatch=true
diffieHellman.publicKeyLength=296

Development

Building the Application

Run the following command to build the application:

Command

Building the Application


./gradlew clean build

Testing the Application

Run the following command to run the application tests:

Command

Testing the Application


./gradlew test
./gradlew integration

Running the Example

Run the application and inspect the crypto workflow results:

Command

Running the Example


./gradlew run