de.smartics.properties.api.core.security
Class SystemPropertyBasedPropertyValueSecurity

Package class diagram package SystemPropertyBasedPropertyValueSecurity
java.lang.Object
  extended by de.smartics.properties.api.core.security.AbstractPropertyValueSecurity
      extended by de.smartics.properties.api.core.security.SystemPropertyBasedPropertyValueSecurity
All Implemented Interfaces:
PropertyValueSecurity, Serializable

public class SystemPropertyBasedPropertyValueSecurity
     
     
extends AbstractPropertyValueSecurity

Implementation fetching security information from system properties.

See Also:
Serialized Form

Field Summary
static String SECURITY_ALGORITHM
          The key with which the algorithm to construct the security key is stored in the system properties.
static String SECURITY_KEY
          The key with which the security key is stored in the system properties.
static String SECURITY_PROVIDER
          The key with which the security provider to encrypt and decrypt property values is stored in the system properties.
static String SECURITY_TRANSFORMATION
          The key with which the transformation to encrypt and decrypt property values is stored in the system properties.
 
Constructor Summary
SystemPropertyBasedPropertyValueSecurity()
           
 
Method Summary
protected  Cipher createCipher(PropertyDescriptor descriptor)
          Creates the cipher instance.
protected  SecretKey createKey(PropertyDescriptor descriptor)
          Creates the symmetric key instance.
 String decrypt(PropertyDescriptor descriptor, String encryptedValue)
          Decrypts the given property value.
 String encrypt(PropertyDescriptor descriptor, String plainValue)
          Encrypts the given property value.
 
Methods inherited from class de.smartics.properties.api.core.security.AbstractPropertyValueSecurity
decodePropertyValue, decrypt, encodePropertyValue, encrypt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SECURITY_KEY

public static final String SECURITY_KEY
The key with which the security key is stored in the system properties.

The value of this constant is "de.smartics.properties.security.key".

Constant Field Value:
"de.smartics.properties.security.key"

SECURITY_ALGORITHM

public static final String SECURITY_ALGORITHM
The key with which the algorithm to construct the security key is stored in the system properties.

A sample value is AES.

The value of this constant is "de.smartics.properties.security.algorithm".

Constant Field Value:
"de.smartics.properties.security.algorithm"

SECURITY_PROVIDER

public static final String SECURITY_PROVIDER
The key with which the security provider to encrypt and decrypt property values is stored in the system properties. If no value is provided, the system's default provider will be used.

The value of this constant is "de.smartics.properties.security.provider".

Constant Field Value:
"de.smartics.properties.security.provider"

SECURITY_TRANSFORMATION

public static final String SECURITY_TRANSFORMATION
The key with which the transformation to encrypt and decrypt property values is stored in the system properties.

A sample value is AES/ECB/PKCS5Padding.

The value of this constant is "de.smartics.properties.security.transformation".

Constant Field Value:
"de.smartics.properties.security.transformation"
Constructor Detail

SystemPropertyBasedPropertyValueSecurity

public SystemPropertyBasedPropertyValueSecurity()
Method Detail

decrypt

public String decrypt(PropertyDescriptor descriptor,
                      String encryptedValue)
               throws NullPointerException,
                      SecurityException
Description copied from interface: PropertyValueSecurity
Decrypts the given property value.

Parameters:
descriptor - the descriptor of the property.
encryptedValue - the encrypted value of the property to be decrypted.
Returns:
the decrypted value.
Throws:
NullPointerException - may be thrown if descriptor is null.
SecurityException - if the value cannot be decrypted.

encrypt

public String encrypt(PropertyDescriptor descriptor,
                      String plainValue)
               throws NullPointerException,
                      SecurityException
Description copied from interface: PropertyValueSecurity
Encrypts the given property value.

Parameters:
descriptor - the descriptor of the property.
plainValue - the plain value of the property to be encrypted.
Returns:
the encrypted value.
Throws:
NullPointerException - may be thrown if descriptor is null.
SecurityException - if the value cannot be encrypted.

createCipher

protected Cipher createCipher(PropertyDescriptor descriptor)
                       throws SecurityException
Creates the cipher instance.

Parameters:
descriptor - the descriptor of the property whose value is to be secured.
Returns:
the cipher instance ready to be used.
Throws:
SecurityException - on any problem creating the cipher instance.

createKey

protected SecretKey createKey(PropertyDescriptor descriptor)
                       throws SecurityException
Creates the symmetric key instance.

Parameters:
descriptor - the descriptor of the property whose value is to be secured.
Returns:
the symmetric key instance ready to be used.
Throws:
SecurityException - on any problem creating the symmetric key instance.


Copyright © 2012-2013 Kronseder & Reiner GmbH - smartics. All Rights Reserved.