1. Romain Vernoux
  2. AES_Crypto

Commits

Romain Vernoux  committed 6bae7eb

Initial Commit

  • Participants
  • Branches default

Comments (0)

Files changed (84)

File .classpath

View file
  • Ignore whitespace
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="gen"/>
+	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

File .hgignore

  • Ignore whitespace
Empty file added.

File .project

View file
  • Ignore whitespace
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>AES Crypto</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.ApkBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

File AndroidManifest.xml

View file
  • Ignore whitespace
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+      package="com.android.crypto"
+      android:versionCode="1"
+      android:versionName="0.9 beta">
+      
+    <supports-screens android:smallScreens="false"
+                  android:normalScreens="true"
+                  android:largeScreens="true"
+                  android:anyDensity="false" />
+      
+    <application android:icon="@drawable/icon" android:label="@string/app_name" android:description="@string/app_description">
+        <activity android:name=".main"
+                  android:label="@string/app_name">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+       
+        <activity android:name=".EncryptorDisplay">
+        </activity>
+        
+        <activity android:name=".EncryptedDisplay">
+        </activity>
+        
+        <activity android:theme="@style/MyTheme"
+        		  android:name=".About">
+        </activity>  
+        
+        <activity android:theme="@style/MyTheme"
+        		  android:name=".main_info">
+        </activity>  
+        
+        <activity android:theme="@style/MyTheme"
+        		  android:name=".Begin">
+        </activity> 
+        
+        <activity android:theme="@style/MyTheme"
+        		  android:name=".Encryptordisplay_info">
+        </activity> 
+        
+        <activity android:theme="@style/MyTheme"
+        		  android:name=".Encrypteddisplay_info">
+        </activity> 
+        
+        <activity android:theme="@style/MyTheme"
+        		  android:name=".Encrypteddisplay_info_switched">
+        </activity> 
+
+    </application>
+    <uses-sdk android:minSdkVersion="7" />
+
+</manifest> 

File bin/AES_Crypto.apk

  • Ignore whitespace
Binary file added.

File bin/classes.dex

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/About.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/Begin$1.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/Begin$2.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/Begin$3.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/Begin.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/EncryptedDisplay$1$1.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/EncryptedDisplay$1.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/EncryptedDisplay$2.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/EncryptedDisplay.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/EncryptedObject.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/EncryptedObjectProvider.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/Encrypteddisplay_info.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/Encrypteddisplay_info_switched.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/EncryptorDisplay$1.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/EncryptorDisplay.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/Encryptordisplay_info.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/Keygen.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/R$attr.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/R$drawable.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/R$id.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/R$layout.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/R$menu.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/R$string.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/R$style.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/R.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/StringComparator.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/main$1.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/main$2.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/main$3.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/main$4.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/main$5.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/main.class

  • Ignore whitespace
Binary file added.

File bin/com/android/crypto/main_info.class

  • Ignore whitespace
Binary file added.

File bin/resources.ap_

  • Ignore whitespace
Binary file added.

File default.properties

View file
  • Ignore whitespace
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+# 
+# This file must be checked in Version Control Systems.
+# 
+# To customize properties used by the Ant build system use,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-7

File gen/com/android/crypto/R.java

View file
  • Ignore whitespace
+/* AUTO-GENERATED FILE.  DO NOT MODIFY.
+ *
+ * This class was automatically generated by the
+ * aapt tool from the resource data it found.  It
+ * should not be modified by hand.
+ */
+
+package com.android.crypto;
+
+public final class R {
+    public static final class attr {
+    }
+    public static final class drawable {
+        public static final int andro=0x7f020000;
+        public static final int ic_menu_cc=0x7f020001;
+        public static final int ic_menu_login=0x7f020002;
+        public static final int icon=0x7f020003;
+        public static final int key=0x7f020004;
+    }
+    public static final class id {
+        public static final int about=0x7f070019;
+        public static final int andro=0x7f070004;
+        public static final int bouton_a_propos=0x7f070000;
+        public static final int bouton_chiffrer=0x7f07000e;
+        public static final int bouton_info=0x7f070001;
+        public static final int bouton_new_file=0x7f070002;
+        public static final int content=0x7f07000a;
+        public static final int dechiffre=0x7f070006;
+        public static final int delete=0x7f070017;
+        public static final int display=0x7f07000f;
+        public static final int edit_content=0x7f07000b;
+        public static final int edit_mdp=0x7f070013;
+        public static final int info=0x7f070018;
+        public static final int liste=0x7f070011;
+        public static final int mdp=0x7f070012;
+        public static final int modify=0x7f070016;
+        public static final int name=0x7f070008;
+        public static final int new_file=0x7f07001b;
+        public static final int ok=0x7f070014;
+        public static final int open=0x7f070015;
+        public static final int password=0x7f07000d;
+        public static final int quit=0x7f07001a;
+        public static final int relative_view=0x7f070005;
+        public static final int separator=0x7f070010;
+        public static final int texte_content=0x7f070009;
+        public static final int texte_name=0x7f070007;
+        public static final int texte_password=0x7f07000c;
+        public static final int welcome=0x7f070003;
+    }
+    public static final class layout {
+        public static final int about=0x7f030000;
+        public static final int begin=0x7f030001;
+        public static final int empty=0x7f030002;
+        public static final int encrypteddisplay=0x7f030003;
+        public static final int encrypteddisplay_info=0x7f030004;
+        public static final int encrypteddisplay_info_switched=0x7f030005;
+        public static final int encryptordisplay=0x7f030006;
+        public static final int encryptordisplay_info=0x7f030007;
+        public static final int main=0x7f030008;
+        public static final int main_info=0x7f030009;
+        public static final int passwordasker=0x7f03000a;
+    }
+    public static final class menu {
+        public static final int context_menu=0x7f060000;
+        public static final int encrypteddisplay_menu=0x7f060001;
+        public static final int encrypteddisplay_menu_switched=0x7f060002;
+        public static final int encryptordisplay_menu=0x7f060003;
+        public static final int main_menu=0x7f060004;
+    }
+    public static final class string {
+        public static final int app_description=0x7f040000;
+        public static final int app_name=0x7f040001;
+    }
+    public static final class style {
+        public static final int MyTheme=0x7f050000;
+    }
+}

File res/drawable-hdpi/andro.png

  • Ignore whitespace
Added
New image

File res/drawable-hdpi/ic_menu_cc.png

  • Ignore whitespace
Added
New image

File res/drawable-hdpi/ic_menu_login.png

  • Ignore whitespace
Added
New image

File res/drawable-hdpi/icon.png

  • Ignore whitespace
Added
New image

File res/drawable-ldpi/andro.png

  • Ignore whitespace
Added
New image

File res/drawable-ldpi/icon.png

  • Ignore whitespace
Added
New image

File res/drawable-ldpi/key.png

  • Ignore whitespace
Added
New image

File res/drawable-mdpi/andro.png

  • Ignore whitespace
Added
New image

File res/drawable-mdpi/ic_menu_cc.png

  • Ignore whitespace
Added
New image

File res/drawable-mdpi/ic_menu_login.png

  • Ignore whitespace
Added
New image

File res/drawable-mdpi/icon.png

  • Ignore whitespace
Added
New image

File res/layout/about.xml

View file
  • Ignore whitespace
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:layout_width="fill_parent"
+  android:layout_height="fill_parent"
+  android:paddingLeft="10dip"
+  android:paddingTop="10dip"
+  android:paddingBottom="10dip"
+  android:paddingRight="3dip"
+  android:fadeScrollbars="true">
+  
+  <LinearLayout
+  		android:layout_width="wrap_content"
+  		android:layout_height="wrap_content"
+  		android:orientation="vertical"
+  		android:paddingRight="10dip">
+  		
+  		
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="AES Crypto"
+  			android:textSize="18sp"
+  			android:textColor="#FFFFFF"
+  			/>
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Véritable coffre-fort numérique de poche, AES Crypto est une application de chiffrement qui vous permet de stocker identifiants, mots de passe et informations confidentielles de manière totalement sécurisée."
+  			android:layout_marginBottom="15dip"
+  			/>
+  			
+  			
+  			
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Chiffrement sécurisé"
+  			android:textSize="18sp"
+  			android:textColor="#FFFFFF"
+  			/>
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="AES Crypto utilise l'algorithme de chiffrement symétrique AES (Advanced Encryption Standard), sous-ensemble de l'algorithme Rijndael. \nA ce jour, le chiffrement AES n'a jamais été cassé et a été choisi comme standard de chiffrement par les organisations gouvernementales américaines. \nAES Crypto utilise un système de clés privées de 256 bits, recommandées par la NSA pour le chiffrement des données classifiées TOP SECRET. \nLes données chiffrées par AES Crypto sont en sécurité."
+  			android:layout_marginBottom="15dip"
+  			/>
+  		
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Stockage des données"
+  			android:textSize="18sp"
+  			android:textColor="#FFFFFF"
+  			/>
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Vos données confidentielles sont chiffrées puis stockées dans la mémoire de votre téléphone. \nUne tierce personne ayant accès à ces données, y compris le créateur de cette application, ne serait pas en mesure d'en lire le contenu sans connaitre votre mot de passe. \nAucune donnée non chiffrée n'est stockée en mémoire."
+  			android:layout_marginBottom="15dip"
+  			/>
+  			
+  			
+  			
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Limites d'AES Crypto"
+  			android:textSize="18sp"
+  			android:textColor="#FFFFFF"
+  			/>
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="La principale limite de la protection assurée par AES Crypto reste l'utilisation de mots de passe. \nAfin de protéger au maximum vos données, évitez tous mots de passes évidents comme votre date de naissance et pensez à utiliser chiffres et caractères spéciaux. \nBien sûr, n'écrivez jamais vos mots de passe ailleurs que dans votre cerveau ! \nEnfin, lisez et suivez les recommandations d'utilisation d'AES Crypto disponible dans chaque fenêtre via la touche Info du Menu. "
+  			android:layout_marginBottom="15dip"
+  			/>
+  		
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Contact"
+  			android:textSize="18sp"
+  			android:textColor="#FFFFFF"
+  			/>
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Si vous rencontrez un bug, si vous avez une question ou si vous voulez suggérer une amélioration, n'hésitez pas à contacter Romain Vernoux à l'adresse suivante :"
+  			android:layout_marginBottom="15dip"
+  			/>
+  			
+  		<TextView
+  			android:layout_width="fill_parent"
+  			android:layout_height="wrap_content"
+  			android:textColor="#FFFFFF"
+  			android:text="vernoux.romain@gmail.com"
+  			android:gravity="center_horizontal"
+  			android:layout_marginBottom="15dip"
+  			/>	
+  			
+  			
+  </LinearLayout>
+  		
+</ScrollView>

File res/layout/begin.xml

View file
  • Ignore whitespace
+<?xml version="1.0" encoding="utf-8"?>
+
+  
+  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+  		android:layout_width="wrap_content"
+  		android:layout_height="wrap_content"
+  		android:orientation="vertical"
+  		android:padding="20dip">
+  		
+  		
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Pour bien commencer..."
+  			android:textSize="18sp"
+  			android:textColor="#FFFFFF"
+  			android:layout_margin="15dip"
+  			/>
+  		
+  		<Button
+  			android:id="@+id/bouton_a_propos"
+  			android:layout_width="fill_parent"
+  			android:layout_height="wrap_content"
+  			android:text="A propos de AES Crypto" />
+  		
+  		<Button
+  			android:id="@+id/bouton_info"
+  			android:layout_width="fill_parent"
+  			android:layout_height="wrap_content"
+  			android:text="Actions usuelles" />  			
+  		
+  		<Button
+  			android:id="@+id/bouton_new_file"
+  			android:layout_width="fill_parent"
+  			android:layout_height="wrap_content"
+  			android:text="Chiffrer mon premier fichier" />	
+  			
+  </LinearLayout>
+

File res/layout/empty.xml

View file
  • Ignore whitespace
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:layout_width="fill_parent"
+  android:layout_height="fill_parent">
+  
+  <TextView
+  	android:text="Bienvenue !"
+  	android:id="@+id/welcome"
+  	android:textSize="24sp"
+  	android:layout_width="fill_parent"
+  	android:layout_height="wrap_content"
+  	android:gravity="center_horizontal"
+  	android:layout_marginTop="15dip"
+  	android:layout_marginBottom="20dip"
+  	android:layout_marginLeft="10dip"
+    android:layout_marginRight="10dip"
+  	android:layout_alignParentTop="true"
+  	android:drawableLeft="@android:drawable/ic_lock_lock"
+    android:drawableRight="@android:drawable/ic_lock_lock"
+  	/>
+  	
+  <ImageView
+  	android:id="@+id/andro"
+    android:src="@drawable/andro"
+    android:layout_height="wrap_content"
+    android:layout_width="wrap_content"
+    android:layout_centerInParent="true"
+    />
+
+  	
+  <TextView
+  	android:text="Cliquez-moi pour commencer !"
+  	android:layout_height="wrap_content"
+  	android:layout_width="wrap_content"
+  	android:layout_below="@id/andro"
+  	android:layout_centerHorizontal="true"
+  	/>
+  	
+  </RelativeLayout>

File res/layout/encrypteddisplay.xml

View file
  • Ignore whitespace
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:id="@+id/relative_view"
+  android:layout_width="fill_parent"
+  android:layout_height="fill_parent"
+  >
+  
+  <TextView
+  	android:text="Fichier Chiffré"
+  	android:id="@+id/dechiffre"
+  	android:textSize="24sp"
+  	android:layout_width="fill_parent"
+  	android:layout_height="wrap_content"
+  	android:gravity="center_horizontal"
+  	android:layout_marginTop="15dip"
+  	android:layout_marginBottom="20dip"
+  	android:layout_marginLeft="10dip"
+  	android:layout_marginRight="10dip"
+  	android:layout_alignParentTop="true"
+  	android:drawableLeft="@android:drawable/ic_lock_lock"
+    android:drawableRight="@android:drawable/ic_lock_lock"
+  	/>
+  
+  
+   <ScrollView 
+   	android:layout_width="fill_parent"
+   	android:layout_height="fill_parent"
+   	android:layout_below="@id/dechiffre">  
+			   
+		<RelativeLayout 
+		  android:layout_width="fill_parent"
+		  android:layout_height="fill_parent"
+		  android:padding="15dip">	   
+			   
+			   
+			   <TextView
+			  	android:id="@+id/texte_name"
+			  	android:text="Nom :"
+			  	android:textSize="18sp"
+			  	android:textColor="#3ED2FD"
+			  	android:layout_width="wrap_content"
+			  	android:layout_height="wrap_content"
+			  	android:layout_marginBottom="5dip"
+			  	android:layout_below="@id/dechiffre"
+			  	/>
+			  	
+			  <TextView
+			  	android:id="@+id/name"
+			  	android:layout_width="wrap_content"
+			  	android:layout_height="wrap_content"
+			  	android:layout_marginBottom="15dip"
+			  	android:layout_below="@id/texte_name"
+			  	android:layout_alignLeft="@id/texte_name"
+			  	/>
+			  	
+			  <TextView
+			  	android:id="@+id/texte_content"
+			  	android:text="Contenu chiffré :"
+			  	android:textSize="18sp"
+			  	android:textColor="#3ED2FD"
+			  	android:layout_width="wrap_content"
+			  	android:layout_height="wrap_content"
+			  	android:layout_marginBottom="5dip"
+			  	android:layout_below="@id/name"
+			  	android:layout_alignLeft="@id/texte_name"
+			  	/>
+			  	
+			  <TextView
+			  	android:id="@+id/content"
+			  	android:layout_width="wrap_content"
+			  	android:layout_height="wrap_content"
+			  	android:layout_below="@id/texte_content"
+			  	android:layout_alignLeft="@id/texte_name"
+			  	/>	
+			  	
+			  <EditText
+			  	android:id="@+id/edit_content"
+			  	android:layout_width="fill_parent"
+			  	android:layout_height="wrap_content"
+			  	android:layout_below="@id/texte_content"
+			  	android:layout_alignLeft="@id/texte_name"
+			  	android:layout_marginBottom="15dip"
+			  	android:visibility="invisible"
+			  	/>	
+			  	
+			  <TextView
+			  	android:id="@+id/texte_password"
+			  	android:text="Nouveau mot de passe :"
+			  	android:textSize="18sp"
+			  	android:textColor="#3ED2FD"
+			  	android:layout_width="wrap_content"
+			  	android:layout_height="wrap_content"
+			  	android:layout_marginBottom="5dip"
+			  	android:layout_below="@id/edit_content"
+			  	android:layout_alignLeft="@id/texte_name"
+			  	android:visibility="invisible"
+			  	/>
+			  	
+			  <EditText
+			  	android:id="@+id/password"
+			  	android:hint="Mot de passe"
+			  	android:layout_width="fill_parent"
+			  	android:layout_height="wrap_content"
+			  	android:layout_below="@id/texte_password"
+			  	android:layout_alignLeft="@id/texte_name"
+			  	android:password="true"
+			  	android:singleLine="true"
+			  	android:layout_marginBottom="15dip"
+			  	android:visibility="invisible"
+			  	/>
+			  	
+			  	
+			  <Button
+			  	android:id="@+id/bouton_chiffrer"
+			  	android:text="Chiffrer"
+			  	android:layout_width="140dip"
+			  	android:layout_height="wrap_content"
+			  	android:layout_centerHorizontal="true"
+			  	android:layout_below="@id/password"
+			  	android:layout_marginTop="15dip"
+			  	android:visibility="invisible"
+			  	/>	
+  	
+			</RelativeLayout>
+		
+		</ScrollView>
+		
+</RelativeLayout>

File res/layout/encrypteddisplay_info.xml

View file
  • Ignore whitespace
+<ScrollView
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:layout_width="fill_parent"
+  android:layout_height="fill_parent"
+  android:paddingLeft="10dip"
+  android:paddingTop="10dip"
+  android:paddingBottom="10dip"
+  android:paddingRight="3dip"
+  android:fadeScrollbars="true">
+  
+  <LinearLayout
+  		android:layout_width="wrap_content"
+  		android:layout_height="wrap_content"
+  		android:orientation="vertical"
+  		android:paddingRight="10dip">
+  		
+  		
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Mot de passe"
+  			android:textSize="18sp"
+  			android:textColor="#FFFFFF"
+  			/>
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Entrez le mot de passe que vous avez choisi lors de la création du fichier."
+  			android:layout_marginBottom="15dip"
+  			/>
+  			
+  			
+  </LinearLayout>
+  		
+</ScrollView>

File res/layout/encrypteddisplay_info_switched.xml

View file
  • Ignore whitespace
+<ScrollView
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:layout_width="fill_parent"
+  android:layout_height="fill_parent"
+  android:paddingLeft="10dip"
+  android:paddingTop="10dip"
+  android:paddingBottom="10dip"
+  android:paddingRight="3dip"
+  android:fadeScrollbars="true">
+  
+  <LinearLayout
+  		android:layout_width="wrap_content"
+  		android:layout_height="wrap_content"
+  		android:orientation="vertical"
+  		android:paddingRight="10dip">
+  		
+  		
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Contenu déchiffré"
+  			android:textSize="18sp"
+  			android:textColor="#FFFFFF"
+  			/>
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Vous pouvez lire vos informations personnelles déchiffrées. \nPour des raisons de sécurité, appuyez toujours sur la touche ''Retour'' de votre téléphone ou sélectionnez ''Retour'' dans le Menu quand vous avez fini de consulter votre fichier."
+  			android:layout_marginBottom="15dip"
+  			/>
+  			
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Modifier le fichier"
+  			android:textSize="18sp"
+  			android:textColor="#FFFFFF"
+  			/>
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Pour modifier le contenu de ce fichier, sélectionnez l'option correspondante dans le Menu."
+  			android:layout_marginBottom="15dip"
+  			/>
+  			
+  			
+  </LinearLayout>
+  		
+</ScrollView>

File res/layout/encryptordisplay.xml

View file
  • Ignore whitespace
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout 
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:layout_width="fill_parent"
+  android:layout_height="fill_parent">
+  
+  
+  <TextView
+  	android:text="Nouveau Fichier"
+  	android:id="@+id/dechiffre"
+  	android:textSize="24sp"
+  	android:layout_width="fill_parent"
+  	android:layout_height="wrap_content"
+  	android:gravity="center_horizontal"
+  	android:layout_marginTop="15dip"
+  	android:layout_marginBottom="20dip"
+  	android:layout_marginLeft="10dip"
+  	android:layout_marginRight="10dip"
+  	android:layout_alignParentTop="true"
+  	android:drawableLeft="@android:drawable/ic_lock_lock"
+    android:drawableRight="@android:drawable/ic_lock_lock"
+  	/>
+  
+   <ScrollView 
+   	android:layout_width="fill_parent"
+   	android:layout_height="fill_parent"
+   	android:layout_below="@id/dechiffre">
+  
+  		<RelativeLayout 
+		  android:layout_width="fill_parent"
+		  android:layout_height="fill_parent"
+		  android:padding="15dip">
+  
+			   <TextView
+			  	android:id="@+id/texte_name"
+			  	android:text="Nom :"
+			  	android:textSize="18sp"
+			  	android:textColor="#3ED2FD"
+			  	android:layout_width="wrap_content"
+			  	android:layout_height="wrap_content"
+			  	android:layout_marginBottom="5dip"
+			  	/>
+			  	
+			  <EditText
+			  	android:id="@+id/name"
+			  	android:hint="Nom"
+			  	android:layout_width="fill_parent"
+			  	android:layout_height="wrap_content"
+			  	android:layout_marginBottom="15dip"
+			  	android:layout_below="@id/texte_name"
+			  	android:layout_alignLeft="@id/texte_name"
+			  	android:singleLine="true"
+			  	/>
+			  	
+			  <TextView
+			  	android:id="@+id/texte_content"
+			  	android:text="Contenu chiffré :"
+			  	android:textSize="18sp"
+			  	android:textColor="#3ED2FD"
+			  	android:layout_width="wrap_content"
+			  	android:layout_height="wrap_content"
+			  	android:layout_marginBottom="5dip"
+			  	android:layout_below="@id/name"
+			  	android:layout_alignLeft="@id/texte_name"
+			  	/>
+			  	
+			  <EditText
+			  	android:id="@+id/content"
+			  	android:hint="Contenu chiffré"
+			  	android:layout_width="fill_parent"
+			  	android:layout_height="wrap_content"
+			  	android:layout_below="@id/texte_content"
+			  	android:layout_alignLeft="@id/texte_name"
+			  	android:layout_marginBottom="15dip"
+			  	/>
+			  	
+			  <TextView
+			  	android:id="@+id/texte_password"
+			  	android:text="Mot de passe :"
+			  	android:textSize="18sp"
+			  	android:textColor="#3ED2FD"
+			  	android:layout_width="wrap_content"
+			  	android:layout_height="wrap_content"
+			  	android:layout_marginBottom="5dip"
+			  	android:layout_below="@id/content"
+			  	android:layout_alignLeft="@id/texte_name"
+			  	/>
+			  	
+			  <EditText
+			  	android:id="@+id/password"
+			  	android:hint="Mot de passe"
+			  	android:layout_width="fill_parent"
+			  	android:layout_height="wrap_content"
+			  	android:layout_below="@id/texte_password"
+			  	android:layout_alignLeft="@id/texte_name"
+			  	android:password="true"
+			  	android:singleLine="true"
+			  	/>
+			  	
+			  	
+			  	
+			  <Button
+			  	android:id="@+id/bouton_chiffrer"
+			  	android:text="Chiffrer"
+			  	android:layout_width="140dip"
+			  	android:layout_height="wrap_content"
+			  	android:layout_centerHorizontal="true"
+			  	android:layout_below="@id/password"
+			  	android:layout_marginTop="15dip"
+			  	/>
+	  	
+	  	</RelativeLayout>
+	 
+	 </ScrollView>
+  
+</RelativeLayout>
+
+

File res/layout/encryptordisplay_info.xml

View file
  • Ignore whitespace
+<ScrollView
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:layout_width="fill_parent"
+  android:layout_height="fill_parent"
+  android:paddingLeft="10dip"
+  android:paddingTop="10dip"
+  android:paddingBottom="10dip"
+  android:paddingRight="3dip"
+  android:fadeScrollbars="true">
+  
+  <LinearLayout
+  		android:layout_width="wrap_content"
+  		android:layout_height="wrap_content"
+  		android:orientation="vertical"
+  		android:paddingRight="10dip">
+  		
+  		
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Nom"
+  			android:textSize="18sp"
+  			android:textColor="#FFFFFF"
+  			/>
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="C'est le nom de votre fichier chiffré. \nCe champ n'est pas chiffré. Ne mettez pas d'informations confidentielles dans ce champ."
+  			android:layout_marginBottom="15dip"
+  			/>
+  			
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Contenu"
+  			android:textSize="18sp"
+  			android:textColor="#FFFFFF"
+  			/>
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Tapez ici le contenu que vous voulez chiffrer."
+  			android:layout_marginBottom="15dip"
+  			/>
+  			
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Mot de passe"
+  			android:textSize="18sp"
+  			android:textColor="#FFFFFF"
+  			/>
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Ce mot de passe vous sera demandé lors du déchiffrement. \nSuivez les consignes de sécurité décrites dans la rubrique ''A propos''"
+  			android:layout_marginBottom="15dip"
+  			/>
+  			
+  			
+  </LinearLayout>
+  		
+</ScrollView>

File res/layout/main.xml

View file
  • Ignore whitespace
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    >
+    
+    <TextView
+    	android:id="@+id/display"
+    	android:text="Sélectionnez le fichier à déchiffrer"
+    	android:textSize="24sp"
+    	android:layout_alignParentTop="true"
+    	android:layout_width="fill_parent"
+    	android:layout_height="wrap_content"
+    	android:gravity="center_horizontal"
+    	android:layout_marginTop="10dip"
+    	android:layout_marginLeft="10dip"
+    	android:layout_marginRight="10dip"
+    	android:drawableLeft="@android:drawable/ic_lock_lock"
+    	android:drawableRight="@android:drawable/ic_lock_lock"
+    	/>
+    	
+    <ImageView
+    	android:id="@+id/separator"
+    	android:layout_width="fill_parent"
+    	android:layout_height="wrap_content"
+    	android:layout_below="@id/display"/>
+    	
+    <ListView
+    	android:layout_width="fill_parent"
+    	android:layout_height="fill_parent"
+    	android:id="@+id/liste"
+    	android:textFilterEnabled="true"
+    	android:layout_below="@id/display"
+    	android:focusable="true"
+    	/>
+    
+    
+</RelativeLayout>

File res/layout/main_info.xml

View file
  • Ignore whitespace
+<ScrollView
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:layout_width="fill_parent"
+  android:layout_height="fill_parent"
+  android:paddingLeft="10dip"
+  android:paddingTop="10dip"
+  android:paddingBottom="10dip"
+  android:paddingRight="3dip"
+  android:fadeScrollbars="true">
+  
+  <LinearLayout
+  		android:layout_width="wrap_content"
+  		android:layout_height="wrap_content"
+  		android:orientation="vertical"
+  		android:paddingRight="10dip">
+  		
+  		
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Chiffrer"
+  			android:textSize="18sp"
+  			android:textColor="#FFFFFF"
+  			/>
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Pour créer un nouveau fichier chiffré, sélectionnez simplement la touche correspondante dans le menu de l'écran principal."
+  			android:layout_marginBottom="15dip"
+  			/>
+  			
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Déchiffrer"
+  			android:textSize="18sp"
+  			android:textColor="#FFFFFF"
+  			/>
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Pour lire le contenu d'un fichier chiffré, sélectionnez-le dans la liste de l'écran principal."
+  			android:layout_marginBottom="15dip"
+  			/>
+  			
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Supprimer"
+  			android:textSize="18sp"
+  			android:textColor="#FFFFFF"
+  			/>
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Pour supprimer un fichier chiffré, appuyez longuement sur celui-ci dans la liste de l'écran principal."
+  			android:layout_marginBottom="15dip"
+  			/>
+  			
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Mot de passe perdu"
+  			android:textSize="18sp"
+  			android:textColor="#FFFFFF"
+  			/>
+  		
+  		<TextView
+  			android:layout_width="wrap_content"
+  			android:layout_height="wrap_content"
+  			android:text="Il est impossible de déchiffrer un fichier dont vous ne possédez pas le mot de passe."
+  			android:layout_marginBottom="15dip"
+  			/>
+  			
+  </LinearLayout>
+  		
+</ScrollView>

File res/layout/passwordasker.xml

View file
  • Ignore whitespace
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:layout_width="fill_parent"
+  android:layout_height="fill_parent"
+  android:padding="10dip"
+  >
+  
+  <TextView
+  	android:id="@+id/mdp"
+  	android:text="Entrez le mot de passe :"
+  	android:textSize="18sp"
+  	android:layout_width="wrap_content"
+  	android:layout_height="wrap_content"
+  	android:layout_marginBottom="10dip"
+
+  	/>
+  	
+  
+  <EditText
+  	android:id="@+id/edit_mdp"
+  	android:hint="Mot de passe"
+  	android:layout_width="fill_parent"
+  	android:layout_height="wrap_content"
+  	android:layout_marginBottom="10dip"
+	android:layout_below="@id/mdp"
+	android:password="true"
+	android:singleLine="true"
+  	/>
+  	
+  <Button
+  	android:id="@+id/ok"
+  	android:text="Ok"
+  	android:layout_width="140dip"
+  	android:layout_height="wrap_content"
+  	android:layout_centerHorizontal="true"
+  	android:gravity="center"
+  	android:layout_below="@id/edit_mdp"
+  	/>
+  	
+</RelativeLayout>

File res/menu/context_menu.xml

View file
  • Ignore whitespace
+<?xml version="1.0" encoding="utf-8"?>
+<menu
+  xmlns:android="http://schemas.android.com/apk/res/android"
+>
+  
+  
+  <item
+  	android:id="@+id/open"
+  	android:title="Déchiffrer"/>
+  	
+  <item
+  	android:id="@+id/modify"
+  	android:title="Modifier"/>
+  	
+  <item
+  	android:id="@+id/delete"
+  	android:title="Supprimer"/>
+  	
+</menu>

File res/menu/encrypteddisplay_menu.xml

View file
  • Ignore whitespace
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+  
+  <item android:id="@+id/info"
+  		android:icon="@android:drawable/ic_menu_info_details"
+  		android:title="Info" />
+  		
+  <item android:id="@+id/about"
+  		android:icon="@drawable/ic_menu_cc"
+  		android:title="A propos" />
+  
+  <item android:id="@+id/quit"
+  		android:icon="@android:drawable/ic_menu_close_clear_cancel"
+  		android:title="Retour" />
+  
+</menu>

File res/menu/encrypteddisplay_menu_switched.xml

View file
  • Ignore whitespace
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+  
+  <item android:id="@+id/modify"
+  		android:icon="@android:drawable/ic_menu_manage"
+  		android:title="Modifier" />
+  
+  <item android:id="@+id/info"
+  		android:icon="@android:drawable/ic_menu_info_details"
+  		android:title="Info" />
+  		
+  <item android:id="@+id/about"
+  		android:icon="@drawable/ic_menu_cc"
+  		android:title="A propos" />
+  
+  <item android:id="@+id/quit"
+  		android:icon="@android:drawable/ic_menu_close_clear_cancel"
+  		android:title="Retour" />
+  
+</menu>

File res/menu/encryptordisplay_menu.xml

View file
  • Ignore whitespace
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+        
+  <item android:id="@+id/info"
+  		android:icon="@android:drawable/ic_menu_info_details"
+  		android:title="Info" />
+  		
+  <item android:id="@+id/about"
+  		android:icon="@drawable/ic_menu_cc"
+  		android:title="A propos" />
+  
+  <item android:id="@+id/quit"
+  		android:icon="@android:drawable/ic_menu_close_clear_cancel"
+  		android:title="Retour" />
+  
+</menu>

File res/menu/main_menu.xml

View file
  • Ignore whitespace
+<?xml version="1.0" encoding="utf-8"?>
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+  
+  <item android:id="@+id/new_file"
+        android:icon="@android:drawable/ic_menu_add"
+        android:title="Nouveau fichier chiffré"
+        android:titleCondensed="Nouveau fichier chiffré" />
+        
+  <item android:id="@+id/info"
+  		android:icon="@android:drawable/ic_menu_info_details"
+  		android:title="Info" />
+  		
+  <item android:id="@+id/about"
+  		android:icon="@drawable/ic_menu_cc"
+  		android:title="A propos" />
+  
+  <item android:id="@+id/quit"
+  		android:icon="@android:drawable/ic_menu_close_clear_cancel"
+  		android:title="Quitter" />
+  
+</menu>

File res/values/strings.xml

View file
  • Ignore whitespace
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="app_description">Véritable coffre-fort numérique de poche, AES Crypto est une application de chiffrement qui vous permet de stocker identifiants, mots de passe et informations confidentielles de manière totalement sécurisée.</string>
+    <string name="app_name">AES Crypto</string>
+</resources>

File res/values/styles.xml

View file
  • Ignore whitespace
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+	<style name="MyTheme" parent="@android:style/Theme.Dialog">
+		
+	</style>
+</resources>

File src/com/android/crypto/About.java

View file
  • Ignore whitespace
+package com.android.crypto;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.Window;
+
+
+public class About extends Activity {
+
+	public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
+        setContentView(R.layout.about);
+        
+    }
+	
+}

File src/com/android/crypto/Begin.java

View file
  • Ignore whitespace
+package com.android.crypto;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.view.Window;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+
+public class Begin extends Activity {
+
+	/** Called when the activity is first created. */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
+        setContentView(R.layout.begin);
+        
+        Button bouton_info = (Button)findViewById(R.id.bouton_info);
+        Button bouton_a_propos = (Button)findViewById(R.id.bouton_a_propos);
+        Button bouton_new_file = (Button)findViewById(R.id.bouton_new_file);
+        
+        bouton_info.setOnClickListener(new OnClickListener() {
+			
+			@Override
+			public void onClick(View v) {
+				// TODO Auto-generated method stub
+				Intent intent_info = new Intent(Begin.this, main_info.class);
+				startActivity(intent_info);
+			}
+		});
+        bouton_a_propos.setOnClickListener(new OnClickListener() {
+			
+			@Override
+			public void onClick(View v) {
+				// TODO Auto-generated method stub
+				Intent intent_info = new Intent(Begin.this, About.class);
+				startActivity(intent_info);
+			}
+		});
+        bouton_new_file.setOnClickListener(new OnClickListener() {
+			
+			@Override
+			public void onClick(View v) {
+				// TODO Auto-generated method stub
+				Intent intent_new_file = new Intent(Begin.this, EncryptorDisplay.class);
+				startActivity(intent_new_file);
+				Begin.this.finish();
+				
+			}
+		});    
+    
+    
+    }
+	
+}

File src/com/android/crypto/EncryptedDisplay.java

View file
  • Ignore whitespace
+package com.android.crypto;
+
+import java.io.IOException;
+import java.security.InvalidKeyException;
+
+import javax.crypto.BadPaddingException;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.text.Editable;
+import android.view.Menu;
+import android.view.MenuInflater;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.WindowManager;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.TextView;
+import android.widget.Toast;
+
+public class EncryptedDisplay extends Activity {
+	
+	private EncryptedObjectProvider eop;
+	private EditText enterPassword;
+	private String path;
+	private Boolean viewSwitched = false;
+	private Boolean modify;
+	private EncryptedObject eo;
+	
+	@Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.passwordasker);
+        
+        
+        path = this.getIntent().getExtras().getString("path");
+        modify = this.getIntent().getExtras().getBoolean("modify");
+        
+        enterPassword = (EditText)findViewById(R.id.edit_mdp);
+        Button bouton_ok = (Button)findViewById(R.id.ok);
+       
+        
+        bouton_ok.setOnClickListener(new OnClickListener() {
+
+			@Override
+			public void onClick(View arg0) {
+				// TODO Auto-generated method stub
+				
+				
+				
+
+				
+				eop = new EncryptedObjectProvider(path);
+				
+				try {
+					eo = eop.decrypt(enterPassword.getText().toString());
+					
+					// Cacher la clavier "� la main"
+					InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
+					mgr.hideSoftInputFromWindow(enterPassword.getWindowToken(), 0);
+					
+					
+					setContentView(R.layout.encrypteddisplay);
+					viewSwitched=true;
+					
+					TextView name = (TextView)findViewById(R.id.name);
+					TextView content = (TextView)findViewById(R.id.content);
+					
+					name.setText(eo.getName());
+					content.setText(eo.getContenu());
+				
+					if (modify)
+					{
+						final TextView contenu = (TextView)findViewById(R.id.content);
+			        	final EditText edit_content = (EditText)findViewById(R.id.edit_content);
+			        	final TextView texte_password = (TextView)findViewById(R.id.texte_password);
+			        	final EditText password = (EditText)findViewById(R.id.password);
+			        	final Button bouton_chiffrer = (Button)findViewById(R.id.bouton_chiffrer);
+			        	
+			        	contenu.setVisibility(View.INVISIBLE);
+			        	edit_content.setText(eo.getContenu());
+			        	edit_content.setVisibility(View.VISIBLE);
+			        	texte_password.setVisibility(View.VISIBLE);
+			        	password.setVisibility(View.VISIBLE);
+			        	bouton_chiffrer.setVisibility(View.VISIBLE);
+			        	
+			        	bouton_chiffrer.setOnClickListener(new OnClickListener() {
+							
+							@Override
+							public void onClick(View v) {
+								// TODO Auto-generated method stub
+								
+														
+									try {
+										EncryptedObjectProvider eop = new EncryptedObjectProvider(EncryptedDisplay.this.path);
+										EncryptedObject eo = new EncryptedObject(EncryptedDisplay.this.eo.getName(), edit_content.getText().toString());
+										eop.encrypt(password.getText().toString(), eo);
+										
+										Toast.makeText(EncryptedDisplay.this, "Fichier chiffr� et enregistr�.", Toast.LENGTH_LONG).show();
+										EncryptedDisplay.this.finish();
+									} catch (InvalidKeyException e) {
+											// TODO Auto-generated catch block
+											Toast.makeText(EncryptedDisplay.this, "Le mot de passe que vous avez saisi n'est pas correct. \nPeut-�tre utilisez-vous des caract�res sp�ciaux.", Toast.LENGTH_LONG).show();
+											password.setText("");
+									} catch (IOException e) {
+											// TODO Auto-generated catch block
+											Toast.makeText(EncryptedDisplay.this, "Impossible de chiffrer ces donn�es. \nLe r�pertoire de destination est inaccessible.", Toast.LENGTH_LONG).show();
+									}
+								
+								
+							}
+						});
+					}
+				
+				
+				} catch (InvalidKeyException e) {
+					// TODO Auto-generated catch block
+					Toast.makeText(EncryptedDisplay.this, "Le mot de passe que vous avez saisi n'est pas correct. \nCe champ est sensible � la casse et les espaces sont pris en compte.", Toast.LENGTH_LONG).show();
+					enterPassword.setText("");
+				} catch (IOException e) {
+					// TODO Auto-generated catch block
+					Toast.makeText(EncryptedDisplay.this, "Impossible de d�chiffrer ces donn�es. \nLe fichier est corrompu ou illisible.", Toast.LENGTH_LONG).show();
+					EncryptedDisplay.this.finish();
+				} catch (BadPaddingException e) {
+					// TODO Auto-generated catch block
+					Toast.makeText(EncryptedDisplay.this, "Le mot de passe que vous avez saisi n'est pas correct. \nCe champ est sensible � la casse et les espaces sont pris en compte.", Toast.LENGTH_LONG).show();
+					enterPassword.setText("");
+				}
+				
+			}
+        	
+        });
+        
+        
+        
+        
+        
+        
+        
+        
+       
+	}
+
+	/** Called when the Menu Button is pressed */
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        MenuInflater inflater = getMenuInflater();
+        if (viewSwitched)
+        inflater.inflate(R.menu.encrypteddisplay_menu_switched, menu);
+        else 
+        inflater.inflate(R.menu.encrypteddisplay_menu, menu);	
+        return true;
+    }
+
+    /** Called when a Menu item is selected */
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        
+    	if (viewSwitched)
+    	{
+	        switch (item.getItemId()) {
+	        case R.id.modify:
+	        	final TextView content = (TextView)findViewById(R.id.content);
+	        	final EditText edit_content = (EditText)findViewById(R.id.edit_content);
+	        	final TextView texte_password = (TextView)findViewById(R.id.texte_password);
+	        	final EditText password = (EditText)findViewById(R.id.password);
+	        	final Button bouton_chiffrer = (Button)findViewById(R.id.bouton_chiffrer);
+	        	
+	        	content.setVisibility(View.INVISIBLE);
+	        	edit_content.setText(eo.getContenu());
+	        	edit_content.setVisibility(View.VISIBLE);
+	        	texte_password.setVisibility(View.VISIBLE);
+	        	password.setVisibility(View.VISIBLE);
+	        	bouton_chiffrer.setVisibility(View.VISIBLE);
+	        	
+	        	bouton_chiffrer.setOnClickListener(new OnClickListener() {
+					
+					@Override
+					public void onClick(View v) {
+						// TODO Auto-generated method stub
+						
+												
+							try {
+								EncryptedObjectProvider eop = new EncryptedObjectProvider(EncryptedDisplay.this.path);
+								EncryptedObject eo = new EncryptedObject(EncryptedDisplay.this.eo.getName(), edit_content.getText().toString());
+								eop.encrypt(password.getText().toString(), eo);
+								
+								Toast.makeText(EncryptedDisplay.this, "Fichier chiffr� et enregistr�.", Toast.LENGTH_LONG).show();
+								EncryptedDisplay.this.finish();
+							} catch (InvalidKeyException e) {
+									// TODO Auto-generated catch block
+									Toast.makeText(EncryptedDisplay.this, "Le mot de passe que vous avez saisi n'est pas correct. \nPeut-�tre utilisez-vous des caract�res sp�ciaux.", Toast.LENGTH_LONG).show();
+							} catch (IOException e) {
+									// TODO Auto-generated catch block
+									Toast.makeText(EncryptedDisplay.this, "Impossible de chiffrer ces donn�es. \nLe r�pertoire de destination est inaccessible.", Toast.LENGTH_LONG).show();
+							}
+						
+						
+					}
+				});
+	        	return true;
+	        case R.id.info:
+	        	Intent intent_info = new Intent(EncryptedDisplay.this, Encrypteddisplay_info_switched.class);
+				startActivity(intent_info);
+	        	return true;
+	        case R.id.about:
+	        	Intent intent_about = new Intent(EncryptedDisplay.this, About.class);
+				startActivity(intent_about);
+	        	return true;
+	        case R.id.quit:
+	        	EncryptedDisplay.this.finish();
+	            return true;
+	        default:
+	            return super.onOptionsItemSelected(item);
+	        }
+    	}
+    	else 
+    	{
+    		switch (item.getItemId()) {
+	        case R.id.info:
+	        	Intent intent_info = new Intent(EncryptedDisplay.this, Encrypteddisplay_info.class);
+				startActivity(intent_info);
+	        	return true;
+	        case R.id.about:
+	        	Intent intent_about = new Intent(EncryptedDisplay.this, About.class);
+				startActivity(intent_about);
+	        	return true;
+	        case R.id.quit:
+	        	EncryptedDisplay.this.finish();
+	            return true;
+	        default:
+	            return super.onOptionsItemSelected(item);
+	        }
+    	}
+    }
+
+}

File src/com/android/crypto/EncryptedObject.java

View file
  • Ignore whitespace
+package com.android.crypto;
+import java.io.Serializable;
+
+
+public class EncryptedObject implements Serializable {
+
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+	private String name;
+	private String contenu;
+	
+	
+	public EncryptedObject (String name, String contenu) 
+	{
+		this.name = name;
+		this.contenu = contenu;
+	}
+
+
+	public String getName() {
+		return name;
+	}
+
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+
+	public String getContenu() {
+		return contenu;
+	}
+
+
+	public void setContenu(String contenu) {
+		this.contenu = contenu;
+	}
+	
+}

File src/com/android/crypto/EncryptedObjectProvider.java

View file
  • Ignore whitespace
+package com.android.crypto;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.StreamCorruptedException;
+import java.security.InvalidAlgorithmParameterException;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+import java.security.NoSuchProviderException;
+
+import javax.crypto.BadPaddingException;
+import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
+import javax.crypto.SealedObject;
+
+// Architecture : EncryptedObject -> [encrypted] -> SealedObject -> [serialized] -> stockage dans Path
+
+public class EncryptedObjectProvider {
+
+	private String path;
+	
+	
+	
+	
+	public EncryptedObjectProvider(String path) 
+	{
+		this.path = path;
+	}
+	
+
+
+	public EncryptedObject decrypt(String password) throws InvalidKeyException, IOException, BadPaddingException
+	
+	{
+		
+ 
+        
+        // On r�cup�re notre cl�
+        Keygen keygen = new Keygen();
+        
+        
+		try {
+			// On initialise un Cipher AES
+			Cipher c = Cipher.getInstance("AES/CBC/PKCS5Padding", "BC");
+			c.init(Cipher.DECRYPT_MODE, keygen.generate(password), keygen.getParam());
+			
+			// On r�cup�re un flux sur le fichier stock�