1/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef GENERATEPASSWORD_H
18#define GENERATEPASSWORD_H
19
20#include "xpl_Types.h"
21
22class GeneratePassword
23{
24
25 public:
26
27  GeneratePassword();
28
29  ~GeneratePassword();
30
31  char * generateClientPasswordKey(const char * deviceId);
32
33  char * generateKeyFromDict(const char * deviceId, const char dict[]);
34
35  char * generateServerPasswordKey(const char * deviceId);
36
37  char * generateClientPassword(const char * deviceId, const char * serverId);
38
39  char * generateServerPassword(const char * deviceId, const char * serverId);
40
41  char * generateClientPassword();
42
43  char * generateServerPassword();
44
45  char * encodeDeviceId(const char * deviceId);
46
47  char * get36BasedNumber(const char * deviceId);
48
49  char * generatePassword(const char * deviceId, const char * serverId, const char * key);
50
51  char * encodeHex(const char data[]);
52
53  UINT64 convertchar2Long(const char * input);
54
55  void shuffle(char & buffer);
56
57  void setServerId(const char * sid);
58
59  void setIMEI(const char * did);
60
61  const char * getIMEI();
62
63  const char * getServerId();
64
65 private:
66
67  char * serverId;
68  char * imei;
69  static const char clientPasswordDict [15];
70  static const char serverPasswordDict[15];
71  static const char hexTable[16];
72};
73
74#endif
75