class HCSslComm

utiltity class to use openssl

Public Methods

[more]int StartSsl()
initialize openssl library.
[more]int StopSsl()
finanlize openssl library.
[more]int ClientStartSsl()
establish SSL resources for being run by SSL client,
[more]int ClientStopSsl()
release SSL resource for SSL client.
[more]int ServerStartSsl( char* szCertFileName, char* szKeyFileName )
establish SSL resources for being run by SSL server.
[more]int ServerStopSsl()
release resource for SSL server.
[more]SSL* ClientConnectSsl( SOCKET iFd )
connect SSL server.
[more]int ClientCloseSsl( SSL* ssl )
close SSL connection with SSL server.
[more]SSL* ServerAcceptSsl( SOCKET iFd )
accept SSL connection.
[more]int ServerCloseSsl( SSL* ssl )
close SSL connection for SSL client.
[more]int SendSsl( SSL* ssl, const char* szBuf, int iBufLen )
send data with SSL protocol.
[more]int RecvSsl( SSL* ssl, char* szBuf, int iBufLen, int iSecond )
receive data with SSL protocol
[more]char* GetErrorMessage()
return error message.
[more]int EncryptString( char* szUserKey, char* szInput, char* szOutput, int iOutputLen )
encrypt string
[more]int DecryptString( char* szUserKey, char* szInput, char* szOutput, int iOutputLen )
decrypt encrytpion string.
[more]unsigned char* GetMessageDigest( char* szAlgorithm, char* szBuf, unsigned int iLen, int* iReturnLen )
Return HASH value about inputed string.


Documentation

utiltity class to use openssl
oint StartSsl()
initialize openssl library.

Returns:
if success, return 0. if already intialize, return 1. otherwise return -1. if you want to read error message, see m_szErrorMessage variable.

oint StopSsl()
finanlize openssl library.

Returns:
if success, return 0. otherwise return -1. if you want to read error message, see m_szErrorMessage variable.

oint ClientStartSsl()
establish SSL resources for being run by SSL client,

Returns:
if success, return 0. otherwise return -1.
Author:
Yee Young Han

oint ClientStopSsl()
release SSL resource for SSL client.

Returns:
if success, return 0. otherwise return -1.
Author:
Yee Young Han

oint ServerStartSsl( char* szCertFileName, char* szKeyFileName )
establish SSL resources for being run by SSL server.

Parameters:
szCertFileName - cert file name - full path name
szKeyFileName - key file name - full path name
Returns:
if success, return 0. otherwise return -1.
Author:
Yee Young Han

oint ServerStopSsl()
release resource for SSL server.

Returns:
if success, return 0. otherwise return -1.
Author:
Yee Young Han

oSSL* ClientConnectSsl( SOCKET iFd )
connect SSL server.

Parameters:
iFd - socket descriptor
Returns:
if success, return SSL struct pointer. otherwise return NULL.
Author:
Yee Young Han

oint ClientCloseSsl( SSL* ssl )
close SSL connection with SSL server.

Parameters:
ssl - SSL struct
Returns:
if success, return 0. otherwise return -1.
Author:
Yee Young Han

oSSL* ServerAcceptSsl( SOCKET iFd )
accept SSL connection.

Parameters:
iFd - ¼ÒÄÏ ÇÚµé
Returns:
if success, return SSL struct pointer. otherwise return NULL.
Author:
Yee Young Han

oint ServerCloseSsl( SSL* ssl )
close SSL connection for SSL client.

Returns:
if success, return 0. otherwise return -1.
Author:
Yee Young Han

oint SendSsl( SSL* ssl, const char* szBuf, int iBufLen )
send data with SSL protocol.

This function is wrapper function of SSL_write and Until transmit all data, attempt transmission.

Parameters:
ssl - SSL struct
szBuf - buffer for sending
iBufLen - buffer size
Returns:
if success, return sending counf. otherwise return -1.
Author:
Yee Young Han

oint RecvSsl( SSL* ssl, char* szBuf, int iBufLen, int iSecond )
receive data with SSL protocol

Parameters:
ssl - SSL struct
szBuf - buffer for receving
iBufLen - size of buffer
iSecond - If data is not received in reception latency time-this time, return reception error.
Returns:
return size of receiving data.
Author:
Yee Young Han

ochar* GetErrorMessage()
return error message.

Returns:
error message

oint EncryptString( char* szUserKey, char* szInput, char* szOutput, int iOutputLen )
encrypt string

Parameters:
szUserKey - [in] password for encryption
szInput - [in] plain text
szOutput - [out] encryption string
iOutputLen - [in] size of szOutput
Returns:
if success, return 0. otherwise return -1.

oint DecryptString( char* szUserKey, char* szInput, char* szOutput, int iOutputLen )
decrypt encrytpion string.

Parameters:
szUserKey - [in] password for decryption
szInput - [in] encryption string
szOutput - [out] plain string
iOutputLen - [in] size of szOutput
Returns:
if success, return 0. otherwise return -1.

ounsigned char* GetMessageDigest( char* szAlgorithm, char* szBuf, unsigned int iLen, int* iReturnLen )
Return HASH value about inputed string.

String that is returned through this function must release by user.

Parameters:
szAlgorithm - [in] hash algorithm
szBuf - [in] string to convert HASH
iLen - [in] length of szBuf
iReturnLen - [in] length of return string
Returns:
if success, return Hash string. otherwise return NULL.


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.