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

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

public abstract class AbstractPropertyValueSecurity
     
     
extends Object
implements PropertyValueSecurity

Base implementation based on Java security.

See Also:
Serialized Form

Constructor Summary
protected AbstractPropertyValueSecurity()
          Default constructor.
 
Method Summary
protected  byte[] decodePropertyValue(String encryptedValue)
          Decodes the encrypted property value.
protected  String decrypt(PropertyDescriptor descriptor, String encryptedValue, SecretKey key, Cipher cipher)
          Decrypts the given property value.
protected  String encodePropertyValue(byte[] encryptedBytes)
          Encodes the encrypted bytes.
protected  String encrypt(PropertyDescriptor descriptor, String plainValue, SecretKey key, Cipher cipher)
          Encrypts the given property value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.smartics.properties.api.core.security.PropertyValueSecurity
decrypt, encrypt
 

Constructor Detail

AbstractPropertyValueSecurity

protected AbstractPropertyValueSecurity()
Default constructor.

Method Detail

decrypt

protected String decrypt(PropertyDescriptor descriptor,
                         String encryptedValue,
                         SecretKey key,
                         Cipher cipher)
                  throws NullPointerException,
                         SecurityException
Decrypts the given property value.

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

encrypt

protected String encrypt(PropertyDescriptor descriptor,
                         String plainValue,
                         SecretKey key,
                         Cipher cipher)
                  throws NullPointerException,
                         SecurityException
Encrypts the given property value.

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

decodePropertyValue

protected byte[] decodePropertyValue(String encryptedValue)
Decodes the encrypted property value.

Parameters:
encryptedValue - the encrypted value to decode.
Returns:
the decoded value.

encodePropertyValue

protected String encodePropertyValue(byte[] encryptedBytes)
Encodes the encrypted bytes.

Parameters:
encryptedBytes - the bytes to encode.
Returns:
the encoded bytes.


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