namespace Akenti class OpenSSLKeyImpl

This class wraps an ssl ENV_PKEY structure which it assumes contains a private and public RSA key pair

Inheritance:


Public Methods

OpenSSLKeyFactoryImpl ()
Construct this object
~OpenSSLKeyFactoryImpl ()
Delete this object
string getKeyEncoded (const string& format, const PublicKey& key) const
Encodes the key using a format specified by format
string getKeyEncoded (const string& format, const PrivateKey& key) const
Encodes the key using a format specified by format
PublicKey initPublicKey (const string& format, const string& type, const string& encoding) const
returns a PublicKey
PrivateKey initPrivateKey (const string& format, const string& encoding) const
returns a PrivateKey
KeyPair generateRSAKeyPair (int size, unsigned long exponent) const
Generates an RSA key pair
KeyPair generateDSAKeyPair (int size, const string& seed) const
Generates a DSA key pair
virtual ~OpenSSLKeyImpl ()
Destructor
string privateDecrypt (const string &encrypted) const
Uses the contained private RSA key to decrypt the input string
string privateEncrypt (const string &data) const
Uses the contained private RSA key to encrypt the input string
string publicDecrypt (const string &encrypted) const
Uses the contained public RSA key to decrypt the input string
string publicEncrypt (const string &data) const
Uses the contained public RSA key to encrypt the input string
int size () const
Returns ENV_PKey_size of the contained ENV_Pkey
string format () const
Returns DER
string algorithm () const
Returns RSA

Protected Methods

OpenSSLKeyImpl (EVP_PKEY *evp)
Constructor

Documentation

This class wraps an ssl ENV_PKEY structure which it assumes contains a private and public RSA key pair. It implements methods to use either the private or public key to encypt or decrypt an input string.
OpenSSLKeyFactoryImpl()
Construct this object

~OpenSSLKeyFactoryImpl()
Delete this object

string getKeyEncoded(const string& format, const PublicKey& key) const
Encodes the key using a format specified by format.
Throws:
Error if key is unitialized or unrecognized
SecurityException if format is unsupported or if the encoding fails
Returns:
encoding a string of bytes
Parameters:
format - string specifies the format to be used. Only DER for now.
key - PublicKey to be encoded
See Also:
PublicKey
PublicKeyImpl

string getKeyEncoded(const string& format, const PrivateKey& key) const
Encodes the key using a format specified by format.
Throws:
Error if key is uninitialized or unrecognized
SecurityException if format is unsupported or if the encoding fails
Returns:
encoding a string of bytes
Parameters:
format - string specifies the format to be used. Only DER for now.
key - PrivateKey to be encoded
See Also:
PrivateKey
PrivateKeyImpl

PublicKey initPublicKey(const string& format, const string& type, const string& encoding) const
returns a PublicKey. The format specifies which format was used to encode the key (must be DER for now). The type specifies the kind of key we are decoding. Examples of types are DSA and RSA.
Throws:
SecurityException if either format or type is unsupported or if decoding fails
Returns:
a public key
Parameters:
format - string specifies the format used for encoding
type - the key's type
encoding - a string of bytes
See Also:
PublicKey
PublicKeyImpl

PrivateKey initPrivateKey(const string& format, const string& encoding) const
returns a PrivateKey. The format specifies which format was used to encode the key ( must be DER for now ) . The type specifies the kind of key we are decoding. Examples of types are DSA and RSA.
Throws:
SecurityException if either format or type is unsupported or if decoding fails
Returns:
a public key
Parameters:
format - string specifies the format used for encoding
type - the key's type
encoding - a string of bytes
See Also:
PrivateKey
PrivateKeyImpl

KeyPair generateRSAKeyPair(int size, unsigned long exponent) const
Generates an RSA key pair.
Throws:
SecurityException if genaration fails
Returns:
a KeyPair
Parameters:
size - int modulo in bytes (power of 2)
size - int exponent a prime number
See Also:
KeyPair
PrivateKey
PrivateKeyImpl
PublicKey
PublicImpl

KeyPair generateDSAKeyPair(int size, const string& seed) const
Generates a DSA key pair.
Throws:
SecurityException if genaration fails
Returns:
a KeyPair
Parameters:
size - int size of key in bytes
size - string used to seed the genrator
See Also:
KeyPair
PrivateKey
PrivateKeyImpl
PublicKey
PublicImpl

virtual ~OpenSSLKeyImpl()
Destructor

string privateDecrypt(const string &encrypted) const
Uses the contained private RSA key to decrypt the input string.
Returns:
s the decyrpted sting. @throw SecurityException OpenSSLRSAPrivateKeyImpl: decryption failure
Parameters:
string - encrypted the data to be decrypted.

string privateEncrypt(const string &data) const
Uses the contained private RSA key to encrypt the input string.
Returns:
s the encyrpted sting. @throw SecurityException OpenSSLRSAPrivateKeyImpl: encryption failure
Parameters:
string - data the data to be encrypted.

string publicDecrypt(const string &encrypted) const
Uses the contained public RSA key to decrypt the input string.
Returns:
s the decyrpted sting. @throw SecurityException OpenSSLRSAPublicKeyImpl: decryption failure
Parameters:
string - encrypted the data to be decrypted.

string publicEncrypt(const string &data) const
Uses the contained public RSA key to encrypt the input string.
Returns:
s the encyrpted sting. @throw SecurityException OpenSSLRSAPublicKeyImpl: encryption failure
Parameters:
string - data the data to be encrypted.

int size() const
Returns ENV_PKey_size of the contained ENV_Pkey

string format() const
Returns DER

string algorithm() const
Returns RSA

OpenSSLKeyImpl(EVP_PKEY *evp)
Constructor


This class has no child classes.
Author:
Srilekha Mudumbai Abdelilah Essiari
Version:
1.1 00/05/01

alphabetic index hierarchy of classes


this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de