SMSLib 3.5.3

org.smslib.crypto
Class ASymmetricKey

java.lang.Object
  extended by org.smslib.crypto.AKey
      extended by org.smslib.crypto.ASymmetricKey
Direct Known Subclasses:
AESKey

public abstract class ASymmetricKey
extends AKey

Abstract class representing an encryption key of a symmetric encryption algorithm.


Constructor Summary
ASymmetricKey()
           
 
Method Summary
abstract  byte[] decrypt(byte[] message)
          Message decryption.
abstract  byte[] encrypt(byte[] message)
          Message encryption.
abstract  javax.crypto.spec.SecretKeySpec generateKey()
          Key generation.
 javax.crypto.spec.SecretKeySpec getKey()
          Returns the encryption key.
 void setKey(javax.crypto.spec.SecretKeySpec key)
          Sets the encryption key.
 
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

ASymmetricKey

public ASymmetricKey()
Method Detail

getKey

public javax.crypto.spec.SecretKeySpec getKey()
Returns the encryption key.

Returns:
The encryption key.

setKey

public void setKey(javax.crypto.spec.SecretKeySpec key)
Sets the encryption key.

Parameters:
key - The encryption key.

generateKey

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

Returns:
The generated encryption key.
Throws:
java.security.NoSuchAlgorithmException

encrypt

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

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 abstract byte[] decrypt(byte[] message)
                        throws java.security.NoSuchAlgorithmException,
                               javax.crypto.NoSuchPaddingException,
                               javax.crypto.BadPaddingException,
                               javax.crypto.IllegalBlockSizeException,
                               java.security.InvalidKeyException
Message decryption.
The method should be implemented in the descending classes, according to the implementation.

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

SMSLib 3.5.3

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