remove notiion of nonce/identifier

This commit is contained in:
Vincent Breitmoser
2015-03-13 01:55:31 +01:00
parent b26e57ab19
commit a9a5551d95
18 changed files with 38 additions and 105 deletions

View File

@@ -770,8 +770,6 @@ public abstract class OperationResult implements Parcelable {
MSG_LV_MATCH_ERROR (LogLevel.ERROR, R.string.msg_lv_match_error), MSG_LV_MATCH_ERROR (LogLevel.ERROR, R.string.msg_lv_match_error),
MSG_LV_FP_OK (LogLevel.DEBUG, R.string.msg_lv_fp_ok), MSG_LV_FP_OK (LogLevel.DEBUG, R.string.msg_lv_fp_ok),
MSG_LV_FP_ERROR (LogLevel.ERROR, R.string.msg_lv_fp_error), MSG_LV_FP_ERROR (LogLevel.ERROR, R.string.msg_lv_fp_error),
MSG_LV_NONCE_OK (LogLevel.OK, R.string.msg_lv_nonce_ok),
MSG_LV_NONCE_ERROR (LogLevel.ERROR, R.string.msg_lv_nonce_error),
MSG_LV_FETCH (LogLevel.DEBUG, R.string.msg_lv_fetch), MSG_LV_FETCH (LogLevel.DEBUG, R.string.msg_lv_fetch),
MSG_LV_FETCH_REDIR (LogLevel.DEBUG, R.string.msg_lv_fetch_redir), MSG_LV_FETCH_REDIR (LogLevel.DEBUG, R.string.msg_lv_fetch_redir),

View File

@@ -41,7 +41,7 @@ public class WrappedUserAttribute implements Serializable {
public static final int UAT_NONE = 0; public static final int UAT_NONE = 0;
public static final int UAT_IMAGE = UserAttributeSubpacketTags.IMAGE_ATTRIBUTE; public static final int UAT_IMAGE = UserAttributeSubpacketTags.IMAGE_ATTRIBUTE;
public static final int UAT_LINKED_ID = 100; public static final int UAT_LINKED_ID = 101;
private PGPUserAttributeSubpacketVector mVector; private PGPUserAttributeSubpacketVector mVector;
@@ -82,7 +82,7 @@ public class WrappedUserAttribute implements Serializable {
public static WrappedUserAttribute fromData (byte[] data) throws IOException { public static WrappedUserAttribute fromData (byte[] data) throws IOException {
UserAttributeSubpacketInputStream in = UserAttributeSubpacketInputStream in =
new UserAttributeSubpacketInputStream(new ByteArrayInputStream(data)); new UserAttributeSubpacketInputStream(new ByteArrayInputStream(data));
ArrayList<UserAttributeSubpacket> list = new ArrayList<UserAttributeSubpacket>(); ArrayList<UserAttributeSubpacket> list = new ArrayList<>();
while (in.available() > 0) { while (in.available() > 0) {
list.add(in.readPacket()); list.add(in.readPacket());
} }
@@ -126,6 +126,7 @@ public class WrappedUserAttribute implements Serializable {
private void readObjectNoData() throws ObjectStreamException { private void readObjectNoData() throws ObjectStreamException {
} }
@SuppressWarnings("SimplifiableIfStatement")
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (!WrappedUserAttribute.class.isInstance(o)) { if (!WrappedUserAttribute.class.isInstance(o)) {

View File

@@ -61,16 +61,16 @@ public abstract class LinkedCookieResource extends LinkedResource {
return mSubUri; return mSubUri;
} }
public static String generate (Context context, byte[] fingerprint, int nonce) { public static String generate (Context context, byte[] fingerprint) {
return String.format("[Verifying my PGP key: openpgp4fpr:%s#%08x]", return String.format("[Verifying my PGP key: openpgp4fpr:%s]",
KeyFormattingUtils.convertFingerprintToHex(fingerprint), nonce); KeyFormattingUtils.convertFingerprintToHex(fingerprint));
} }
public static String generatePreview () { public static String generatePreview () {
return "[Verifying my PGP key: openpgp4fpr:0x…]"; return "[Verifying my PGP key: openpgp4fpr:0x…]";
} }
public LinkedVerifyResult verify(byte[] fingerprint, int nonce) { public LinkedVerifyResult verify(byte[] fingerprint) {
OperationLog log = new OperationLog(); OperationLog log = new OperationLog();
log.add(LogType.MSG_LV, 0); log.add(LogType.MSG_LV, 0);
@@ -84,7 +84,7 @@ public abstract class LinkedCookieResource extends LinkedResource {
Log.d(Constants.TAG, "Resource data: '" + res + "'"); Log.d(Constants.TAG, "Resource data: '" + res + "'");
return verifyString(log, 1, res, nonce, fingerprint); return verifyString(log, 1, res, fingerprint);
} }
@@ -96,7 +96,7 @@ public abstract class LinkedCookieResource extends LinkedResource {
protected LinkedVerifyResult verifyString (OperationLog log, int indent, protected LinkedVerifyResult verifyString (OperationLog log, int indent,
String res, String res,
int nonce, byte[] fingerprint) { byte[] fingerprint) {
log.add(LogType.MSG_LV_MATCH, indent); log.add(LogType.MSG_LV_MATCH, indent);
Matcher match = matchResource(log, indent+1, res); Matcher match = matchResource(log, indent+1, res);
@@ -106,27 +106,13 @@ public abstract class LinkedCookieResource extends LinkedResource {
} }
String candidateFp = match.group(1).toLowerCase(); String candidateFp = match.group(1).toLowerCase();
try {
int nonceCandidate = (int) Long.parseLong(match.group(2).toLowerCase(), 16);
if (nonce != nonceCandidate) {
log.add(LogType.MSG_LV_NONCE_ERROR, indent);
return new LinkedVerifyResult(LinkedVerifyResult.RESULT_ERROR, log);
}
} catch (NumberFormatException e) {
log.add(LogType.MSG_LV_NONCE_ERROR, indent);
return new LinkedVerifyResult(LinkedVerifyResult.RESULT_ERROR, log);
}
String fp = KeyFormattingUtils.convertFingerprintToHex(fingerprint); String fp = KeyFormattingUtils.convertFingerprintToHex(fingerprint);
if (!fp.equals(candidateFp)) { if (!fp.equals(candidateFp)) {
log.add(LogType.MSG_LV_FP_ERROR, indent); log.add(LogType.MSG_LV_FP_ERROR, indent);
return new LinkedVerifyResult(LinkedVerifyResult.RESULT_ERROR, log); return new LinkedVerifyResult(LinkedVerifyResult.RESULT_ERROR, log);
} }
log.add(LogType.MSG_LV_FP_OK, indent); log.add(LogType.MSG_LV_FP_OK, indent);
log.add(LogType.MSG_LV_NONCE_OK, indent);
return new LinkedVerifyResult(LinkedVerifyResult.RESULT_OK, log); return new LinkedVerifyResult(LinkedVerifyResult.RESULT_OK, log);
} }

View File

@@ -8,8 +8,6 @@ import org.sufficientlysecure.keychain.util.Log;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.nio.ByteBuffer;
import java.util.Arrays;
import android.content.Context; import android.content.Context;
import android.support.annotation.DrawableRes; import android.support.annotation.DrawableRes;
@@ -19,8 +17,8 @@ public class LinkedIdentity extends RawLinkedIdentity {
public final LinkedResource mResource; public final LinkedResource mResource;
protected LinkedIdentity(int nonce, URI uri, LinkedResource resource) { protected LinkedIdentity(URI uri, LinkedResource resource) {
super(nonce, uri); super(uri);
if (resource == null) { if (resource == null) {
throw new AssertionError("resource must not be null in a LinkedIdentity!"); throw new AssertionError("resource must not be null in a LinkedIdentity!");
} }
@@ -42,29 +40,27 @@ public class LinkedIdentity extends RawLinkedIdentity {
* subpacket can not be parsed as a valid linked id. * subpacket can not be parsed as a valid linked id.
*/ */
static RawLinkedIdentity fromAttributeSubpacket(UserAttributeSubpacket subpacket) { static RawLinkedIdentity fromAttributeSubpacket(UserAttributeSubpacket subpacket) {
if (subpacket.getType() != 100) { if (subpacket.getType() != 101) {
return null; return null;
} }
byte[] data = subpacket.getData(); byte[] data = subpacket.getData();
return fromSubpacketData(data); return fromSubpacketData(data);
} }
static RawLinkedIdentity fromSubpacketData(byte[] data) { static RawLinkedIdentity fromSubpacketData(byte[] data) {
try { try {
int nonce = ByteBuffer.wrap(data).getInt(); String uriStr = Strings.fromUTF8ByteArray(data);
String uriStr = Strings.fromUTF8ByteArray(Arrays.copyOfRange(data, 4, data.length));
URI uri = URI.create(uriStr); URI uri = URI.create(uriStr);
LinkedResource res = LinkedResource.fromUri(uri); LinkedResource res = LinkedResource.fromUri(uri);
if (res == null) { if (res == null) {
return new RawLinkedIdentity(nonce, uri); return new RawLinkedIdentity(uri);
} }
return new LinkedIdentity(nonce, uri, res); return new LinkedIdentity(uri, res);
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
Log.e(Constants.TAG, "error parsing uri in (suspected) linked id packet"); Log.e(Constants.TAG, "error parsing uri in (suspected) linked id packet");
@@ -72,8 +68,8 @@ public class LinkedIdentity extends RawLinkedIdentity {
} }
} }
public static RawLinkedIdentity fromResource (LinkedCookieResource res, int nonce) { public static RawLinkedIdentity fromResource (LinkedCookieResource res) {
return new RawLinkedIdentity(nonce, res.toUri()); return new RawLinkedIdentity(res.toUri());
} }

View File

@@ -23,7 +23,7 @@ public abstract class LinkedResource {
protected final HashMap<String,String> mParams; protected final HashMap<String,String> mParams;
static Pattern magicPattern = static Pattern magicPattern =
Pattern.compile("\\[Verifying my PGP key: openpgp4fpr:([a-zA-Z0-9]+)#([a-zA-Z0-9]+)\\]"); Pattern.compile("\\[Verifying my PGP key: openpgp4fpr:([a-zA-Z0-9]+)]");
protected LinkedResource(Set<String> flags, HashMap<String, String> params, URI uri) { protected LinkedResource(Set<String> flags, HashMap<String, String> params, URI uri) {
mFlags = flags; mFlags = flags;
@@ -31,8 +31,6 @@ public abstract class LinkedResource {
mSubUri = uri; mSubUri = uri;
} }
public abstract URI toUri();
public Set<String> getFlags () { public Set<String> getFlags () {
return new HashSet<>(mFlags); return new HashSet<>(mFlags);
} }

View File

@@ -5,48 +5,27 @@ import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.WrappedUserAttribute; import org.sufficientlysecure.keychain.pgp.WrappedUserAttribute;
import java.net.URI; import java.net.URI;
import java.nio.ByteBuffer;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.support.annotation.DrawableRes; import android.support.annotation.DrawableRes;
/** The RawLinkedIdentity contains raw parsed data from a Linked Identity subpacket. */ /** The RawLinkedIdentity contains raw parsed data from a Linked Identity subpacket. */
public class RawLinkedIdentity { public class RawLinkedIdentity {
public final int mNonce;
public final URI mUri; public final URI mUri;
protected RawLinkedIdentity(int nonce, URI uri) { protected RawLinkedIdentity(URI uri) {
mNonce = nonce;
mUri = uri; mUri = uri;
} }
public byte[] getEncoded() { public byte[] getEncoded() {
byte[] uriData = Strings.toUTF8ByteArray(mUri.toASCIIString()); return Strings.toUTF8ByteArray(mUri.toASCIIString());
ByteBuffer buf = ByteBuffer.allocate(4 + uriData.length);
buf.putInt(mNonce);
buf.put(uriData);
return buf.array();
} }
public WrappedUserAttribute toUserAttribute () { public WrappedUserAttribute toUserAttribute () {
return WrappedUserAttribute.fromSubpacket(WrappedUserAttribute.UAT_LINKED_ID, getEncoded()); return WrappedUserAttribute.fromSubpacket(WrappedUserAttribute.UAT_LINKED_ID, getEncoded());
} }
public static int generateNonce() {
// TODO make this actually random
// byte[] data = new byte[4];
// new SecureRandom().nextBytes(data);
// return Hex.toHexString(data);
// debug for now
return 0x8a9bad32;
}
public @DrawableRes int getDisplayIcon() { public @DrawableRes int getDisplayIcon() {
return R.drawable.ic_warning_grey_24dp; return R.drawable.ic_warning_grey_24dp;
} }

View File

@@ -41,10 +41,10 @@ public class DnsResource extends LinkedCookieResource {
mType = type; mType = type;
} }
public static String generateText (Context context, byte[] fingerprint, int nonce) { public static String generateText (Context context, byte[] fingerprint) {
return String.format("pgpid+cookie=%s;%08x", return String.format("pgpid+cookie=%s",
KeyFormattingUtils.convertFingerprintToHex(fingerprint), nonce); KeyFormattingUtils.convertFingerprintToHex(fingerprint));
} }

View File

@@ -31,8 +31,8 @@ public class GenericHttpsResource extends LinkedCookieResource {
super(flags, params, uri); super(flags, params, uri);
} }
public static String generateText (Context context, byte[] fingerprint, int nonce) { public static String generateText (Context context, byte[] fingerprint) {
String cookie = LinkedCookieResource.generate(context, fingerprint, nonce); String cookie = LinkedCookieResource.generate(context, fingerprint);
return String.format(context.getResources().getString(R.string.linked_id_generic_text), return String.format(context.getResources().getString(R.string.linked_id_generic_text),
cookie, "0x" + KeyFormattingUtils.convertFingerprintToHex(fingerprint).substring(24)); cookie, "0x" + KeyFormattingUtils.convertFingerprintToHex(fingerprint).substring(24));

View File

@@ -72,11 +72,6 @@ public class TwitterResource extends LinkedCookieResource {
} }
public static String generateText (Context context, byte[] fingerprint, int nonce) {
// nothing special here for now, might change this later
return LinkedCookieResource.generate(context, fingerprint, nonce);
}
@Override @Override
protected String fetchResource(OperationLog log, int indent) { protected String fetchResource(OperationLog log, int indent) {

View File

@@ -31,6 +31,7 @@ import android.net.Uri;
import android.text.TextUtils; import android.text.TextUtils;
import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Constants;
import org.sufficientlysecure.keychain.pgp.WrappedUserAttribute;
import org.sufficientlysecure.keychain.provider.KeychainContract.ApiAccounts; import org.sufficientlysecure.keychain.provider.KeychainContract.ApiAccounts;
import org.sufficientlysecure.keychain.provider.KeychainContract.ApiAllowedKeys; import org.sufficientlysecure.keychain.provider.KeychainContract.ApiAllowedKeys;
import org.sufficientlysecure.keychain.provider.KeychainContract.ApiApps; import org.sufficientlysecure.keychain.provider.KeychainContract.ApiApps;
@@ -508,7 +509,8 @@ public class KeychainProvider extends ContentProvider {
+ ", " + Tables.USER_PACKETS + "." + UserPackets.RANK; + ", " + Tables.USER_PACKETS + "." + UserPackets.RANK;
if (match == KEY_RING_LINKED_IDS) { if (match == KEY_RING_LINKED_IDS) {
qb.appendWhere(Tables.USER_PACKETS + "." + UserPackets.TYPE + " = 100"); qb.appendWhere(Tables.USER_PACKETS + "." + UserPackets.TYPE + " = "
+ WrappedUserAttribute.UAT_LINKED_ID);
} else { } else {
qb.appendWhere(Tables.USER_PACKETS + "." + UserPackets.TYPE + " IS NULL"); qb.appendWhere(Tables.USER_PACKETS + "." + UserPackets.TYPE + " IS NULL");
} }

View File

@@ -73,12 +73,11 @@ public class LinkedIdCreateDnsStep1Fragment extends Fragment {
return; return;
} }
int proofNonce = RawLinkedIdentity.generateNonce();
String proofText = DnsResource.generateText(getActivity(), String proofText = DnsResource.generateText(getActivity(),
mLinkedIdWizard.mFingerprint, proofNonce); mLinkedIdWizard.mFingerprint);
LinkedIdCreateDnsStep2Fragment frag = LinkedIdCreateDnsStep2Fragment frag =
LinkedIdCreateDnsStep2Fragment.newInstance(uri, proofNonce, proofText); LinkedIdCreateDnsStep2Fragment.newInstance(uri, proofText);
mLinkedIdWizard.loadFragment(null, frag, LinkedIdWizard.FRAG_ACTION_TO_RIGHT); mLinkedIdWizard.loadFragment(null, frag, LinkedIdWizard.FRAG_ACTION_TO_RIGHT);

View File

@@ -52,12 +52,11 @@ public class LinkedIdCreateDnsStep2Fragment extends LinkedIdCreateFinalFragment
String mResourceString; String mResourceString;
public static LinkedIdCreateDnsStep2Fragment newInstance public static LinkedIdCreateDnsStep2Fragment newInstance
(String uri, int proofNonce, String proofText) { (String uri, String proofText) {
LinkedIdCreateDnsStep2Fragment frag = new LinkedIdCreateDnsStep2Fragment(); LinkedIdCreateDnsStep2Fragment frag = new LinkedIdCreateDnsStep2Fragment();
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putInt(ARG_NONCE, proofNonce);
args.putString(DOMAIN, uri); args.putString(DOMAIN, uri);
args.putString(TEXT, proofText); args.putString(TEXT, proofText);
frag.setArguments(args); frag.setArguments(args);

View File

@@ -30,7 +30,6 @@ import org.sufficientlysecure.keychain.ui.util.Notify;
public abstract class LinkedIdCreateFinalFragment extends Fragment { public abstract class LinkedIdCreateFinalFragment extends Fragment {
public static final String ARG_NONCE = "nonce";
protected static final int REQUEST_CODE_PASSPHRASE = 0x00007008; protected static final int REQUEST_CODE_PASSPHRASE = 0x00007008;
protected LinkedIdWizard mLinkedIdWizard; protected LinkedIdWizard mLinkedIdWizard;
@@ -38,7 +37,6 @@ public abstract class LinkedIdCreateFinalFragment extends Fragment {
private ImageView mVerifyImage; private ImageView mVerifyImage;
private View mVerifyProgress; private View mVerifyProgress;
private TextView mVerifyStatus; private TextView mVerifyStatus;
private int mResourceNonce;
// This is a resource, set AFTER it has been verified // This is a resource, set AFTER it has been verified
LinkedCookieResource mVerifiedResource = null; LinkedCookieResource mVerifiedResource = null;
@@ -48,8 +46,6 @@ public abstract class LinkedIdCreateFinalFragment extends Fragment {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
mLinkedIdWizard = (LinkedIdWizard) getActivity(); mLinkedIdWizard = (LinkedIdWizard) getActivity();
mResourceNonce = getArguments().getInt(ARG_NONCE);
} }
protected abstract View newView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState); protected abstract View newView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState);
@@ -121,7 +117,7 @@ public abstract class LinkedIdCreateFinalFragment extends Fragment {
@Override @Override
protected LinkedVerifyResult doInBackground(Void... params) { protected LinkedVerifyResult doInBackground(Void... params) {
LinkedCookieResource resource = getResource(); LinkedCookieResource resource = getResource();
LinkedVerifyResult result = resource.verify(mLinkedIdWizard.mFingerprint, mResourceNonce); LinkedVerifyResult result = resource.verify(mLinkedIdWizard.mFingerprint);
if (result.success()) { if (result.success()) {
mVerifiedResource = resource; mVerifiedResource = resource;
} }
@@ -195,7 +191,7 @@ public abstract class LinkedIdCreateFinalFragment extends Fragment {
new SaveKeyringParcel(mLinkedIdWizard.mMasterKeyId, mLinkedIdWizard.mFingerprint); new SaveKeyringParcel(mLinkedIdWizard.mMasterKeyId, mLinkedIdWizard.mFingerprint);
WrappedUserAttribute ua = WrappedUserAttribute ua =
LinkedIdentity.fromResource(mVerifiedResource, mResourceNonce).toUserAttribute(); LinkedIdentity.fromResource(mVerifiedResource).toUserAttribute();
skp.mAddUserAttribute.add(ua); skp.mAddUserAttribute.add(ua);

View File

@@ -38,9 +38,6 @@ public class LinkedIdCreateHttpsStep1Fragment extends Fragment {
EditText mEditUri; EditText mEditUri;
/**
* Creates new instance of this fragment
*/
public static LinkedIdCreateHttpsStep1Fragment newInstance() { public static LinkedIdCreateHttpsStep1Fragment newInstance() {
LinkedIdCreateHttpsStep1Fragment frag = new LinkedIdCreateHttpsStep1Fragment(); LinkedIdCreateHttpsStep1Fragment frag = new LinkedIdCreateHttpsStep1Fragment();
@@ -72,12 +69,11 @@ public class LinkedIdCreateHttpsStep1Fragment extends Fragment {
return; return;
} }
int proofNonce = RawLinkedIdentity.generateNonce();
String proofText = GenericHttpsResource.generateText(getActivity(), String proofText = GenericHttpsResource.generateText(getActivity(),
mLinkedIdWizard.mFingerprint, proofNonce); mLinkedIdWizard.mFingerprint);
LinkedIdCreateHttpsStep2Fragment frag = LinkedIdCreateHttpsStep2Fragment frag =
LinkedIdCreateHttpsStep2Fragment.newInstance(uri, proofNonce, proofText); LinkedIdCreateHttpsStep2Fragment.newInstance(uri, proofText);
mLinkedIdWizard.loadFragment(null, frag, LinkedIdWizard.FRAG_ACTION_TO_RIGHT); mLinkedIdWizard.loadFragment(null, frag, LinkedIdWizard.FRAG_ACTION_TO_RIGHT);

View File

@@ -53,12 +53,11 @@ public class LinkedIdCreateHttpsStep2Fragment extends LinkedIdCreateFinalFragmen
String mResourceString; String mResourceString;
public static LinkedIdCreateHttpsStep2Fragment newInstance public static LinkedIdCreateHttpsStep2Fragment newInstance
(String uri, int proofNonce, String proofText) { (String uri, String proofText) {
LinkedIdCreateHttpsStep2Fragment frag = new LinkedIdCreateHttpsStep2Fragment(); LinkedIdCreateHttpsStep2Fragment frag = new LinkedIdCreateHttpsStep2Fragment();
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putInt(ARG_NONCE, proofNonce);
args.putString(ARG_URI, uri); args.putString(ARG_URI, uri);
args.putString(ARG_TEXT, proofText); args.putString(ARG_TEXT, proofText);
frag.setArguments(args); frag.setArguments(args);

View File

@@ -29,8 +29,6 @@ import android.widget.EditText;
import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.R;
import org.sufficientlysecure.keychain.pgp.linked.LinkedCookieResource; import org.sufficientlysecure.keychain.pgp.linked.LinkedCookieResource;
import org.sufficientlysecure.keychain.pgp.linked.LinkedIdentity;
import org.sufficientlysecure.keychain.pgp.linked.RawLinkedIdentity;
import org.sufficientlysecure.keychain.pgp.linked.resources.TwitterResource; import org.sufficientlysecure.keychain.pgp.linked.resources.TwitterResource;
import org.sufficientlysecure.keychain.ui.util.Notify; import org.sufficientlysecure.keychain.ui.util.Notify;
@@ -44,18 +42,14 @@ public class LinkedIdCreateTwitterStep2Fragment extends LinkedIdCreateFinalFragm
String mResourceHandle; String mResourceHandle;
String mResourceString; String mResourceString;
private int mNonce;
public static LinkedIdCreateTwitterStep2Fragment newInstance public static LinkedIdCreateTwitterStep2Fragment newInstance
(String handle) { (String handle) {
LinkedIdCreateTwitterStep2Fragment frag = new LinkedIdCreateTwitterStep2Fragment(); LinkedIdCreateTwitterStep2Fragment frag = new LinkedIdCreateTwitterStep2Fragment();
int proofNonce = RawLinkedIdentity.generateNonce();
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putString(ARG_HANDLE, handle); args.putString(ARG_HANDLE, handle);
args.putInt(ARG_NONCE, proofNonce);
frag.setArguments(args); frag.setArguments(args);
return frag; return frag;
@@ -65,9 +59,8 @@ public class LinkedIdCreateTwitterStep2Fragment extends LinkedIdCreateFinalFragm
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
mNonce = LinkedIdentity.generateNonce();
mResourceString = mResourceString =
TwitterResource.generate(getActivity(), mLinkedIdWizard.mFingerprint, mNonce); TwitterResource.generate(getActivity(), mLinkedIdWizard.mFingerprint);
mResourceHandle = getArguments().getString(ARG_HANDLE); mResourceHandle = getArguments().getString(ARG_HANDLE);

View File

@@ -4,7 +4,6 @@ import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;
import android.app.Activity; import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.database.Cursor; import android.database.Cursor;
@@ -24,7 +23,6 @@ import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import android.widget.ViewAnimator; import android.widget.ViewAnimator;
@@ -419,7 +417,7 @@ public class LinkedIdViewFragment extends Fragment implements
@Override @Override
protected LinkedVerifyResult doInBackground(Void... params) { protected LinkedVerifyResult doInBackground(Void... params) {
long timer = System.currentTimeMillis(); long timer = System.currentTimeMillis();
LinkedVerifyResult result = mLinkedResource.verify(mFingerprint, mLinkedId.mNonce); LinkedVerifyResult result = mLinkedResource.verify(mFingerprint);
// ux flow: this operation should take at last a second // ux flow: this operation should take at last a second
timer = System.currentTimeMillis() -timer; timer = System.currentTimeMillis() -timer;

View File

@@ -1168,8 +1168,6 @@
<string name="msg_lv_match_error">"No cookie found in resource!"</string> <string name="msg_lv_match_error">"No cookie found in resource!"</string>
<string name="msg_lv_fp_ok">"Fingerprint ok."</string> <string name="msg_lv_fp_ok">"Fingerprint ok."</string>
<string name="msg_lv_fp_error">"Fingerprint mismatch!"</string> <string name="msg_lv_fp_error">"Fingerprint mismatch!"</string>
<string name="msg_lv_nonce_ok">"Link verified!"</string>
<string name="msg_lv_nonce_error">"Nonce mismatch!"</string>
<string name="msg_lv_fetch">"Fetching URI '%s'"</string> <string name="msg_lv_fetch">"Fetching URI '%s'"</string>
<string name="msg_lv_fetch_redir">"Following redirect to '%s'"</string> <string name="msg_lv_fetch_redir">"Following redirect to '%s'"</string>