namespace Akenti class KeyPair

This class is a simple holder for a key pair, a public key and a private key

Public Methods

virtual ~KeyFactoryImpl ()
Deletes this object
virtual string getKeyEncoded (const string& format, const PublicKey &key) const
Encodes the public key using a format specified by format
virtual PublicKey initPublicKey (const string& format, const string& type, const string& encoding) const
Returns a PublicKey
virtual string getKeyEncoded (const string& format, const PrivateKey &key) const
Encodes the private key using a format specified by format (only DER for now)
virtual PrivateKey initPrivateKey (const string& format, const string& encoding) const
Returns a PrivateKey
virtual PrivateKey initPrivateKeyFromFile (const string& format, const string& fileName) const
Initiliazes the PrivateKey from a file
virtual KeyPair generateRSAKeyPair (int size = 64, unsigned long exponent = 3) const
Generates an RSA key pair
virtual KeyPair generateDSAKeyPair (int size = 64, const string& seed = "") const
Generates a DSA key pair
KeyPair ()
Default Constructor
KeyPair (const PublicKey &publicKey, const PrivateKey &privateKey)
Constructs a key pair given a public key and a private key
~KeyPair ()
Destroys this object
const PrivateKey& getPrivateKey () const
Returns a reference to the private key component of this key pair
const PublicKey& getPublicKey () const
Returns a reference to the public key component of this key pair
string paramString () const
Returns a string representation of this key pair for debugging purposes

Protected Methods

KeyFactoryImpl ()
Constructs this object

Documentation

This class is a simple holder for a key pair, a public key and a private key. It does not enforce any security and, when initialized, should be treated like a private key.
virtual ~KeyFactoryImpl()
Deletes this object

virtual string getKeyEncoded(const string& format, const PublicKey &key) const
Encodes the public key using a format specified by format. The recognized format values depend on the concrete KeyFactoryImpl that is being used. The OpenSSLKeyFactoryImpl currently only supports DER encoding.
Throws:
Error if key is unitialized or unrecognized
SecurityException if format is unsupported or if the encoding fails
Returns:
encoded key as a string
Parameters:
format - string specifies the format to be used
key - PublicKey to be encoded
See Also:
PublicKey
PublicKeyImpl

virtual 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 (currently DER). 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

virtual string getKeyEncoded(const string& format, const PrivateKey &key) const
Encodes the private key using a format specified by format (only DER for now).
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
key - PrivateKey to be encoded
See Also:
PrivateKey
PrivateKeyImpl

virtual PrivateKey initPrivateKey(const string& format, const string& encoding) const
Returns a PrivateKey. The format specifies which format was used to encode the key, DER for nown. 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 private key
Parameters:
format - string specifies the format used for encding
type - the key's type
encoding - a string of bytes
See Also:
PrivateKey
PrivateKeyImpl

virtual PrivateKey initPrivateKeyFromFile(const string& format, const string& fileName) const
Initiliazes the PrivateKey from a file.
Returns:
the Private Key that is initialized from the file
Parameters:
format - specified format of the key, the format currently being supported is PEM
fileName - name of the file that contains the private key

virtual KeyPair generateRSAKeyPair(int size = 64, unsigned long exponent = 3) const
Generates an RSA key pair.
Throws:
SecurityException if generation 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

virtual KeyPair generateDSAKeyPair(int size = 64, const string& seed = "") const
Generates a DSA key pair.
Throws:
SecurityException if generation 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

KeyFactoryImpl()
Constructs this object

KeyPair()
Default Constructor

KeyPair(const PublicKey &publicKey, const PrivateKey &privateKey)
Constructs a key pair given a public key and a private key.
Throws:
Error if eithey key is uninitialized
Parameters:
publicKey - the public key.
privateKey - the private key.
See Also:
PublicKey
PrivateKey

~KeyPair()
Destroys this object.
See Also:
ref_ptr
PublicKey
PrivateKey

const PrivateKey& getPrivateKey() const
Returns a reference to the private key component of this key pair.
Throws:
Error if key pair is uninitialzed
Returns:
a reference to the private key
See Also:
PrivateKey

const PublicKey& getPublicKey() const
Returns a reference to the public key component of this key pair.
Throws:
Error if key pair is uninitialzed
Returns:
a reference to the public key
See Also:
PublicKey

string paramString() const
Returns a string representation of this key pair for debugging purposes.
Throws:
Error if one of the keys is uninitialized
Returns:
debugging info


This class has no child classes.
Author:
Srilekha Mudumbai Abdelilah Essiari
Version:
1.1 00/05/01
See Also:
PublicKey
PrivateKey
KeyFactory
generateRSAKeyPair(int, unsigned long)
generateDSAKeyPair(int, unsigned long)

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