Snippets

David Whitehurst EncryptPropertyValue.java

Created by David Whitehurst
/**
 * 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("SomePropertyValueHere");
		String hexByteString = CryptoUtil.toHex(encryptedBytes);
		
	    System.out.println("Hexbytes are: " + hexByteString);
	    
	    byte[] encryptedBytesBack = CryptoUtil.hexStringToByteArray(hexByteString);
	    String tmp = new String(AESCryptoUtil.decrypt(encryptedBytesBack));
	    System.out.println("And, the initial string was: " + tmp);
	    
	}
	
}

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.