Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions

zeus::TRSACrypter Class Reference

#include <RSACrypter.h>

Inheritance diagram for zeus::TRSACrypter:
zeus::TZObject zeus::IZUnknown

List of all members.

Public Member Functions

 TRSACrypter ()
Retval decode (const TypePrivateRSAKey &rKey, const IByteArray &rInput, IByteArray &rOutput)
Retval encode (const TypePublicRSAKey &rKey, const IByteArray &rInput, IByteArray &rOutput)
Retval sign (const TypePrivateRSAKey &rKey, const IByteArray &rInput, IByteArray &rOutput)
Retval verify (const TypePublicRSAKey &rKey, const IByteArray &rInput, IByteArray &rOutput)

Static Public Member Functions

static void generateComponents (const Int1024 &ri1024P, const Int1024 &ri1024Q, const Int1024 &ri1024E, TypePublicRSAKey &rPublicKey, TypePrivateRSAKey &rPrivateKey)

Protected Types

enum  EPaddingMethod {
  etNone = 0, etPKCS7 = 1, etZeros = 2, etANSIX923 = 3,
  etISO10126 = 4
}

Protected Member Functions

Int1024 encode_CRT (const TypePrivateRSAKey &rKey, const Int1024 &ri1024Base) const

Detailed Description

The class implements the encryption and decryption using the RSA algorithm. The RSA uses a public and private key for encryption.


Member Enumeration Documentation

Padding methods

Enumerator:
etNone 

no padding

etPKCS7 

The PKCS #7 padding string consists of a sequence of bytes, each of which is equal to the total number of padding bytes added.

etZeros 

The padding string consists of bytes set to zero

etANSIX923 

The ANSIX923 padding string consists of a sequence of bytes filled with zeros before the length.

etISO10126 

The ISO10126 padding string consists of random data before the length.


Constructor & Destructor Documentation

TRSACrypter::TRSACrypter (  )

Creates a RSA crypter


Member Function Documentation

Retval TRSACrypter::decode ( const TypePrivateRSAKey rKey,
const IByteArray rInput,
IByteArray rOutput 
)

decodes the data using the private key

Retval TRSACrypter::encode ( const TypePublicRSAKey rKey,
const IByteArray rInput,
IByteArray rOutput 
)

encodes data with the public key

Int1024 TRSACrypter::encode_CRT ( const TypePrivateRSAKey rKey,
const Int1024 ri1024Base 
) const [protected]

encodes the data using the private key. The Chinese Remainder Theorem (CRT) is used to calculate the clear text (or signing the message)

Parameters:
rKey: private key
rBase: base value
Returns:
decoded value
void TRSACrypter::generateComponents ( const Int1024 ri1024_P,
const Int1024 ri1024_Q,
const Int1024 ri1024_E,
TypePublicRSAKey rPublicKey,
TypePrivateRSAKey rPrivateKey 
) [static]

Generates the keys

Retval TRSACrypter::sign ( const TypePrivateRSAKey rKey,
const IByteArray rInput,
IByteArray rOutput 
)

signing the data using the private key

Retval TRSACrypter::verify ( const TypePublicRSAKey rKey,
const IByteArray rInput,
IByteArray rOutput 
)

verifies the data using the public key


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


Written by Benjamin Hadorn http://www.xatlantis.ch.
Last change made on Sun Jan 22 2012 15:28:32