com.metamatrix.common.util.crypto.cipher
Class SymmetricCryptor

java.lang.Object
  extended by com.metamatrix.common.util.crypto.cipher.BasicCryptor
      extended by com.metamatrix.common.util.crypto.cipher.SymmetricCryptor
All Implemented Interfaces:
Cryptor, Decryptor, Encryptor

public class SymmetricCryptor
extends BasicCryptor

Provides a symmetric cryptor


Field Summary
static java.lang.String DEFAULT_ALIAS
           
static int DEFAULT_KEY_BITS
           
static java.lang.String DEFAULT_STORE_PASSWORD
           
static java.lang.String DEFAULT_SYM_ALGORITHM
           
static java.lang.String DEFAULT_SYM_KEY_ALGORITHM
           
 
Fields inherited from class com.metamatrix.common.util.crypto.cipher.BasicCryptor
cipherAlgorithm, decryptKey, encryptCipher
 
Method Summary
static void generateAndSaveKey(java.lang.String file)
           
 byte[] getEncodedKey()
           
static SymmetricCryptor getSymmectricCryptor()
          Creates a new SymmetricCryptor with a new symmetric key
static SymmetricCryptor getSymmectricCryptor(byte[] key)
          Creates a SymmetricCryptor using the supplied byte array as the key
static SymmetricCryptor getSymmectricCryptor(java.net.URL keyResource)
          Creates a SymmetricCryptor using the supplied URL contents as the key
static void main(java.lang.String[] args)
           
 
Methods inherited from class com.metamatrix.common.util.crypto.cipher.BasicCryptor
decrypt, decrypt, encrypt, encrypt, initDecryptCipher, initEncryptCipher, sealObject, stripEncryptionPrefix, unsealObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_SYM_KEY_ALGORITHM

public static final java.lang.String DEFAULT_SYM_KEY_ALGORITHM
See Also:
Constant Field Values

DEFAULT_SYM_ALGORITHM

public static final java.lang.String DEFAULT_SYM_ALGORITHM
See Also:
Constant Field Values

DEFAULT_KEY_BITS

public static final int DEFAULT_KEY_BITS
See Also:
Constant Field Values

DEFAULT_STORE_PASSWORD

public static final java.lang.String DEFAULT_STORE_PASSWORD
See Also:
Constant Field Values

DEFAULT_ALIAS

public static final java.lang.String DEFAULT_ALIAS
See Also:
Constant Field Values
Method Detail

getSymmectricCryptor

public static SymmetricCryptor getSymmectricCryptor()
                                             throws CryptoException
Creates a new SymmetricCryptor with a new symmetric key

Returns:
a new SymmetricCryptor
Throws:
CryptoException

getSymmectricCryptor

public static SymmetricCryptor getSymmectricCryptor(java.net.URL keyResource)
                                             throws CryptoException,
                                                    java.io.IOException
Creates a SymmetricCryptor using the supplied URL contents as the key

Parameters:
key -
Returns:
a new SymmetricCryptor
Throws:
CryptoException
java.io.IOException

getSymmectricCryptor

public static SymmetricCryptor getSymmectricCryptor(byte[] key)
                                             throws CryptoException
Creates a SymmetricCryptor using the supplied byte array as the key

Parameters:
key -
Returns:
a new SymmetricCryptor
Throws:
CryptoException

generateAndSaveKey

public static void generateAndSaveKey(java.lang.String file)
                               throws CryptoException,
                                      java.io.IOException
Throws:
CryptoException
java.io.IOException

getEncodedKey

public byte[] getEncodedKey()

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception


Copyright © 2009. All Rights Reserved.