SMSLib 3.5.3

org.smslib.crypto
Class AESKey

java.lang.Object
  extended by org.smslib.crypto.AKey
      extended by org.smslib.crypto.ASymmetricKey
          extended by org.smslib.crypto.AESKey

public class AESKey
extends ASymmetricKey

Class representing an AES algorithm encryption key. The class is based on standard JDK AES implementation (128 bit key).


Constructor Summary
AESKey()
           
AESKey(javax.crypto.spec.SecretKeySpec key)
           
 
Method Summary
 byte[] decrypt(byte[] message)
          Message decryption.
 byte[] encrypt(byte[] message)
          Message encryption.
 javax.crypto.spec.SecretKeySpec generateKey()
          Key generation.
static void main(java.lang.String[] args)
           
 
Methods inherited from class org.smslib.crypto.ASymmetricKey
getKey, setKey
 
Methods inherited from class org.smslib.crypto.AKey
asHex, asString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AESKey

public AESKey()
       throws java.security.NoSuchAlgorithmException
Throws:
java.security.NoSuchAlgorithmException

AESKey

public AESKey(javax.crypto.spec.SecretKeySpec key)
Method Detail

generateKey

public javax.crypto.spec.SecretKeySpec generateKey()
                                            throws java.security.NoSuchAlgorithmException
Description copied from class: ASymmetricKey
Key generation.
The method should be implemented in the descending classes, according to the implementation.

Specified by:
generateKey in class ASymmetricKey
Returns:
The generated encryption key.
Throws:
java.security.NoSuchAlgorithmException

encrypt

public byte[] encrypt(byte[] message)
               throws java.security.NoSuchAlgorithmException,
                      javax.crypto.NoSuchPaddingException,
                      javax.crypto.BadPaddingException,
                      javax.crypto.IllegalBlockSizeException,
                      java.security.InvalidKeyException
Description copied from class: ASymmetricKey
Message encryption.
The method should be implemented in the descending classes, according to the implementation.

Specified by:
encrypt in class ASymmetricKey
Parameters:
message - The message to be encrypted.
Returns:
The encrypted message.
Throws:
java.security.NoSuchAlgorithmException
javax.crypto.NoSuchPaddingException
javax.crypto.BadPaddingException
javax.crypto.IllegalBlockSizeException
java.security.InvalidKeyException

decrypt

public byte[] decrypt(byte[] message)
               throws java.security.NoSuchAlgorithmException,
                      javax.crypto.NoSuchPaddingException,
                      javax.crypto.BadPaddingException,
                      javax.crypto.IllegalBlockSizeException,
                      java.security.InvalidKeyException
Description copied from class: ASymmetricKey
Message decryption.
The method should be implemented in the descending classes, according to the implementation.

Specified by:
decrypt in class ASymmetricKey
Parameters:
message - The message to be decrypted.
Returns:
The decrypted message.
Throws:
java.security.NoSuchAlgorithmException
javax.crypto.NoSuchPaddingException
javax.crypto.BadPaddingException
javax.crypto.IllegalBlockSizeException
java.security.InvalidKeyException

main

public static void main(java.lang.String[] args)

SMSLib 3.5.3

(c) 2002-2011, http://smslib.org