com.universaldevices.security.upnp
Class UPnPBulkCipher

java.lang.Object
  extended by com.universaldevices.security.upnp.UPnPBulkCipher

public class UPnPBulkCipher
extends java.lang.Object

This class represents a bulk key cipher which is used to encrypt messages.

As of right now, the current supported bulk key algorithm is the following UPnPSecurity.BULK_CIPHER_NAME="AES";
UPnPSecurity.BLOCK_CIPHER_MODE="CFB";
UPnPSecurity.BLOCK_CIPHER_PADDING="NoPadding";
UPnPSecurity.BULK_CIPHER_PARAMETERS = BULK_CIPHER_NAME+"/"+BLOCK_CIPHER_MODE+"/"+BLOCK_CIPHER_PADDING;
UPnPSecurity.BULK_CIPHER_LENGTH = 128; //in bytes
UPnPSecurity.DEFAULT_DEVICE_BULK_ALGORITHM = "AES-128-CFB";

Author:
UDArchtitect

Field Summary
 byte[] symIV
          The symmetric IV
 byte[] symKey
          The symmetric Key
 
Constructor Summary
UPnPBulkCipher()
          Constructor Defaults to the parameters defined in UPnPSecurity
 
Method Summary
 byte[] decrypt(byte[] cipherText, byte[] iv)
          Decrypts the given data using an IV
 byte[] encrypt(byte[] msg, boolean useParams)
          Encrypts the given data
 byte[] getKeyAndIV()
          Returns the Key and IV (initial vector) for this cipher
 void refresh()
          Refreshes this object based on the parameters as defined in UPnPSecurity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

symKey

public byte[] symKey
The symmetric Key


symIV

public byte[] symIV
The symmetric IV

Constructor Detail

UPnPBulkCipher

public UPnPBulkCipher()
Constructor Defaults to the parameters defined in UPnPSecurity

Method Detail

getKeyAndIV

public byte[] getKeyAndIV()
Returns the Key and IV (initial vector) for this cipher

Returns:
- Key and IV concatenated in a byte array

decrypt

public byte[] decrypt(byte[] cipherText,
                      byte[] iv)
Decrypts the given data using an IV

Parameters:
cipherText - - the text to be decrypted
iv - - the initial vector (IV)
Returns:
- the decrypted message

encrypt

public byte[] encrypt(byte[] msg,
                      boolean useParams)
Encrypts the given data

Parameters:
msg - - the message to be encrypted
useParams - - whether or not to use the parameters already initialized in this object
Returns:
- the encrypted message

refresh

public void refresh()
Refreshes this object based on the parameters as defined in UPnPSecurity