Class NumberConceal

java.lang.Object
pygar.zoneable.NumberConceal

@ThreadSafe
public class NumberConceal
extends java.lang.Object
  • Constructor Summary

    Constructors 
    Constructor Description
    NumberConceal​(javax.crypto.Cipher crypto, java.lang.String key, int nsegments, double number_min, double number_max, double number_range)
    Instances of this class provide a method to conceal the value of real numbers using a piecewise linear mapping that is unique to the value's name.
  • Method Summary

    Modifier and Type Method Description
    void addName​(java.lang.String name, double value_min, double value_max)
    Add the name of a value that will later be concealed by the conceal function
    double conceal​(java.lang.String name, double value)
    Conceal a named value.
    java.lang.String encodeString​(java.lang.String s)  
    boolean hasName​(java.lang.String name)
    Check whether a value name is defined already.
    double reveal​(java.lang.String name, double value)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • NumberConceal

      public NumberConceal​(javax.crypto.Cipher crypto, java.lang.String key, int nsegments, double number_min, double number_max, double number_range)
      Instances of this class provide a method to conceal the value of real numbers using a piecewise linear mapping that is unique to the value's name. The mapping function is derived by encrypting the value name and converting the encrypted value into a numeric function. The value of nsegments has practical constaints. If nsegments is too small, the algorithm as implemented here will attempt to convert a string as a hexidecimal number that is too large for the Java converter. In the other direction, nsegments cannot be larger than the number of bytes in the encryption algorithm's block size. Neither of these number has a convenient, universal name, so we don't currently check the limits. During testing, the algorithm worked well for nsegments >= 4 and <= 32. Moreover, we only verified the powers of two: 4, 8, 16, 32.
      Parameters:
      nsegments - the number of linear segments in the piecewise linear function
      key - the encryption key used to derive the function from a name
      number_min - the most negative value that can be represented enterprise wide
      number_max - the most positive value that can be represented enterprise wide
      number_range - the agreed range of numerical representation which should be less than cmax-cmin
  • Method Details

    • conceal

      public double conceal​(java.lang.String name, double value) throws ConfigurationError
      Conceal a named value.
      Parameters:
      name -
      value -
      Returns:
      the concealed value
      Throws:
      ConfigurationError
    • reveal

      public double reveal​(java.lang.String name, double value) throws ConfigurationError
      Throws:
      ConfigurationError
    • addName

      public void addName​(java.lang.String name, double value_min, double value_max) throws ConfigurationError, CryptoException
      Add the name of a value that will later be concealed by the conceal function
      Parameters:
      name - name of the value
      value_min - smallest value expected for the named value
      value_max - largest value expected for the named value
      Throws:
      ConfigurationError
      CryptoException
    • hasName

      public boolean hasName​(java.lang.String name)
      Check whether a value name is defined already.
      Parameters:
      name - name of a value
      Returns:
      true if the name is defined
    • encodeString

      public java.lang.String encodeString​(java.lang.String s) throws CryptoException
      Throws:
      CryptoException