Package g4ds :: Package algorithms :: Module rsaalgorithm :: Class AlgorithmImplementation
[show private | hide private]
[frames | no frames]

Class AlgorithmImplementation

AlgorithmInterface --+
                     |
                    AlgorithmImplementation


Algorithm implementation for G4DS for the RSA algorithm.
Method Summary
  __init__(self)
Call super constructor and initialise with name.
  createKeyPair(self, bitlength)
Creates a key pair for the algorithm.
String decrypt(self, ciphertext, keyst)
Decrypts the ciphertext.
String encrypt(self, plaintext, keyst)
Encrypts the plain text.
  getPublicKey(self, privateKeySt)
Returns the public part of the key pair.
  setKeyPair(self, key)
Loads the private key to be used for later decryptions.
String signMessage(self, message, keyst)
Provides a signature for the given message.
Boolean validate(self, message, signature, keyst)
Verifies, whether the exactly this message has been signed with the corresponding private key for this public key.
Inherited from AlgorithmInterface: getName

Method Details

__init__(self)
(Constructor)

Call super constructor and initialise with name.
Overrides:
g4ds.algorithms.algorithminterface.AlgorithmInterface.__init__

createKeyPair(self, bitlength=None)

Creates a key pair for the algorithm.
Overrides:
g4ds.algorithms.algorithminterface.AlgorithmInterface.createKeyPair

decrypt(self, ciphertext, keyst=None)

Decrypts the ciphertext.
Parameters:
ciphertext - RSA encrypted message
           (type=String)
keyst - (Private) key to be used. If none given, the key loaded will be used
           (type=String)
Returns:
The Plain Text
           (type=String)
Overrides:
g4ds.algorithms.algorithminterface.AlgorithmInterface.decrypt

encrypt(self, plaintext, keyst)

Encrypts the plain text.
Parameters:
plaintext - String to be encrypted
           (type=String)
keyst - Key to use for encryption (should be the public key of the receiver) - in PyCrypto Format!
           (type=String)
Returns:
The corresponding cipher text
           (type=String)
Overrides:
g4ds.algorithms.algorithminterface.AlgorithmInterface.encrypt

getPublicKey(self, privateKeySt=None)

Returns the public part of the key pair.
Overrides:
g4ds.algorithms.algorithminterface.AlgorithmInterface.getPublicKey

setKeyPair(self, key)

Loads the private key to be used for later decryptions.
Overrides:
g4ds.algorithms.algorithminterface.AlgorithmInterface.setKeyPair

Note: Due to the use of the pycrypto / exPyCrypto site packages the keys have to be in a certain format. This way, they have to be generated with exPyCrypto in the first place.

signMessage(self, message, keyst=None)

Provides a signature for the given message.
Parameters:
message - Message to be signed (usually plain text)
           (type=String)
keyst - Private key to use for signing - if none given, the one stored in the instance will be used
           (type=String)
Returns:
Corresponding Signature
           (type=String)
Overrides:
g4ds.algorithms.algorithminterface.AlgorithmInterface.signMessage

validate(self, message, signature, keyst)

Verifies, whether the exactly this message has been signed with the corresponding private key for this public key.
Parameters:
message - Message, which was signed (usually plain text)
           (type=String)
signature - Signature, which was created for this message
           (type=String)
keyst - Public key - the corresponding private key must have been used for signing the message
           (type=String)
Returns:
True, if this message has produced exactly this signature if the corresponding private key was used, otherwise false
           (type=Boolean)
Overrides:
g4ds.algorithms.algorithminterface.AlgorithmInterface.validate

Generated by Epydoc 2.0 on Sat Oct 22 22:52:46 2005 http://epydoc.sf.net