Last active
April 7, 2018 00:05
-
-
Save jeffjohnson9046/0fa6f2e4f713fb0b22d304866cf81396 to your computer and use it in GitHub Desktop.
How I set up my Mac for encrypting values using Spring on the command line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install the Spring Boot CLI via homebrew (https://brew.sh/) | |
brew update | |
brew tap pivotal/tap | |
brew install springboot | |
# Download the Java 8 JCE from here: http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html | |
# Extract the .zip file somewhere. There should be three files: | |
# | |
# local_policy.jar | |
# README.txt | |
# US_export_policy.jar | |
# Put the new files in $JAVA_HOME/lib/security (assumes the JCE files were extracted to ~/Downloads): | |
sudo cp ~/Downloads/UnlimitedJCEPolicyJDK8/*.jar $JAVA_HOME/jre/lib/security | |
# Add the spring cloud CLI utils (instructions from here: https://cloud.spring.io/spring-cloud-cli/) | |
spring install org.springframework.cloud:spring-cloud-cli:1.2.3.RELEASE | |
# Test the encryption | |
spring encrypt my-test -key test-key | |
# returns fce9f55ae106d769e589d7b4198ee73779f5077d7fb780038259a831163ffc38 | |
# Test the decryption | |
spring decrypt fce9f55ae106d769e589d7b4198ee73779f5077d7fb780038259a831163ffc38 -key test-key | |
# returns my-test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Almost worked as-is for me, but where the snippet says to
copy to $JAVA_HOME/jre/lib/security
it didn't work for me. I had to tweak it as so:
copy to $JAVA_HOME/Contents/Home/jre/lib/security
I was getting 'Unable to initialize due to invalid secret key'
after running 'spring encrypt my-test -key my_key'