OSDN Git Service

FOO master
authorYuji Konishi <yuji.k64613@gmail.com>
Tue, 9 Oct 2012 05:31:55 +0000 (14:31 +0900)
committerYuji Konishi <yuji.k64613@gmail.com>
Tue, 9 Oct 2012 05:31:55 +0000 (14:31 +0900)
workspace/EverMemo/src/com/yuji/em/utility/Encryption.java
workspace/EverMemo/src/com/yuji/em/utility/OAuthUtil.java

index ed95834..d80865b 100644 (file)
@@ -128,7 +128,8 @@ public class Encryption {
                        throws NoSuchAlgorithmException, InvalidKeySpecException {
                char[] password = generatePassword(context);
 
-               KeySpec keySpec = new PBEKeySpec(password, SALT, 1024, 256);
+               //KeySpec keySpec = new PBEKeySpec(password, SALT, 1024, 256);
+               KeySpec keySpec = new PBEKeySpec(password, SALT, 256, 64);
                SecretKeyFactory factory = SecretKeyFactory
                                .getInstance("PBEWITHSHAAND256BITAES-CBC-BC");
                SecretKey secretKey = factory.generateSecret(keySpec);
index 8a0e014..250de96 100644 (file)
@@ -13,7 +13,11 @@ import com.yuji.em.common.Constant;
 
 public class OAuthUtil {
        private static final String CONSUMER_KEY = "yuji-k64613";
-       private static final String CONSUMER_SECRET = "98b2cbf35f747d2d";
+       // TODO
+       // Debian
+       //private static final String CONSUMER_SECRET = "G5r7t1nHC+AIf6dYHuIVC7Jr/iVIMtgMZ0PObN6xV2Q=";
+       // Mac
+       private static final String CONSUMER_SECRET = "a/E89hlW9foWMh/ReopNucX+/WQ9WTs4YwvHP1cGH9s=" ;  
        private static final String APP_DATA_PATH = "/Android/data/com.yuji.em/temp/";
        private static final String EVERNOTE_HOST = "www.evernote.com";
 
@@ -21,6 +25,7 @@ public class OAuthUtil {
        private static final String APP_VERSION = "1.0.0";
 
        private static OAuthUtil instance = null;
+       private static String consumerSecret = null;
        private EvernoteSession session;
 
        public static OAuthUtil getInstance() {
@@ -35,8 +40,14 @@ public class OAuthUtil {
        }
 
        public EvernoteSession setupSession(Context context) {
+               if (consumerSecret == null){
+                       Encryption en = Encryption.getInstance();
+                       //String s = en.getEncrypted(context, "");
+                       consumerSecret = en.getDecrypted(context, CONSUMER_SECRET);
+               }
+               
                ApplicationInfo info = new ApplicationInfo(CONSUMER_KEY,
-                               CONSUMER_SECRET, EVERNOTE_HOST, APP_NAME, APP_VERSION);
+                               consumerSecret, EVERNOTE_HOST, APP_NAME, APP_VERSION);
 
                // Retrieve persisted authentication information
                session = new EvernoteSession(info,