OTG: Rename smartcard -> security token
This commit is contained in:
@@ -136,8 +136,8 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenNfcActivity
|
||||
|
||||
private void obtainPassphraseIfRequired() {
|
||||
// obtain passphrase for this subkey
|
||||
if (mRequiredInput.mType != RequiredInputParcel.RequiredInputType.SMARTCARD_MOVE_KEY_TO_CARD
|
||||
&& mRequiredInput.mType != RequiredInputParcel.RequiredInputType.SMARTCARD_RESET_CARD) {
|
||||
if (mRequiredInput.mType != RequiredInputParcel.RequiredInputType.SECURITY_TOKEN_MOVE_KEY_TO_CARD
|
||||
&& mRequiredInput.mType != RequiredInputParcel.RequiredInputType.SECURITY_TOKEN_RESET_CARD) {
|
||||
obtainSecurityTokenPin(mRequiredInput);
|
||||
checkPinAvailability();
|
||||
} else {
|
||||
@@ -182,7 +182,7 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenNfcActivity
|
||||
protected void doSecurityTokenInBackground() throws IOException {
|
||||
|
||||
switch (mRequiredInput.mType) {
|
||||
case SMARTCARD_DECRYPT: {
|
||||
case SECURITY_TOKEN_DECRYPT: {
|
||||
for (int i = 0; i < mRequiredInput.mInputData.length; i++) {
|
||||
byte[] encryptedSessionKey = mRequiredInput.mInputData[i];
|
||||
byte[] decryptedSessionKey = mSecurityTokenHelper.decryptSessionKey(encryptedSessionKey);
|
||||
@@ -190,7 +190,7 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenNfcActivity
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMARTCARD_SIGN: {
|
||||
case SECURITY_TOKEN_SIGN: {
|
||||
mInputParcel.addSignatureTime(mRequiredInput.mSignatureTime);
|
||||
|
||||
for (int i = 0; i < mRequiredInput.mInputData.length; i++) {
|
||||
@@ -201,7 +201,7 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenNfcActivity
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SMARTCARD_MOVE_KEY_TO_CARD: {
|
||||
case SECURITY_TOKEN_MOVE_KEY_TO_CARD: {
|
||||
// TODO: assume PIN and Admin PIN to be default for this operation
|
||||
mSecurityTokenHelper.setPin(new Passphrase("123456"));
|
||||
mSecurityTokenHelper.setAdminPin(new Passphrase("12345678"));
|
||||
@@ -247,7 +247,7 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenNfcActivity
|
||||
|
||||
break;
|
||||
}
|
||||
case SMARTCARD_RESET_CARD: {
|
||||
case SECURITY_TOKEN_RESET_CARD: {
|
||||
mSecurityTokenHelper.resetAndWipeToken();
|
||||
|
||||
break;
|
||||
@@ -277,7 +277,7 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenNfcActivity
|
||||
protected Void doInBackground(Void... params) {
|
||||
// check all 200ms if Security Token has been taken away
|
||||
while (true) {
|
||||
if (isSmartcardConnected()) {
|
||||
if (isSecurityTokenConnected()) {
|
||||
try {
|
||||
Thread.sleep(200);
|
||||
} catch (InterruptedException ignored) {
|
||||
|
||||
@@ -155,7 +155,7 @@ public abstract class BaseSecurityTokenNfcActivity extends BaseActivity
|
||||
}
|
||||
|
||||
public void securityTokenDiscovered(final Transport transport) {
|
||||
// Actual Smartcard operations are executed in doInBackground to not block the UI thread
|
||||
// Actual Security Token operations are executed in doInBackground to not block the UI thread
|
||||
if (!mTagHandlingEnabled)
|
||||
return;
|
||||
new AsyncTask<Void, Void, IOException>() {
|
||||
@@ -168,7 +168,7 @@ public abstract class BaseSecurityTokenNfcActivity extends BaseActivity
|
||||
@Override
|
||||
protected IOException doInBackground(Void... params) {
|
||||
try {
|
||||
handleSmartcard(transport);
|
||||
handleSecurityToken(transport);
|
||||
} catch (IOException e) {
|
||||
return e;
|
||||
}
|
||||
@@ -181,7 +181,7 @@ public abstract class BaseSecurityTokenNfcActivity extends BaseActivity
|
||||
super.onPostExecute(exception);
|
||||
|
||||
if (exception != null) {
|
||||
handleSmartcardError(exception);
|
||||
handleSecurityTokenError(exception);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ public abstract class BaseSecurityTokenNfcActivity extends BaseActivity
|
||||
mTagDispatcher.interceptIntent(intent);
|
||||
}
|
||||
|
||||
private void handleSmartcardError(IOException e) {
|
||||
private void handleSecurityTokenError(IOException e) {
|
||||
|
||||
if (e instanceof TagLostException) {
|
||||
onSecurityTokenError(getString(R.string.security_token_error_tag_lost));
|
||||
@@ -403,7 +403,7 @@ public abstract class BaseSecurityTokenNfcActivity extends BaseActivity
|
||||
}
|
||||
}
|
||||
|
||||
protected void handleSmartcard(Transport transport) throws IOException {
|
||||
protected void handleSecurityToken(Transport transport) throws IOException {
|
||||
// Don't reconnect if device was already connected
|
||||
if (!(mSecurityTokenHelper.isPersistentConnectionAllowed()
|
||||
&& mSecurityTokenHelper.isConnected()
|
||||
@@ -414,7 +414,7 @@ public abstract class BaseSecurityTokenNfcActivity extends BaseActivity
|
||||
doSecurityTokenInBackground();
|
||||
}
|
||||
|
||||
public boolean isSmartcardConnected() {
|
||||
public boolean isSecurityTokenConnected() {
|
||||
return mSecurityTokenHelper.isConnected();
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@ public abstract class BaseSecurityTokenNfcActivity extends BaseActivity
|
||||
}
|
||||
|
||||
/**
|
||||
* Run smartcard routines if last used token is connected and supports
|
||||
* Run Security Token routines if last used token is connected and supports
|
||||
* persistent connections
|
||||
*/
|
||||
public void checkDeviceConnection() {
|
||||
|
||||
@@ -130,9 +130,9 @@ public class CryptoOperationHelper<T extends Parcelable, S extends OperationResu
|
||||
|
||||
switch (requiredInput.mType) {
|
||||
// always use CryptoOperationHelper.startActivityForResult!
|
||||
case SMARTCARD_MOVE_KEY_TO_CARD:
|
||||
case SMARTCARD_DECRYPT:
|
||||
case SMARTCARD_SIGN: {
|
||||
case SECURITY_TOKEN_MOVE_KEY_TO_CARD:
|
||||
case SECURITY_TOKEN_DECRYPT:
|
||||
case SECURITY_TOKEN_SIGN: {
|
||||
Intent intent = new Intent(activity, SecurityTokenOperationActivity.class);
|
||||
intent.putExtra(SecurityTokenOperationActivity.EXTRA_REQUIRED_INPUT, requiredInput);
|
||||
intent.putExtra(SecurityTokenOperationActivity.EXTRA_CRYPTO_INPUT, cryptoInputParcel);
|
||||
|
||||
Reference in New Issue
Block a user