Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /* ************************************************************************
  #
  #  DivConq
  #
  #  http://divconq.com/
  #
  #  Copyright:
  #    Copyright 2014 eTimeline, LLC. All rights reserved.
  #
 #  License:
 #    See the license.txt file in the project's top-level directory for details.
 #
 #  Authors:
 #    * Andy White
 #
 ************************************************************************ */
 package divconq.util;
 
 
For protection, certain settings can be obscured (encrypted) in the config file. Applications wanting higher protection will want to use their own home-made settings obfuscator - after all DivConq is open source so anyone reading this source code will know how to decrypt your settings. Unless you roll your own obfuscator. The way to support this is to make your own class implementing ISettingObfuscator. Place the qualified class name in the "TimerClass" attribute of the "Clock" element in the config file: <Clock TimerClass="divconq.util.BasicSettingsObfuscator" ... /> If there is no TimerClass listed then the default - BasicSettingsObfuscator - is used. The ISettingObfuscator implementation must be able to run in Configure and in other scenarios where Hub is not fully loaded. Do not use struct classes, make references to Hub.instance, access locale, scripting or any of the other "major" DivConq features within the implementation.

Author(s):
Andy
 
 public interface ISettingsObfuscator {
Called when Hub or Configure loads the configuration file. Load and initialize your secret keys here.

Parameters:
config the Clock element
 
 	void init(XElement config);

Called when Configure first generates the configuration file. Any shared secrets you may need to store should be stored here, in the element provided (or child element).

Parameters:
config the Clock element
 
 	void configure(XElement config);

Take a hex string containing an encrypted setting and decrypt it.

Parameters:
v encrypted hex
Returns:
decrypted setting
 
Take byte array containing an encrypted setting and decrypt it.

Parameters:
v encrypted byte array
Returns:
decrypted setting
 
 	String decryptString(byte[] v);

Take a setting and encrypt into a hex string

Parameters:
v setting value
Returns:
encrypted hex string
 
Take a setting and encrypt into a byte array

Parameters:
v setting value
Returns:
encrypted byte array
 
 	
Take a value and hash it into a hex string

Parameters:
v value to hash
Returns:
hash as hex string
Take a value and hash it into a byte array

Parameters:
v value to hash
Returns:
hash as byte array
New to GrepCode? Check out our FAQ X