Skip to content

Instantly share code, notes, and snippets.

@dlwhitehurst
Created March 2, 2017 06:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dlwhitehurst/16f6f87a2a33176010eeedf348f7f658 to your computer and use it in GitHub Desktop.
Save dlwhitehurst/16f6f87a2a33176010eeedf348f7f658 to your computer and use it in GitHub Desktop.
Class to Encrypt Property Values
/**
* Copyright (c) CI Wise Inc. All rights reserved. http://www.ciwise.com
* The software in this package is published under the terms of the Apache
* version 2.0 license, a copy of which has been included with this distribution
* in the LICENSE.txt file.
*
*/
package com.ciwise.accounting.util;
/**
* @author <a href="mailto:david@ciwise.com">David L. Whitehurst</a>
*
*/
public class EncryptPropertyValue {
// public static void main(String[] args) {
// byte[] encryptedBytes = AESCryptoUtil.encrypt("supercalifragilisticexpialidocious");
// String hexByteString = CryptoUtil.toHex(encryptedBytes);
//
// System.out.println("Hexbytes are: " + hexByteString);
//
// // Back again
// byte[] encryptedBytesBack = CryptoUtil.hexStringToByteArray(hexByteString);
// if (encryptedBytesBack == encryptedBytes) {
// System.out.println("All good here!");
// }
// String tmp = new String(AESCryptoUtil.decrypt(encryptedBytesBack));
// System.out.println("And, the initial string was: " + tmp);
//
// String tmp2 = new String(AESCryptoUtil.decrypt(CryptoUtil.hexStringToByteArray("1e438613340f991ab8b98a1b0a2f4b987678fd8daab4ee244bebcfef5b6aa2952962cadd19e69d36d8bfb2a566e99ffe")));
// System.out.println(tmp2);
// }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment