Initialize Tizen 2.3
[framework/system/oma-dm-agent.git] / src / plugins / dm-private / dmacc-gcf / src / password_generator.c
1 /*
2  * oma-dm-agent
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Apache License, Version 2.0 (the License);
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17
18 #include <string.h>
19 #include <stdlib.h>
20 #include <ctype.h>
21 #include <glib.h>
22 #include <glib/gprintf.h>
23 #include <crypt.h>
24
25 /*sync-agent*/
26 #include <sync_agent.h>
27
28 #include "password_generator.h"
29
30 #ifndef OMADM_AGENT_LOG
31 #undef LOG_TAG
32 #define LOG_TAG "PLUGIN_DMACC_GCF"
33 #endif
34
35 #define MAX_LENGTH 32
36
37 /* general function */
38 // RSA -----------------------------------         gcf common - generate_password... 
39 char *generate_device_password(const char *imei_device_id, const char *server_id, generate_type type)
40 {
41
42         _EXTERN_FUNC_ENTER;
43
44         retvm_if((imei_device_id) == NULL, 0, "imei_device_id is NULL!!");
45         retvm_if((server_id) == NULL, 0, "server_id is NULL!!");
46
47         char *password = NULL;
48
49         _DEBUG_INFO("imei_device_id = %s, server_id = %s\n", imei_device_id, server_id);
50         password = g_strdup_printf("%s_pw", server_id);
51
52         //// password generate ///
53
54         //////////////////////////
55
56         _EXTERN_FUNC_EXIT;
57
58         return password;
59 }
60
61 /*
62 static void __print__array(char *array, int array_length, char *array_name)
63 {
64         _DEBUG_VERBOSE(" ====> Array Name : %s <===== \n", array_name);
65         int i;
66         for (i = 0; i < array_length; i++) {
67                 _DEBUG_VERBOSE("index[ %d] = %X, ", i, array[i]);
68                 if (i != 0 && 0 == (i % 8)) {
69                         _DEBUG_VERBOSE("\n");
70                 }
71         }
72         _DEBUG_VERBOSE("\n");
73 }
74 */