mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-21 09:28:27 +00:00
Clean up key/identity verification Activites.
1) Get ride of the crazy button situation. 2) Actionbar-ify and abstract out the common actions. 3) Switch to full activities from dialog themes.
This commit is contained in:
parent
8e3b08ebda
commit
78998d0c93
@ -43,18 +43,41 @@
|
|||||||
android:label="Select Contacts"
|
android:label="Select Contacts"
|
||||||
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"/>
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"/>
|
||||||
|
|
||||||
|
<activity android:name=".AutoInitiateActivity"
|
||||||
|
android:theme="@style/Theme.Sherlock.Dialog"
|
||||||
|
android:label="TextSecure Messaging Detected"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"/>
|
||||||
|
|
||||||
|
<activity android:name=".ViewIdentityActivity"
|
||||||
|
android:theme="@style/Theme.Sherlock.Dialog"
|
||||||
|
android:label="Public Identity Key"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"/>
|
||||||
|
|
||||||
|
<activity android:name=".PassphraseChangeActivity"
|
||||||
|
android:theme="@style/Theme.Sherlock.Dialog"
|
||||||
|
android:label="Change Passphrase"
|
||||||
|
android:launchMode="singleInstance"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"/>
|
||||||
|
|
||||||
|
<activity android:name=".VerifyKeysActivity"
|
||||||
|
android:label="Verify Session"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"/>
|
||||||
|
|
||||||
|
<activity android:name=".VerifyIdentityActivity"
|
||||||
|
android:label="Verify Identity"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"/>
|
||||||
|
|
||||||
|
<activity android:name=".SaveIdentityActivity"
|
||||||
|
android:theme="@style/Theme.Sherlock.Dialog"
|
||||||
|
android:label="Save Identity"
|
||||||
|
android:windowSoftInputMode="stateVisible"
|
||||||
|
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"/>
|
||||||
|
|
||||||
<activity android:name=".AutoInitiateActivity" android:theme="@android:style/Theme.Dialog" android:label="TextSecure Messaging Detected" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
|
|
||||||
<activity android:name=".ApplicationPreferencesActivity" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
|
<activity android:name=".ApplicationPreferencesActivity" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
|
||||||
<activity android:name=".PassphraseCreateActivity" android:theme="@android:style/Theme.Dialog" android:label="Create Passphrase" android:launchMode="singleInstance" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
|
<activity android:name=".PassphraseCreateActivity" android:theme="@android:style/Theme.Dialog" android:label="Create Passphrase" android:launchMode="singleInstance" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
|
||||||
<activity android:name=".PassphraseChangeActivity" android:theme="@android:style/Theme.Dialog" android:label="Change Passphrase" android:launchMode="singleInstance" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
|
|
||||||
<activity android:name=".SendKeyActivity" android:theme="@android:style/Theme.Dialog" android:label="Initiate Key Exchange" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
|
<activity android:name=".SendKeyActivity" android:theme="@android:style/Theme.Dialog" android:label="Initiate Key Exchange" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
|
||||||
<activity android:name=".ReceiveKeyActivity" android:theme="@android:style/Theme.Dialog" android:label="Complete Key Exchange" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
|
<activity android:name=".ReceiveKeyActivity" android:theme="@android:style/Theme.Dialog" android:label="Complete Key Exchange" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
|
||||||
<activity android:name=".VerifyKeysActivity" android:theme="@android:style/Theme.Dialog" android:label="Verify Session" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
|
|
||||||
<activity android:name=".VerifyIdentityActivity" android:theme="@android:style/Theme.Dialog" android:label="Verify Identity" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
|
|
||||||
<activity android:name=".VerifyImportedIdentityActivity" android:theme="@android:style/Theme.Dialog" android:label="Verify Imported Identity" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
|
<activity android:name=".VerifyImportedIdentityActivity" android:theme="@android:style/Theme.Dialog" android:label="Verify Imported Identity" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
|
||||||
<activity android:name=".ViewIdentityActivity" android:theme="@android:style/Theme.Dialog" android:label="Public Identity Key" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
|
|
||||||
<activity android:name=".SaveIdentityActivity" android:theme="@android:style/Theme.Dialog" android:label="Save Identity" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
|
|
||||||
<activity android:name=".ReviewIdentitiesActivity" android:theme="@android:style/Theme.Dialog" android:label="Manage Identity Keys (Long click)" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
|
<activity android:name=".ReviewIdentitiesActivity" android:theme="@android:style/Theme.Dialog" android:label="Manage Identity Keys (Long click)" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout"></activity>
|
||||||
|
|
||||||
<service android:enabled="true" android:name=".service.KeyCachingService"></service>
|
<service android:enabled="true" android:name=".service.KeyCachingService"></service>
|
||||||
|
BIN
res/drawable-hdpi/ic_menu_barcode.png
Normal file
BIN
res/drawable-hdpi/ic_menu_barcode.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
res/drawable-mdpi/ic_menu_barcode.png
Normal file
BIN
res/drawable-mdpi/ic_menu_barcode.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1010 B |
BIN
res/drawable-xhdpi/ic_menu_barcode.png
Normal file
BIN
res/drawable-xhdpi/ic_menu_barcode.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
@ -1,64 +1,63 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
<TableLayout
|
<TableLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:stretchColumns="1">
|
android:stretchColumns="1">
|
||||||
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TextView
|
<TextView
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
android:text="Old passphrase:"
|
android:text="Old passphrase:"
|
||||||
android:padding="3dip" />
|
android:padding="3dip" />
|
||||||
<EditText android:id="@+id/old_passphrase"
|
|
||||||
android:layout_height="wrap_content"
|
<EditText android:id="@+id/old_passphrase"
|
||||||
android:layout_width="fill_parent"
|
android:layout_height="wrap_content"
|
||||||
android:password="true"/>
|
android:layout_width="fill_parent"
|
||||||
|
android:password="true"/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TextView
|
<TextView
|
||||||
android:text="New passphrase:"
|
android:text="New passphrase:"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
android:padding="3dip" />
|
android:padding="3dip" />
|
||||||
|
|
||||||
<EditText android:id="@+id/new_passphrase"
|
<EditText android:id="@+id/new_passphrase"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:password="true"
|
android:password="true"
|
||||||
/>
|
/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TextView
|
<TextView
|
||||||
android:text="Repeat new passphrase:"
|
android:text="Repeat new passphrase:"
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
android:padding="3dip" />
|
android:padding="3dip" />
|
||||||
|
|
||||||
<EditText android:id="@+id/repeat_passphrase"
|
<EditText android:id="@+id/repeat_passphrase"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:password="true"
|
android:password="true"
|
||||||
/>
|
/>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
|
|
||||||
<TableRow>
|
|
||||||
<Button android:id="@+id/ok_button"
|
|
||||||
android:padding="10dip"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Ok"/>
|
|
||||||
|
|
||||||
<Button android:id="@+id/cancel_button"
|
<TableRow>
|
||||||
android:padding="10dip"
|
<Button android:id="@+id/cancel_button"
|
||||||
android:layout_width="wrap_content"
|
android:padding="10dip"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:text="Cancel"/>
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Cancel"/>
|
||||||
</TableRow>
|
|
||||||
|
<Button android:id="@+id/ok_button"
|
||||||
</TableLayout>
|
android:padding="10dip"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Ok"/>
|
||||||
|
</TableRow>
|
||||||
|
</TableLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
@ -1,47 +1,47 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:padding="5dip">
|
android:padding="16dip">
|
||||||
|
|
||||||
<LinearLayout android:orientation="horizontal"
|
<TextView android:layout_width="wrap_content"
|
||||||
android:layout_width="fill_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:padding="5dip"
|
||||||
android:padding="5dip">
|
android:text="Identity Name:" />
|
||||||
|
|
||||||
<TextView android:layout_width="wrap_content"
|
<EditText android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="5dip"
|
android:padding="5dip"
|
||||||
android:text="Identity Name:" />
|
android:id="@+id/identity_name"
|
||||||
|
android:text="" />
|
||||||
<EditText android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
<LinearLayout android:layout_width="fill_parent"
|
||||||
android:padding="5dip"
|
android:layout_height="wrap_content"
|
||||||
android:id="@+id/identity_name"
|
android:orientation="horizontal"
|
||||||
android:text="" />
|
android:layout_marginBottom="16dip"
|
||||||
</LinearLayout>
|
android:gravity="right">
|
||||||
|
|
||||||
<LinearLayout android:orientation="horizontal"
|
<TableLayout android:layout_width="wrap_content"
|
||||||
android:layout_width="fill_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:stretchColumns="*">
|
||||||
android:padding="5dip">
|
<TableRow>
|
||||||
|
|
||||||
<Button android:layout_width="100dip"
|
<Button android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
android:padding="5dip"
|
android:layout_marginRight="17dip"
|
||||||
android:gravity="center"
|
android:id="@+id/cancel_button"
|
||||||
android:id="@+id/ok_button"
|
android:text="Cancel"/>
|
||||||
android:text="Ok"/>
|
|
||||||
|
<Button android:layout_width="wrap_content"
|
||||||
<Button android:layout_width="100dip"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:visibility="visible"
|
||||||
android:visibility="visible"
|
android:id="@+id/ok_button"
|
||||||
android:padding="5dip"
|
android:text="Ok"/>
|
||||||
android:gravity="center"
|
|
||||||
android:id="@+id/cancel_button"
|
</TableRow>
|
||||||
android:text="Cancel"/>
|
</TableLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -1,70 +1,45 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
<TableLayout
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:shrinkColumns="1">
|
|
||||||
|
|
||||||
<TableRow>
|
<LinearLayout android:layout_width="fill_parent"
|
||||||
<TextView
|
android:layout_height="wrap_content"
|
||||||
android:textSize="12sp"
|
android:layout_marginLeft="16dip"
|
||||||
android:text="Their identity:\n(They read)"
|
android:layout_marginRight="16dip"
|
||||||
android:padding="3dip" />
|
android:layout_gravity="center"
|
||||||
<TextView
|
android:orientation="vertical">
|
||||||
android:textSize="20sp"
|
|
||||||
android:typeface="monospace"
|
|
||||||
android:id="@+id/friend_reads"
|
|
||||||
android:text=""
|
|
||||||
android:padding="3dip" />
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
<TableRow>
|
|
||||||
<TextView
|
<TextView
|
||||||
android:text="Your identity:\n(You read)"
|
android:layout_width="fill_parent"
|
||||||
android:textSize="12sp"
|
android:layout_height="wrap_content"
|
||||||
android:padding="3dip" />
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
<TextView
|
android:text="Their identity (they read):"
|
||||||
android:id="@+id/you_read"
|
android:padding="7dip" />
|
||||||
android:textSize="20sp"
|
|
||||||
android:typeface="monospace"
|
|
||||||
android:text=""
|
|
||||||
android:padding="3dip" />
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
<TableRow>
|
|
||||||
<LinearLayout android:orientation="horizontal"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_span="2">
|
|
||||||
|
|
||||||
<Button android:id="@+id/verified_button"
|
<TextView
|
||||||
android:padding="10dip"
|
android:layout_width="fill_parent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:text="Verified!"/>
|
android:typeface="monospace"
|
||||||
|
android:id="@+id/friend_reads"
|
||||||
<Button android:id="@+id/abort_button"
|
android:text=""
|
||||||
android:padding="10dip"
|
android:padding="7dip" />
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
<TextView
|
||||||
android:text="Abort"/>
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
<Button android:id="@+id/compare_button"
|
android:text="Your identity (you read):"
|
||||||
android:padding="10dip"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:layout_width="wrap_content"
|
android:padding="7dip" />
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Compare"/>
|
<TextView
|
||||||
|
android:layout_width="fill_parent"
|
||||||
<Button android:id="@+id/cancel_button"
|
android:layout_height="wrap_content"
|
||||||
android:padding="10dip"
|
android:id="@+id/you_read"
|
||||||
android:layout_width="wrap_content"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:layout_height="wrap_content"
|
android:typeface="monospace"
|
||||||
android:text="Cancel" />
|
android:text=""
|
||||||
|
android:padding="7dip" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</TableRow>
|
|
||||||
</TableLayout>
|
|
||||||
</ScrollView>
|
</ScrollView>
|
@ -1,105 +1,48 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
<TableLayout
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:shrinkColumns="1">
|
|
||||||
|
|
||||||
<TableRow>
|
<LinearLayout android:layout_width="fill_parent"
|
||||||
<TextView
|
android:layout_height="wrap_content"
|
||||||
android:textSize="12sp"
|
android:layout_marginLeft="16dip"
|
||||||
android:text="Your friend reads this:"
|
android:layout_marginRight="16dip"
|
||||||
android:padding="3dip" />
|
android:layout_gravity="center"
|
||||||
<TextView
|
android:orientation="vertical">
|
||||||
android:textSize="20sp"
|
|
||||||
android:typeface="monospace"
|
|
||||||
android:id="@+id/friend_reads"
|
|
||||||
android:text=""
|
|
||||||
android:padding="3dip" />
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
<TableRow>
|
<TextView
|
||||||
<TextView
|
android:layout_height="wrap_content"
|
||||||
android:text="You read this:"
|
android:layout_width="fill_parent"
|
||||||
android:textSize="12sp"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:padding="3dip" />
|
android:text="They read this:"
|
||||||
<TextView
|
android:padding="7dip" />
|
||||||
android:id="@+id/you_read"
|
|
||||||
android:textSize="20sp"
|
<TextView
|
||||||
android:typeface="monospace"
|
android:layout_height="wrap_content"
|
||||||
android:text=""
|
android:layout_width="fill_parent"
|
||||||
android:padding="3dip" />
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
</TableRow>
|
android:typeface="monospace"
|
||||||
|
android:id="@+id/friend_reads"
|
||||||
<TableRow>
|
android:text=""
|
||||||
<LinearLayout android:orientation="horizontal"
|
android:padding="7dip" />
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
<TextView
|
||||||
android:layout_gravity="center"
|
android:layout_marginTop="10dip"
|
||||||
android:layout_span="2">
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:text="You read this:"
|
||||||
|
android:padding="7dip" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:id="@+id/you_read"
|
||||||
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
|
android:typeface="monospace"
|
||||||
|
android:text=""
|
||||||
|
android:padding="7dip" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<Button android:id="@+id/verified_button"
|
|
||||||
android:padding="10dip"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Verified!"/>
|
|
||||||
|
|
||||||
<Button android:id="@+id/abort_button"
|
|
||||||
android:padding="10dip"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Abort"/>
|
|
||||||
|
|
||||||
<Button android:id="@+id/compare_button"
|
|
||||||
android:padding="10dip"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Compare"/>
|
|
||||||
|
|
||||||
<Button android:id="@+id/cancel_button"
|
|
||||||
android:padding="10dip"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="Cancel" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</TableRow>
|
|
||||||
|
|
||||||
</TableLayout>
|
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
<!---->
|
|
||||||
<!--<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"-->
|
|
||||||
<!-- android:layout_width="fill_parent"-->
|
|
||||||
<!-- android:layout_height="wrap_content"-->
|
|
||||||
<!-- android:orientation="vertical"-->
|
|
||||||
<!-- android:padding="10px">-->
|
|
||||||
<!-- -->
|
|
||||||
<!-- <TextView android:id="@+id/your_fingerprint"-->
|
|
||||||
<!-- android:layout_width="fill_parent"-->
|
|
||||||
<!-- android:layout_height="wrap_content" -->
|
|
||||||
<!-- android:layout_marginBottom="10px"/>-->
|
|
||||||
<!---->
|
|
||||||
<!-- <TextView android:id="@+id/their_fingerprint"-->
|
|
||||||
<!-- android:layout_width="fill_parent"-->
|
|
||||||
<!-- android:layout_height="wrap_content"-->
|
|
||||||
<!-- android:layout_marginBottom="20px" />-->
|
|
||||||
<!-- -->
|
|
||||||
<!-- <LinearLayout android:layout_width="fill_parent"-->
|
|
||||||
<!-- android:layout_height="wrap_content"-->
|
|
||||||
<!-- android:orientation="horizontal">-->
|
|
||||||
<!-- -->
|
|
||||||
<!-- <Button android:id="@+id/ok_button"-->
|
|
||||||
<!-- android:paddingLeft="30px"-->
|
|
||||||
<!-- android:paddingRight="30px"-->
|
|
||||||
<!-- android:layout_width="wrap_content"-->
|
|
||||||
<!-- android:layout_height="wrap_content"-->
|
|
||||||
<!-- android:layout_marginRight="15px"-->
|
|
||||||
<!-- android:text="Ok"-->
|
|
||||||
<!-- android:gravity="right"/>-->
|
|
||||||
<!-- -->
|
|
||||||
<!-- </LinearLayout>-->
|
|
||||||
<!--</LinearLayout>-->
|
|
||||||
<!---->
|
|
||||||
<!---->
|
|
||||||
|
@ -1,50 +1,49 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
<TableLayout
|
<TableLayout
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:shrinkColumns="1">
|
android:shrinkColumns="1">
|
||||||
|
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TextView
|
<TextView
|
||||||
android:textSize="12sp"
|
android:textSize="12sp"
|
||||||
android:text="Your identity:"
|
android:text="Your identity:"
|
||||||
android:padding="3dip" />
|
android:padding="3dip" />
|
||||||
<TextView
|
<TextView
|
||||||
android:textSize="20sp"
|
android:textSize="20sp"
|
||||||
android:typeface="monospace"
|
android:typeface="monospace"
|
||||||
android:id="@+id/identity_fingerprint"
|
android:id="@+id/identity_fingerprint"
|
||||||
android:text=""
|
android:text=""
|
||||||
android:padding="3dip" />
|
android:padding="3dip" />
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
|
||||||
<TableRow>
|
|
||||||
<LinearLayout android:orientation="horizontal"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center"
|
|
||||||
android:layout_span="2">
|
|
||||||
|
|
||||||
<Button android:id="@+id/ok_button"
|
<TableRow>
|
||||||
android:layout_margin="10dip"
|
<LinearLayout android:orientation="horizontal"
|
||||||
android:padding="5dip"
|
android:layout_width="fill_parent"
|
||||||
android:layout_width="100dip"
|
android:layout_height="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_gravity="center"
|
||||||
android:text="Ok"/>
|
android:layout_span="2">
|
||||||
|
|
||||||
<Button android:id="@+id/compare_button"
|
<Button android:id="@+id/compare_button"
|
||||||
android:layout_margin="10dip"
|
android:layout_margin="10dip"
|
||||||
android:padding="5dip"
|
android:padding="5dip"
|
||||||
android:layout_width="100dip"
|
android:layout_width="100dip"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Compare" />
|
android:text="Compare" />
|
||||||
|
|
||||||
|
<Button android:id="@+id/ok_button"
|
||||||
</LinearLayout>
|
android:layout_margin="10dip"
|
||||||
|
android:padding="5dip"
|
||||||
</TableRow>
|
android:layout_width="100dip"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Ok"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</TableRow>
|
||||||
|
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
@ -2,7 +2,7 @@
|
|||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:title="Security"
|
<item android:title="Security"
|
||||||
android:id="@+id/menu_security"
|
android:id="@+id/menu_security"
|
||||||
android:icon="@drawable/ic_menu_lock_unverified_holo_dark"
|
android:icon="@drawable/ic_menu_lock_verified_holo_dark"
|
||||||
android:showAsAction="ifRoom">
|
android:showAsAction="ifRoom">
|
||||||
<menu>
|
<menu>
|
||||||
<item android:title="Verify Session"
|
<item android:title="Verify Session"
|
||||||
|
19
res/menu/key_scanning.xml
Normal file
19
res/menu/key_scanning.xml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
|
||||||
|
<item android:title="Compare"
|
||||||
|
android:id="@+id/menu_barcode"
|
||||||
|
android:icon="@drawable/ic_menu_barcode"
|
||||||
|
android:showAsAction="ifRoom">
|
||||||
|
|
||||||
|
<menu>
|
||||||
|
<item android:title="Scan to compare"
|
||||||
|
android:id="@+id/menu_scan"/>
|
||||||
|
|
||||||
|
<item android:title="Get scanned to compare"
|
||||||
|
android:id="@+id/menu_get_scanned"/>
|
||||||
|
|
||||||
|
</menu>
|
||||||
|
|
||||||
|
</item>
|
||||||
|
</menu>
|
7
res/menu/verify_keys.xml
Normal file
7
res/menu/verify_keys.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<item android:title="Verified"
|
||||||
|
android:id="@+id/menu_session_verified"
|
||||||
|
android:icon="@drawable/ic_menu_done_holo_dark"
|
||||||
|
android:showAsAction="ifRoom" />
|
||||||
|
</menu>
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (C) 2011 Whisper Systems
|
* Copyright (C) 2011 Whisper Systems
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
@ -10,62 +10,68 @@
|
|||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
|
import com.actionbarsherlock.app.SherlockActivity;
|
||||||
|
import com.actionbarsherlock.view.Menu;
|
||||||
|
import com.actionbarsherlock.view.MenuInflater;
|
||||||
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
|
import com.google.zxing.integration.android.IntentIntegrator;
|
||||||
|
import com.google.zxing.integration.android.IntentResult;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.crypto.SerializableKey;
|
import org.thoughtcrime.securesms.crypto.SerializableKey;
|
||||||
import org.thoughtcrime.securesms.util.Base64;
|
import org.thoughtcrime.securesms.util.Base64;
|
||||||
import org.thoughtcrime.securesms.util.Dialogs;
|
import org.thoughtcrime.securesms.util.Dialogs;
|
||||||
|
|
||||||
import android.app.Activity;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.view.ContextMenu;
|
|
||||||
import android.view.ContextMenu.ContextMenuInfo;
|
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.google.zxing.integration.android.IntentIntegrator;
|
|
||||||
import com.google.zxing.integration.android.IntentResult;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity for initiating/receiving key QR code scans.
|
* Activity for initiating/receiving key QR code scans.
|
||||||
*
|
*
|
||||||
* @author Moxie Marlinspike
|
* @author Moxie Marlinspike
|
||||||
*/
|
*/
|
||||||
public abstract class KeyScanningActivity extends Activity {
|
public abstract class KeyScanningActivity extends SherlockActivity {
|
||||||
|
|
||||||
private static final int MENU_ITEM_SCAN = 1;
|
|
||||||
private static final int MENU_ITEM_GET_SCANNED = 2;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
menu.add(0, MENU_ITEM_SCAN, Menu.NONE, getScanString());
|
super.onPrepareOptionsMenu(menu);
|
||||||
menu.add(0, MENU_ITEM_GET_SCANNED, Menu.NONE, getDisplayString());
|
|
||||||
|
MenuInflater inflater = this.getSupportMenuInflater();
|
||||||
|
menu.clear();
|
||||||
|
|
||||||
|
inflater.inflate(R.menu.key_scanning, menu);
|
||||||
|
|
||||||
|
menu.findItem(R.id.menu_scan).setTitle(getScanString());
|
||||||
|
menu.findItem(R.id.menu_get_scanned).setTitle(getDisplayString());
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onContextItemSelected(MenuItem item) {
|
|
||||||
|
|
||||||
switch(item.getItemId()) {
|
@Override
|
||||||
case MENU_ITEM_SCAN: initiateScan(); return true;
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
case MENU_ITEM_GET_SCANNED: initiateDisplay(); return true;
|
super.onOptionsItemSelected(item);
|
||||||
|
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case R.id.menu_scan: initiateScan(); return true;
|
||||||
|
case R.id.menu_get_scanned: initiateDisplay(); return true;
|
||||||
|
case android.R.id.home: finish(); return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
|
||||||
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
|
IntentResult scanResult = IntentIntegrator.parseActivityResult(requestCode, resultCode, intent);
|
||||||
|
|
||||||
if ((scanResult != null) && (scanResult.getContents() != null)) {
|
if ((scanResult != null) && (scanResult.getContents() != null)) {
|
||||||
String data = scanResult.getContents();
|
String data = scanResult.getContents();
|
||||||
|
|
||||||
if (data.equals(Base64.encodeBytes(getIdentityKeyToCompare().serialize()))) {
|
if (data.equals(Base64.encodeBytes(getIdentityKeyToCompare().serialize()))) {
|
||||||
Dialogs.displayAlert(this, getVerifiedTitle(), getVerifiedMessage(), android.R.drawable.ic_dialog_info);
|
Dialogs.displayAlert(this, getVerifiedTitle(), getVerifiedMessage(), android.R.drawable.ic_dialog_info);
|
||||||
} else {
|
} else {
|
||||||
@ -75,11 +81,11 @@ public abstract class KeyScanningActivity extends Activity {
|
|||||||
Toast.makeText(this, "No scanned key found!", Toast.LENGTH_LONG).show();
|
Toast.makeText(this, "No scanned key found!", Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initiateScan() {
|
protected void initiateScan() {
|
||||||
IntentIntegrator.initiateScan(this);
|
IntentIntegrator.initiateScan(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void initiateDisplay() {
|
protected void initiateDisplay() {
|
||||||
IntentIntegrator.shareText(this, Base64.encodeBytes(getIdentityKeyToDisplay().serialize()));
|
IntentIntegrator.shareText(this, Base64.encodeBytes(getIdentityKeyToDisplay().serialize()));
|
||||||
}
|
}
|
||||||
@ -92,8 +98,8 @@ public abstract class KeyScanningActivity extends Activity {
|
|||||||
|
|
||||||
protected abstract SerializableKey getIdentityKeyToCompare();
|
protected abstract SerializableKey getIdentityKeyToCompare();
|
||||||
protected abstract SerializableKey getIdentityKeyToDisplay();
|
protected abstract SerializableKey getIdentityKeyToDisplay();
|
||||||
|
|
||||||
protected abstract String getVerifiedTitle();
|
protected abstract String getVerifiedTitle();
|
||||||
protected abstract String getVerifiedMessage();
|
protected abstract String getVerifiedMessage();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
40
src/org/thoughtcrime/securesms/KeyVerifyingActivity.java
Normal file
40
src/org/thoughtcrime/securesms/KeyVerifyingActivity.java
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
|
||||||
|
import com.actionbarsherlock.view.Menu;
|
||||||
|
import com.actionbarsherlock.view.MenuInflater;
|
||||||
|
import com.actionbarsherlock.view.MenuItem;
|
||||||
|
|
||||||
|
public abstract class KeyVerifyingActivity extends KeyScanningActivity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle bundle) {
|
||||||
|
super.onCreate(bundle);
|
||||||
|
this.getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onPrepareOptionsMenu(Menu menu) {
|
||||||
|
super.onPrepareOptionsMenu(menu);
|
||||||
|
|
||||||
|
MenuInflater inflater = this.getSupportMenuInflater();
|
||||||
|
inflater.inflate(R.menu.verify_keys, menu);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
super.onOptionsItemSelected(item);
|
||||||
|
|
||||||
|
switch (item.getItemId()) {
|
||||||
|
case R.id.menu_session_verified: handleVerified(); return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract void handleVerified();
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (C) 2011 Whisper Systems
|
* Copyright (C) 2011 Whisper Systems
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
@ -10,170 +10,116 @@
|
|||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
|
import android.app.AlertDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.TextView;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.crypto.IdentityKey;
|
import org.thoughtcrime.securesms.crypto.IdentityKey;
|
||||||
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
|
import org.thoughtcrime.securesms.crypto.IdentityKeyUtil;
|
||||||
import org.thoughtcrime.securesms.crypto.KeyUtil;
|
|
||||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||||
import org.thoughtcrime.securesms.database.SessionRecord;
|
import org.thoughtcrime.securesms.database.SessionRecord;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.thoughtcrime.securesms.util.MemoryCleaner;
|
import org.thoughtcrime.securesms.util.MemoryCleaner;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.View;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity for verifying identity keys.
|
* Activity for verifying identity keys.
|
||||||
*
|
*
|
||||||
* @author Moxie Marlinspike
|
* @author Moxie Marlinspike
|
||||||
*/
|
*/
|
||||||
public class VerifyIdentityActivity extends KeyScanningActivity {
|
public class VerifyIdentityActivity extends KeyVerifyingActivity {
|
||||||
|
|
||||||
private Recipient recipient;
|
private Recipient recipient;
|
||||||
private MasterSecret masterSecret;
|
private MasterSecret masterSecret;
|
||||||
|
|
||||||
private TextView localIdentityFingerprint;
|
private TextView localIdentityFingerprint;
|
||||||
private TextView remoteIdentityFingerprint;
|
private TextView remoteIdentityFingerprint;
|
||||||
|
|
||||||
private Button verifiedButton;
|
|
||||||
private Button abortButton;
|
|
||||||
private Button cancelButton;
|
|
||||||
private Button compareButton;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle state) {
|
public void onCreate(Bundle state) {
|
||||||
super.onCreate(state);
|
super.onCreate(state);
|
||||||
setContentView(R.layout.verify_identity_activity);
|
setContentView(R.layout.verify_identity_activity);
|
||||||
|
|
||||||
initializeResources();
|
initializeResources();
|
||||||
initializeFingerprints();
|
initializeFingerprints();
|
||||||
initializeListeners();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
MemoryCleaner.clean(masterSecret);
|
MemoryCleaner.clean(masterSecret);
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void handleVerified() {
|
||||||
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
|
builder.setIcon(android.R.drawable.ic_dialog_alert);
|
||||||
|
builder.setTitle("Mark Identity Verified?");
|
||||||
|
builder.setMessage("Are you sure you have validated the recipients' identity fingerprint " +
|
||||||
|
"and would like to mark it as verified?");
|
||||||
|
|
||||||
|
builder.setPositiveButton("Mark Verified", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
SessionRecord sessionRecord = new SessionRecord(VerifyIdentityActivity.this,
|
||||||
|
masterSecret, recipient);
|
||||||
|
IdentityKey identityKey = sessionRecord.getIdentityKey();
|
||||||
|
String recipientName = recipient.getName();
|
||||||
|
|
||||||
|
Intent intent = new Intent(VerifyIdentityActivity.this,
|
||||||
|
SaveIdentityActivity.class);
|
||||||
|
|
||||||
|
intent.putExtra("name_suggestion", recipientName);
|
||||||
|
intent.putExtra("master_secret", masterSecret);
|
||||||
|
intent.putExtra("identity_key", identityKey);
|
||||||
|
|
||||||
|
startActivity(intent);
|
||||||
|
finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.setNegativeButton("Cancel", null);
|
||||||
|
builder.show();
|
||||||
|
}
|
||||||
|
|
||||||
private void initializeLocalIdentityKey() {
|
private void initializeLocalIdentityKey() {
|
||||||
if (!IdentityKeyUtil.hasIdentityKey(this)) {
|
if (!IdentityKeyUtil.hasIdentityKey(this)) {
|
||||||
localIdentityFingerprint.setText("You do not have an identity key.");
|
localIdentityFingerprint.setText("You do not have an identity key.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
localIdentityFingerprint.setText(IdentityKeyUtil.getFingerprint(this));
|
localIdentityFingerprint.setText(IdentityKeyUtil.getFingerprint(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeRemoteIdentityKey() {
|
private void initializeRemoteIdentityKey() {
|
||||||
SessionRecord sessionRecord = new SessionRecord(this, masterSecret, recipient);
|
SessionRecord sessionRecord = new SessionRecord(this, masterSecret, recipient);
|
||||||
IdentityKey identityKey = sessionRecord.getIdentityKey();
|
IdentityKey identityKey = sessionRecord.getIdentityKey();
|
||||||
|
|
||||||
if (identityKey == null) {
|
if (identityKey == null) {
|
||||||
remoteIdentityFingerprint.setText("Recipient has no identity key.");
|
remoteIdentityFingerprint.setText("Recipient has no identity key.");
|
||||||
verifiedButton.setEnabled(false);
|
|
||||||
} else {
|
} else {
|
||||||
remoteIdentityFingerprint.setText(identityKey.getFingerprint());
|
remoteIdentityFingerprint.setText(identityKey.getFingerprint());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeListeners() {
|
|
||||||
verifiedButton.setOnClickListener(new VerifiedButtonListener());
|
|
||||||
cancelButton.setOnClickListener(new CancelButtonListener());
|
|
||||||
abortButton.setOnClickListener(new AbortButtonListener());
|
|
||||||
compareButton.setOnClickListener(new CompareButtonListener());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initializeFingerprints() {
|
private void initializeFingerprints() {
|
||||||
initializeLocalIdentityKey();
|
initializeLocalIdentityKey();
|
||||||
initializeRemoteIdentityKey();
|
initializeRemoteIdentityKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeResources() {
|
private void initializeResources() {
|
||||||
localIdentityFingerprint = (TextView)findViewById(R.id.you_read);
|
localIdentityFingerprint = (TextView)findViewById(R.id.you_read);
|
||||||
remoteIdentityFingerprint = (TextView)findViewById(R.id.friend_reads);
|
remoteIdentityFingerprint = (TextView)findViewById(R.id.friend_reads);
|
||||||
recipient = (Recipient)this.getIntent().getParcelableExtra("recipient");
|
recipient = (Recipient)this.getIntent().getParcelableExtra("recipient");
|
||||||
masterSecret = (MasterSecret)this.getIntent().getParcelableExtra("master_secret");
|
masterSecret = (MasterSecret)this.getIntent().getParcelableExtra("master_secret");
|
||||||
verifiedButton = (Button)findViewById(R.id.verified_button);
|
|
||||||
abortButton = (Button)findViewById(R.id.abort_button);
|
|
||||||
cancelButton = (Button)findViewById(R.id.cancel_button);
|
|
||||||
compareButton = (Button)findViewById(R.id.compare_button);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void abortSession() {
|
|
||||||
KeyUtil.abortSessionFor(this, recipient);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void saveRemoteIdentity() {
|
|
||||||
SessionRecord sessionRecord = new SessionRecord(this, masterSecret, recipient);
|
|
||||||
IdentityKey identityKey = sessionRecord.getIdentityKey();
|
|
||||||
String recipientName = recipient.getName();
|
|
||||||
Intent intent = new Intent(this, SaveIdentityActivity.class);
|
|
||||||
intent.putExtra("name_suggestion", recipientName);
|
|
||||||
intent.putExtra("master_secret", masterSecret);
|
|
||||||
intent.putExtra("identity_key", identityKey);
|
|
||||||
|
|
||||||
startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private class CancelButtonListener implements View.OnClickListener {
|
|
||||||
public void onClick(View v) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class CompareButtonListener implements View.OnClickListener {
|
|
||||||
public void onClick(View v) {
|
|
||||||
registerForContextMenu(compareButton);
|
|
||||||
compareButton.showContextMenu();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class AbortButtonListener implements View.OnClickListener {
|
|
||||||
public void onClick(View v) {
|
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(VerifyIdentityActivity.this);
|
|
||||||
dialogBuilder.setTitle("Abort Session?");
|
|
||||||
dialogBuilder.setIcon(android.R.drawable.ic_dialog_info);
|
|
||||||
dialogBuilder.setMessage("Are you sure that you would like to abort this secure session?");
|
|
||||||
dialogBuilder.setCancelable(true);
|
|
||||||
dialogBuilder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface arg0, int arg1) {
|
|
||||||
abortSession();
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
dialogBuilder.setNegativeButton(R.string.no, null);
|
|
||||||
dialogBuilder.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class VerifiedButtonListener implements View.OnClickListener {
|
|
||||||
public void onClick(View v) {
|
|
||||||
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(VerifyIdentityActivity.this);
|
|
||||||
dialogBuilder.setTitle("Save Identity Key?");
|
|
||||||
dialogBuilder.setIcon(android.R.drawable.ic_dialog_info);
|
|
||||||
dialogBuilder.setMessage("Are you sure that you would like to mark this as a valid identity key for all future correspondence with this recipient? You should only do this if you have actually verified the fingerprint.");
|
|
||||||
dialogBuilder.setCancelable(true);
|
|
||||||
dialogBuilder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface arg0, int arg1) {
|
|
||||||
saveRemoteIdentity();
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
dialogBuilder.setNegativeButton(R.string.no, null);
|
|
||||||
dialogBuilder.show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -182,22 +128,22 @@ public class VerifyIdentityActivity extends KeyScanningActivity {
|
|||||||
Toast.makeText(this, "You don't have an identity key!", Toast.LENGTH_LONG).show();
|
Toast.makeText(this, "You don't have an identity key!", Toast.LENGTH_LONG).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
super.initiateDisplay();
|
super.initiateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initiateScan() {
|
protected void initiateScan() {
|
||||||
SessionRecord sessionRecord = new SessionRecord(this, masterSecret, recipient);
|
SessionRecord sessionRecord = new SessionRecord(this, masterSecret, recipient);
|
||||||
IdentityKey identityKey = sessionRecord.getIdentityKey();
|
IdentityKey identityKey = sessionRecord.getIdentityKey();
|
||||||
|
|
||||||
if (identityKey == null) {
|
if (identityKey == null) {
|
||||||
Toast.makeText(this, "Recipient has no identity key!", Toast.LENGTH_LONG);
|
Toast.makeText(this, "Recipient has no identity key!", Toast.LENGTH_LONG);
|
||||||
} else {
|
} else {
|
||||||
super.initiateScan();
|
super.initiateScan();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getScanString() {
|
protected String getScanString() {
|
||||||
return "Scan their key to compare";
|
return "Scan their key to compare";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright (C) 2011 Whisper Systems
|
* Copyright (C) 2011 Whisper Systems
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
@ -10,13 +10,17 @@
|
|||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package org.thoughtcrime.securesms;
|
package org.thoughtcrime.securesms;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.crypto.KeyUtil;
|
import android.app.AlertDialog;
|
||||||
|
import android.content.DialogInterface;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||||
import org.thoughtcrime.securesms.crypto.SerializableKey;
|
import org.thoughtcrime.securesms.crypto.SerializableKey;
|
||||||
import org.thoughtcrime.securesms.database.SessionRecord;
|
import org.thoughtcrime.securesms.database.SessionRecord;
|
||||||
@ -24,131 +28,88 @@ import org.thoughtcrime.securesms.recipients.Recipient;
|
|||||||
import org.thoughtcrime.securesms.util.Hex;
|
import org.thoughtcrime.securesms.util.Hex;
|
||||||
import org.thoughtcrime.securesms.util.MemoryCleaner;
|
import org.thoughtcrime.securesms.util.MemoryCleaner;
|
||||||
|
|
||||||
import android.app.AlertDialog;
|
|
||||||
import android.content.DialogInterface;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.View.OnClickListener;
|
|
||||||
import android.widget.Button;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity for verifying session keys.
|
* Activity for verifying session keys.
|
||||||
*
|
*
|
||||||
* @author Moxie Marlinspike
|
* @author Moxie Marlinspike
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class VerifyKeysActivity extends KeyScanningActivity {
|
public class VerifyKeysActivity extends KeyVerifyingActivity {
|
||||||
|
|
||||||
private byte[] yourFingerprintBytes;
|
private byte[] yourFingerprintBytes;
|
||||||
private byte[] theirFingerprintBytes;
|
private byte[] theirFingerprintBytes;
|
||||||
|
|
||||||
private TextView yourFingerprint;
|
private TextView yourFingerprint;
|
||||||
private TextView theirFingerprint;
|
private TextView theirFingerprint;
|
||||||
private Button verifiedButton;
|
|
||||||
private Button abortButton;
|
|
||||||
private Button cancelButton;
|
|
||||||
private Button compareButton;
|
|
||||||
private Recipient recipient;
|
private Recipient recipient;
|
||||||
private MasterSecret masterSecret;
|
private MasterSecret masterSecret;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle state) {
|
protected void onCreate(Bundle state) {
|
||||||
super.onCreate(state);
|
super.onCreate(state);
|
||||||
setContentView(R.layout.verify_keys_activity);
|
setContentView(R.layout.verify_keys_activity);
|
||||||
|
|
||||||
initializeResources();
|
initializeResources();
|
||||||
initializeFingerprints();
|
initializeFingerprints();
|
||||||
initializeCallbacks();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
MemoryCleaner.clean(masterSecret);
|
MemoryCleaner.clean(masterSecret);
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeCallbacks() {
|
@Override
|
||||||
this.verifiedButton.setOnClickListener(new VerifiedListener());
|
protected void handleVerified() {
|
||||||
this.abortButton.setOnClickListener(new AbortListener());
|
AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
this.cancelButton.setOnClickListener(new CancelListener());
|
builder.setIcon(android.R.drawable.ic_dialog_alert);
|
||||||
this.compareButton.setOnClickListener(new CompareListener());
|
builder.setTitle("Mark Session Verified?");
|
||||||
|
builder.setMessage("Are you sure that you have validated these fingerprints and " +
|
||||||
|
"would like to mark this session as verified?");
|
||||||
|
builder.setPositiveButton("Mark Verified", new DialogInterface.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
SessionRecord sessionRecord = new SessionRecord(VerifyKeysActivity.this, masterSecret,
|
||||||
|
recipient);
|
||||||
|
sessionRecord.setVerifiedSessionKey(true);
|
||||||
|
sessionRecord.save();
|
||||||
|
VerifyKeysActivity.this.finish();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
builder.setNegativeButton("Cancel", null);
|
||||||
|
builder.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeResources() {
|
private void initializeResources() {
|
||||||
this.recipient = (Recipient)this.getIntent().getParcelableExtra("recipient");
|
this.recipient = (Recipient)this.getIntent().getParcelableExtra("recipient");
|
||||||
this.masterSecret = (MasterSecret)this.getIntent().getParcelableExtra("master_secret");
|
this.masterSecret = (MasterSecret)this.getIntent().getParcelableExtra("master_secret");
|
||||||
this.yourFingerprint = (TextView)findViewById(R.id.you_read);
|
this.yourFingerprint = (TextView)findViewById(R.id.you_read);
|
||||||
this.theirFingerprint = (TextView)findViewById(R.id.friend_reads);
|
this.theirFingerprint = (TextView)findViewById(R.id.friend_reads);
|
||||||
this.verifiedButton = (Button)findViewById(R.id.verified_button);
|
|
||||||
this.abortButton = (Button)findViewById(R.id.abort_button);
|
|
||||||
this.cancelButton = (Button)findViewById(R.id.cancel_button);
|
|
||||||
this.compareButton = (Button)findViewById(R.id.compare_button);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeFingerprints() {
|
private void initializeFingerprints() {
|
||||||
SessionRecord session = new SessionRecord(this, masterSecret, recipient);
|
SessionRecord session = new SessionRecord(this, masterSecret, recipient);
|
||||||
this.yourFingerprintBytes = session.getLocalFingerprint();
|
this.yourFingerprintBytes = session.getLocalFingerprint();
|
||||||
this.theirFingerprintBytes = session.getRemoteFingerprint();
|
this.theirFingerprintBytes = session.getRemoteFingerprint();
|
||||||
|
|
||||||
this.yourFingerprint.setText(Hex.toString(yourFingerprintBytes));
|
this.yourFingerprint.setText(Hex.toString(yourFingerprintBytes));
|
||||||
this.theirFingerprint.setText(Hex.toString(theirFingerprintBytes));
|
this.theirFingerprint.setText(Hex.toString(theirFingerprintBytes));
|
||||||
}
|
}
|
||||||
|
|
||||||
private class VerifiedListener implements OnClickListener {
|
|
||||||
public void onClick(View v) {
|
|
||||||
SessionRecord sessionRecord = new SessionRecord(VerifyKeysActivity.this, masterSecret, recipient);
|
|
||||||
sessionRecord.setVerifiedSessionKey(true);
|
|
||||||
sessionRecord.save();
|
|
||||||
VerifyKeysActivity.this.finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class CancelListener implements OnClickListener {
|
|
||||||
public void onClick(View v) {
|
|
||||||
VerifyKeysActivity.this.finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class CompareListener implements View.OnClickListener {
|
|
||||||
public void onClick(View v) {
|
|
||||||
registerForContextMenu(compareButton);
|
|
||||||
compareButton.showContextMenu();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class AbortListener implements OnClickListener {
|
|
||||||
public void onClick(View v) {
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(VerifyKeysActivity.this);
|
|
||||||
builder.setTitle("Abort Secure Session Confirmation");
|
|
||||||
builder.setIcon(android.R.drawable.ic_dialog_alert);
|
|
||||||
builder.setCancelable(true);
|
|
||||||
builder.setMessage("Are you sure that you want to abort this secure session?");
|
|
||||||
builder.setPositiveButton(R.string.yes, new AbortConfirmListener());
|
|
||||||
builder.setNegativeButton(R.string.no, null);
|
|
||||||
builder.show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class AbortConfirmListener implements DialogInterface.OnClickListener {
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
KeyUtil.abortSessionFor(VerifyKeysActivity.this, recipient);
|
|
||||||
VerifyKeysActivity.this.finish();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getDisplayString() {
|
protected String getDisplayString() {
|
||||||
return "Get my fingerprint scanned";
|
return "Get my fingerprint scanned";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getScanString() {
|
protected String getScanString() {
|
||||||
return "Scan their fingerprint";
|
return "Scan their fingerprint";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected SerializableKey getIdentityKeyToCompare() {
|
protected SerializableKey getIdentityKeyToCompare() {
|
||||||
return new FingerprintKey(theirFingerprintBytes);
|
return new FingerprintKey(theirFingerprintBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,14 +137,14 @@ public class VerifyKeysActivity extends KeyScanningActivity {
|
|||||||
protected String getVerifiedTitle() {
|
protected String getVerifiedTitle() {
|
||||||
return "Verified!";
|
return "Verified!";
|
||||||
}
|
}
|
||||||
|
|
||||||
private class FingerprintKey implements SerializableKey {
|
private class FingerprintKey implements SerializableKey {
|
||||||
private final byte[] fingerprint;
|
private final byte[] fingerprint;
|
||||||
|
|
||||||
public FingerprintKey(byte[] fingerprint) {
|
public FingerprintKey(byte[] fingerprint) {
|
||||||
this.fingerprint = fingerprint;
|
this.fingerprint = fingerprint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] serialize() {
|
public byte[] serialize() {
|
||||||
return fingerprint;
|
return fingerprint;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user