Rudiments
|
Inherits securitycontext.
Public Member Functions | |
gsscontext () | |
virtual | ~gsscontext () |
void | setCredentials (gsscredentials *credentials) |
gsscredentials * | getCredentials () |
void | setFileDescriptor (filedescriptor *fd) |
filedescriptor * | getFileDescriptor () |
void | setDesiredLifetime (uint32_t desiredlifetime) |
uint32_t | getDesiredLifetime () |
void | setDesiredMechanism (gssmechanism *desiredmechanism) |
gssmechanism * | getDesiredMechanism () |
void | setDesiredFlags (uint32_t desiredflags) |
void | setDesiredFlags (const char *desiredflags) |
uint32_t | getDesiredFlags () |
void | setService (const char *service) |
const char * | getService () |
bool | connect () |
bool | accept () |
uint32_t | getActualLifetime () |
gssmechanism * | getActualMechanism () |
uint32_t | getActualFlags () |
uint32_t | getRemainingLifetime () |
const char * | getInitiator () |
const char * | getAcceptor () |
bool | isInitiator () |
bool | isOpen () |
bool | wrap (const byte_t *input, size_t inputsize, byte_t **output, size_t *outputsize) |
bool | wrap (const byte_t *input, size_t inputsize, bool useencryption, byte_t **output, size_t *outputsize, bool *encryptionused) |
bool | unwrap (const byte_t *input, size_t inputsize, byte_t **output, size_t *outputsize) |
bool | unwrap (const byte_t *input, size_t inputsize, byte_t **output, size_t *outputsize, bool *decryptionused) |
bool | getMic (const byte_t *message, size_t messagesize, byte_t **mic, size_t *micsize) |
bool | verifyMic (const byte_t *message, size_t messagesize, const byte_t *mic, size_t micsize) |
ssize_t | read (void *buf, size_t size) |
ssize_t | write (const void *buf, size_t size) |
size_t | getPendingSize () |
bool | close () |
size_t | getSizeMax () |
uint32_t | getMajorStatus () |
uint32_t | getMinorStatus () |
const char * | getStatus () |
const char * | getGSSMajorStatus () |
const char * | getGSSMinorStatus () |
const char * | getMechanismMajorStatus () |
const char * | getMechanismMinorStatus () |
Public Member Functions inherited from object | |
virtual | ~object () |
The gsscontext class implements the securitycontext interface for GSS (Generic Security Services API/Kerberos).
gsscontext::gsscontext | ( | ) |
Creates an instance of the gsscontext class.
|
virtual |
Deletes this instance of the gsscontext class.
bool gsscontext::accept | ( | ) |
Accepts a security context from the client with whom a connection is already established across the filedescriptor previously set using setFileDescriptor().
Note that if this instance is set as the current GSS context of a child of the socketserver class, then this method is called implicitly during a successful call to accept().
Returns true on success and false on failure.
bool gsscontext::close | ( | ) |
bool gsscontext::connect | ( | ) |
Initiates a security context with the server with whom a connection is already established across the filedescriptor previously set using setFileDescriptor().
Note that if this instance is set as the current security context of a child of the socketclient class, then this method is called implicitly during a successful call to connect().
Returns true on success and false on failure.
const char* gsscontext::getAcceptor | ( | ) |
Returns the name of the principal who accepted this context.
uint32_t gsscontext::getActualFlags | ( | ) |
uint32_t gsscontext::getActualLifetime | ( | ) |
gssmechanism* gsscontext::getActualMechanism | ( | ) |
gsscredentials* gsscontext::getCredentials | ( | ) |
Returns the credentials set by a previous call to setCredentials() or NULL if no credentials have been set.
uint32_t gsscontext::getDesiredFlags | ( | ) |
Returns the context-flags set by a previous call to setDesiredFlags() or 0 if no flags have been set.
uint32_t gsscontext::getDesiredLifetime | ( | ) |
Returns the desired context-lifetime set by a previous call to setDesiredLifetime() or the largest 32-bit integer (indicating an indefinite lifetime, the default) if no desired context-lifetime has been set.
gssmechanism* gsscontext::getDesiredMechanism | ( | ) |
Returns the security mechanism set by a previous call to setDesiredMechanism() or NULL if no security mechanism has been set.
|
virtual |
Returns the filedscriptor by a previous call to setFileDescriptor() or NULL if no filedescriptor has been set.
Implements socketlayer.
const char* gsscontext::getGSSMajorStatus | ( | ) |
Returns the GSS major status string of the most recently failed call.
const char* gsscontext::getGSSMinorStatus | ( | ) |
Returns the GSS minor status string of the most recently failed call.
const char* gsscontext::getInitiator | ( | ) |
Returns the name of the principal who initiated this context.
uint32_t gsscontext::getMajorStatus | ( | ) |
Returns the major-status code of the most recently failed call.
const char* gsscontext::getMechanismMajorStatus | ( | ) |
Returns the mechanism major status string of the most recently failed call.
const char* gsscontext::getMechanismMinorStatus | ( | ) |
Returns the mechanism minor status string of the most recently failed call.
bool gsscontext::getMic | ( | const byte_t * | message, |
size_t | messagesize, | ||
byte_t ** | mic, | ||
size_t * | micsize | ||
) |
Generates a mechanism integrity code for "message" of "messagesize" bytes, allocates a buffer internally to store the code, returns a pointer the buffer in "mic", and returns the number of bytes of the buffer in "micsize". Returns true on success and false on failure.
uint32_t gsscontext::getMinorStatus | ( | ) |
Returns the minor-status code of the most recently failed call.
size_t gsscontext::getPendingSize | ( | ) |
Returns the number of bytes that are buffered and available for immediate read.
uint32_t gsscontext::getRemainingLifetime | ( | ) |
Returns the remaining lifetime of the context.
const char* gsscontext::getService | ( | ) |
Returns the service that will be requested during subsequent calls to connect().
size_t gsscontext::getSizeMax | ( | ) |
const char* gsscontext::getStatus | ( | ) |
Returns the status string of the most recently failed call.
bool gsscontext::isInitiator | ( | ) |
Returns true if the calling process was the initator of this context and false if it was not.
bool gsscontext::isOpen | ( | ) |
Returns true if the context has been initiated or accepted and false otherwise.
ssize_t gsscontext::read | ( | void * | buf, |
size_t | size | ||
) |
Reads tokens from the file descriptor previously configured by setFileDescriptor(), unwraps them, and writes the unwrapped data to "buf" until "size" bytes have been read. Returns the number of unwrapped bytes that were written to "buf" or RESULT_ERROR if an error occurred.
void gsscontext::setCredentials | ( | gsscredentials * | credentials | ) |
void gsscontext::setDesiredFlags | ( | const char * | desiredflags | ) |
void gsscontext::setDesiredFlags | ( | uint32_t | desiredflags | ) |
void gsscontext::setDesiredLifetime | ( | uint32_t | desiredlifetime | ) |
void gsscontext::setDesiredMechanism | ( | gssmechanism * | desiredmechanism | ) |
|
virtual |
Sets the filedescriptor that will be used during subsequent calls to connect() or accept().
Note that if this instance is set as the current GSS context of a child of the socketclient class, then this method is called implicitly during a successful call to connect().
Note also that if this instance is set as the current GSS context of a child of the socketserver class, then this method is called implicitly during a successful call to accept().
Implements socketlayer.
void gsscontext::setService | ( | const char * | service | ) |
Sets the service that will be requested during subsequent calls to connect().
bool gsscontext::unwrap | ( | const byte_t * | input, |
size_t | inputsize, | ||
byte_t ** | output, | ||
size_t * | outputsize | ||
) |
Unwraps "input" data of "inputsize" bytes, allocates a buffer internally to store the unwrapped data, returns a pointer the buffer in "output", and returns the number of bytes of the buffer in "outputsize". Returns true on success and false on failure.
bool gsscontext::unwrap | ( | const byte_t * | input, |
size_t | inputsize, | ||
byte_t ** | output, | ||
size_t * | outputsize, | ||
bool * | decryptionused | ||
) |
Unwraps "input" data of "inputsize" bytes, allocates a buffer internally to store the unwrapped data, returns a pointer the buffer in "output", and returns the number of bytes of the buffer in "outputsize". Returns whether decryption was performed or not in "decryptionused". Returns true on success and false on failure.
bool gsscontext::verifyMic | ( | const byte_t * | message, |
size_t | messagesize, | ||
const byte_t * | mic, | ||
size_t | micsize | ||
) |
Performs a mechanism integrity code for "message" of "messagesize" bytes and compares it to the data in "mic" of "micsize" bytes. Returns true if they match and false otherwise.
bool gsscontext::wrap | ( | const byte_t * | input, |
size_t | inputsize, | ||
bool | useencryption, | ||
byte_t ** | output, | ||
size_t * | outputsize, | ||
bool * | encryptionused | ||
) |
Wraps "input" data of "inputsize" bytes, allocates a buffer internally to store the wrapped data, returns a pointer the buffer in "output", and returns the number of bytes of the buffer in "outputsize". Attempts to encrypt the data if "useencryption" is set to true. Returns whether encryption was performed or not in "encryptionused". Returns true on success and false on failure.
bool gsscontext::wrap | ( | const byte_t * | input, |
size_t | inputsize, | ||
byte_t ** | output, | ||
size_t * | outputsize | ||
) |
Wraps "input" data of "inputsize" bytes, allocates a buffer internally to store the wrapped data, returns a pointer the buffer in "output", and returns the number of bytes of the buffer in "outputsize". Returns true on success and false on failure.
ssize_t gsscontext::write | ( | const void * | buf, |
size_t | size | ||
) |
Wraps "size" bytes from "buf" and writes them to the file descriptor previously configured by setFileDescriptor(). Returns the number of unwrapped bytes that were written or RESULT_ERROR if an error occurred.