News SF.net Project Frequently Asked Questions Documentation Downloads Mailing Lists How to Contribute

SourceForge.net Logo

Changing the way games are made and played.

TNL::Certificate class Reference

TNL::Certificate Class Reference

#include <tnlCertificate.h>

Inheritance diagram for TNL::Certificate:

TNL::ByteBuffer TNL::Object

Detailed Description

The Certificate class manages a digitally signed certificate.

Certificates consist of an application-defined payload, a public key, and a signature. It is up to the application to determine from the payload what, if any, certificate authority (CA) signed the certificate. The validate() method can be used to check the certificate's authenticity against the known public key of the signing Certificate Authority.

The payload could include such items as:

  • The valid date range for the certificate
  • The domain of the certificate holder
  • The identifying name of the Certificate Authority
  • A player's name and user id for a multiplayer game


Public Types

enum  { MaxPayloadSize = 512 }

Public Member Functions

 Certificate (U8 *dataPtr, U32 dataSize)
 Certificate constructor.

 Certificate (const ByteBuffer &buffer)
 Certificate (BitStream *stream)
 Certificate (const ByteBuffer &payload, RefPtr< AsymmetricKey > publicKey, RefPtr< AsymmetricKey > theCAPrivateKey)
void parse ()
 Parses this certificate into the payload, public key, identiy, certificate authority and signature.

bool isValid ()
 returns the validity of the certificate's formation

bool validate (RefPtr< AsymmetricKey > signatoryPublicKey)
 returns true if this certificate was signed by the private key corresponding to the passed public key.

RefPtr< AsymmetricKeygetPublicKey ()
 Returns the public key from the certificate.

ByteBufferPtr getPayload ()
 Returns the certificate payload.


Protected Attributes

RefPtr< AsymmetricKeymPublicKey
 The public key for the holder of this certificate.

ByteBufferPtr mPayload
 The certificate payload, including the identity of the holder and the Certificate Authority.

ByteBufferPtr mSignature
 The digital signature of this certificate by the signatory.

bool mIsValid
 flag to signify whether this certificate has a valid form

U32 mSignatureByteSize
 Number of bytes of the ByteBuffer signed by the CA.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
MaxPayloadSize 


Constructor & Destructor Documentation

TNL::Certificate::Certificate U8 dataPtr,
U32  dataSize
[inline]
 

Certificate constructor.

TNL::Certificate::Certificate const ByteBuffer buffer  )  [inline]
 

TNL::Certificate::Certificate BitStream stream  )  [inline]
 

TNL::Certificate::Certificate const ByteBuffer payload,
RefPtr< AsymmetricKey publicKey,
RefPtr< AsymmetricKey theCAPrivateKey
 


Member Function Documentation

void TNL::Certificate::parse  ) 
 

Parses this certificate into the payload, public key, identiy, certificate authority and signature.

bool TNL::Certificate::isValid  )  [inline]
 

returns the validity of the certificate's formation

bool TNL::Certificate::validate RefPtr< AsymmetricKey signatoryPublicKey  ) 
 

returns true if this certificate was signed by the private key corresponding to the passed public key.

RefPtr<AsymmetricKey> TNL::Certificate::getPublicKey  )  [inline]
 

Returns the public key from the certificate.

ByteBufferPtr TNL::Certificate::getPayload  )  [inline]
 

Returns the certificate payload.


Field Documentation

RefPtr<AsymmetricKey> TNL::Certificate::mPublicKey [protected]
 

The public key for the holder of this certificate.

ByteBufferPtr TNL::Certificate::mPayload [protected]
 

The certificate payload, including the identity of the holder and the Certificate Authority.

ByteBufferPtr TNL::Certificate::mSignature [protected]
 

The digital signature of this certificate by the signatory.

bool TNL::Certificate::mIsValid [protected]
 

flag to signify whether this certificate has a valid form

U32 TNL::Certificate::mSignatureByteSize [protected]
 

Number of bytes of the ByteBuffer signed by the CA.