foreignKeys
Class ForeignAESBlowfishKey
java.lang.Object
foreignKeys.ForeignAESBlowfishKey
- All Implemented Interfaces:
- ForeignKey, java.io.Serializable
public class ForeignAESBlowfishKey
- extends java.lang.Object
- implements ForeignKey, java.io.Serializable
- Author:
- Dominik
- See Also:
- Serialized Form
Constructor Summary |
ForeignAESBlowfishKey(java.lang.String name,
java.lang.String type,
javax.crypto.spec.SecretKeySpec skeySpec)
Creates a ForeignAESBlowfishKey |
Method Summary |
byte[] |
decrypt(byte[] code,
javax.crypto.Cipher cipher)
Decrypts a byte array using AES or Blowfish. |
byte[] |
encrypt(byte[] text,
javax.crypto.Cipher cipher)
encrypts a byte array using AES or Blowfish. |
java.util.Date |
getDate()
|
java.lang.String |
getName()
|
java.lang.String |
getType()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ForeignAESBlowfishKey
public ForeignAESBlowfishKey(java.lang.String name,
java.lang.String type,
javax.crypto.spec.SecretKeySpec skeySpec)
- Creates a ForeignAESBlowfishKey
- Parameters:
name
- of the ownertype
- of the keydate
- of creationskeySpec
- the key itself
encrypt
public byte[] encrypt(byte[] text,
javax.crypto.Cipher cipher)
throws java.security.GeneralSecurityException,
javax.crypto.NoSuchPaddingException
- encrypts a byte array using AES or Blowfish.
- Parameters:
text
- the byte array to encryptcipher
- used for encryption
- Returns:
- the encrypted byte array
- Throws:
java.security.GeneralSecurityException
javax.crypto.NoSuchPaddingException
decrypt
public byte[] decrypt(byte[] code,
javax.crypto.Cipher cipher)
throws java.security.GeneralSecurityException,
javax.crypto.BadPaddingException
- Decrypts a byte array using AES or Blowfish.
- Parameters:
code
- the crypted byte arraycipher
- used for decryption
- Returns:
- the decrypted byte array
- Throws:
java.security.GeneralSecurityException
javax.crypto.BadPaddingException
getName
public java.lang.String getName()
- Specified by:
getName
in interface ForeignKey
- Returns:
- Returns the name.
getType
public java.lang.String getType()
- Specified by:
getType
in interface ForeignKey
- Returns:
- Returns the type.
getDate
public java.util.Date getDate()
- Specified by:
getDate
in interface ForeignKey
- Returns:
- Returns the date.