UniOTP Server APIs: Difference between revisions

From SecuTech Wiki
Jump to navigationJump to search
Line 24: Line 24:
<p>
<p>
'''Operation procedure'''<br>
'''Operation procedure'''<br>
1.  Use the API secuotp_initenv(char *pszConfpath) to initialize the SDK Settings information. <br>
1.  Use the API secuotp_initenv(char *pszConfpath) to initialize the SDK Settings information. <br><br>
2.  Use other interface to complete business related treatments.  
2.  Use other interface to complete business related treatments. <br><br> 
3.  Use Secuotp_cleanup()API to perform maintenance operations such as releasing resources. <br>
3.  Use Secuotp_cleanup()API to perform maintenance operations such as releasing resources. <br><br>
For more details about other interfaces way of use, please see the sample.<br>  
For more details about other interfaces way of use, please see the sample.<br>  
</p>
</p>
<br>
<p>
<p>
'''Important points'''<br><br>
'''Important points'''<br>
1.  The function  secuotp_initenv(char *pszConfpath)  is used to initialize settings information, when using the SDK, you only need to call the function once. <br><br>
1.  The function  secuotp_initenv(char *pszConfpath)  is used to initialize settings information, when using the SDK, you only need to call the function once. <br><br>
2.  Once you finish using UniOTP SDK, call the secuotp_cleanup() function to perform cleaning operations. <br><br>
2.  Once you finish using UniOTP SDK, call the secuotp_cleanup() function to perform cleaning operations. <br><br>

Revision as of 14:50, 18 April 2012

How to use C/C++

Preparation

1. The SDK server needs to operate a database. Inside the C/C++ version SDK uses ODBC to access to the database. That’s why, before beginning to develop, it is required to install a database(for now, UniOTP supports Oracle/MySQL/Postgresql/SQL Server) and to configure the ODBC driver for database products access.

2. In the distributable package, you can find a file named initsqlscript that contains the SQL initialization script for the 4 types of database described before. You must use your database administration tool (for example SQLPlus, MySQL Client, etc.) to create a new database, or you can use one of your own databases. Use the SQL file inside the folder initsqlscript to initialize the database tables for UniOTP for UniOTP dynamic password authentication system.

3. Once you finish preparing the database, create an ODBC data source for this newly created database.(Use the database prepared in step 2).

4. Before beginning developing using the SDK, you need to create a configuration file (use the file otp_conf.com as an example) You just need to use the configuration file created in step 2 to reconfigure the information related to the settings file. Use the function secuinitenv(char *pszConfpath) to add settings file (such as otp_conf.con) and to complete initialization of information in the SDK.

Add support for UniOTP dynamic password authentication

1. Add the Server SDK library files (dynamic or static library) and its header files (otp_corec32.h) to the project.

2. Copy the database configuration file created in the “preparation” part step 4 to the appropriate place in your project.( you can actually put the configuration file anywhere , but it is recommended to put it in the project directory )

3. Use API introduced later in this document to perform operations related to authentication.

SDK Operation procedure and Important points

Operation procedure
1. Use the API secuotp_initenv(char *pszConfpath) to initialize the SDK Settings information.

2. Use other interface to complete business related treatments.

3. Use Secuotp_cleanup()API to perform maintenance operations such as releasing resources.

For more details about other interfaces way of use, please see the sample.


Important points
1. The function secuotp_initenv(char *pszConfpath) is used to initialize settings information, when using the SDK, you only need to call the function once.

2. Once you finish using UniOTP SDK, call the secuotp_cleanup() function to perform cleaning operations.

3. secuotp_tokenimport(char*pszTokenfile, char *pszSecret, char **pstrErrinfo) function is used to import token in batch , pstrErrinfo is assigned a value by the internal API. If you don’t need this memory area any longer, please use secuotp_free(void **spsbuf) to release it.

4. secuotp_userimport(char *pszUserfile, char *pszSecret, char **pstrErrinfo) this function is used to import users in batch , pstrErrinfo is assigned a value by the internal API. If you don’t need this memory area any longer , please use secuotp_free(void **spsbuf) to release it.

5. secuotp_userimport(char *pszUserfile, char *pszSecret, char **pstrErrinfo) this function is used to import users in batch, pszSecret points to the user record file decryption key, if pzSecret is NULL or the buffer data is null, then it shows the file isn't encrypted . We recommend not to use encryption.