rename methods that do io to "read*" instead of "get*"
This commit is contained in:
@@ -20,7 +20,6 @@ package org.sufficientlysecure.keychain.securitytoken;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.List;
|
||||
|
||||
import android.content.Context;
|
||||
@@ -153,7 +152,7 @@ public class SecurityTokenConnection {
|
||||
}
|
||||
|
||||
public void refreshConnectionCapabilities() throws IOException {
|
||||
byte[] rawOpenPgpCapabilities = getData(0x00, 0x6E);
|
||||
byte[] rawOpenPgpCapabilities = readData(0x00, 0x6E);
|
||||
|
||||
OpenPgpCapabilities openPgpCapabilities = OpenPgpCapabilities.fromBytes(rawOpenPgpCapabilities);
|
||||
setConnectionCapabilities(openPgpCapabilities);
|
||||
@@ -360,7 +359,7 @@ public class SecurityTokenConnection {
|
||||
|
||||
// endregion
|
||||
|
||||
private byte[] getData(int p1, int p2) throws IOException {
|
||||
private byte[] readData(int p1, int p2) throws IOException {
|
||||
ResponseApdu response = communicate(commandFactory.createGetDataCommand(p1, p2));
|
||||
if (!response.isSuccess()) {
|
||||
throw new CardException("Failed to get pw status bytes", response.getSw());
|
||||
@@ -369,32 +368,31 @@ public class SecurityTokenConnection {
|
||||
}
|
||||
|
||||
|
||||
public String getUrl() throws IOException {
|
||||
byte[] data = getData(0x5F, 0x50);
|
||||
private String readUrl() throws IOException {
|
||||
byte[] data = readData(0x5F, 0x50);
|
||||
return new String(data).trim();
|
||||
}
|
||||
|
||||
public byte[] getUserId() throws IOException {
|
||||
return getData(0x00, 0x65);
|
||||
private byte[] readUserId() throws IOException {
|
||||
return readData(0x00, 0x65);
|
||||
}
|
||||
|
||||
public SecurityTokenInfo getTokenInfo() throws IOException {
|
||||
public SecurityTokenInfo readTokenInfo() throws IOException {
|
||||
byte[][] fingerprints = new byte[3][];
|
||||
fingerprints[0] = openPgpCapabilities.getFingerprintSign();
|
||||
fingerprints[1] = openPgpCapabilities.getFingerprintEncrypt();
|
||||
fingerprints[2] = openPgpCapabilities.getFingerprintAuth();
|
||||
|
||||
byte[] aid = openPgpCapabilities.getAid();
|
||||
String userId = parseHolderName(getUserId());
|
||||
String url = getUrl();
|
||||
String userId = parseHolderName(readUserId());
|
||||
String url = readUrl();
|
||||
byte[] pwInfo = openPgpCapabilities.getPwStatusBytes();
|
||||
boolean hasLifeCycleManagement = cardCapabilities.hasLifeCycleManagement();
|
||||
|
||||
TransportType transportType = transport.getTransportType();
|
||||
|
||||
return SecurityTokenInfo
|
||||
.create(transportType, tokenType, fingerprints, aid, userId, url, pwInfo[4], pwInfo[6],
|
||||
hasLifeCycleManagement);
|
||||
return SecurityTokenInfo.create(transportType, tokenType, fingerprints, aid, userId, url, pwInfo[4], pwInfo[6],
|
||||
hasLifeCycleManagement);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ public class CreateKeyActivity extends BaseSecurityTokenActivity {
|
||||
return;
|
||||
}
|
||||
|
||||
tokenInfo = stConnection.getTokenInfo();
|
||||
tokenInfo = stConnection.readTokenInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -144,7 +144,7 @@ public class SecurityTokenChangePinOperationActivity extends BaseSecurityTokenAc
|
||||
Passphrase adminPin = new Passphrase(changePinInput.getAdminPin());
|
||||
ModifyPinTokenOp.create(stConnection, adminPin).modifyPw1Pin(changePinInput.getNewPin().getBytes());
|
||||
|
||||
resultTokenInfo = stConnection.getTokenInfo();
|
||||
resultTokenInfo = stConnection.readTokenInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -39,7 +39,6 @@ import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKey;
|
||||
import org.sufficientlysecure.keychain.pgp.CanonicalizedSecretKeyRing;
|
||||
import org.sufficientlysecure.keychain.provider.KeyRepository;
|
||||
import org.sufficientlysecure.keychain.provider.KeychainContract;
|
||||
import org.sufficientlysecure.keychain.securitytoken.KeyType;
|
||||
import org.sufficientlysecure.keychain.securitytoken.operations.ModifyPinTokenOp;
|
||||
import org.sufficientlysecure.keychain.securitytoken.SecurityTokenConnection;
|
||||
import org.sufficientlysecure.keychain.securitytoken.SecurityTokenInfo;
|
||||
@@ -305,7 +304,7 @@ public class SecurityTokenOperationActivity extends BaseSecurityTokenActivity {
|
||||
}
|
||||
case SECURITY_TOKEN_RESET_CARD: {
|
||||
ResetAndWipeTokenOp.create(stConnection).resetAndWipeToken();
|
||||
mResultTokenInfo = stConnection.getTokenInfo();
|
||||
mResultTokenInfo = stConnection.readTokenInfo();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ public abstract class BaseSecurityTokenActivity extends BaseActivity
|
||||
* Override to implement SecurityToken operations (background thread)
|
||||
*/
|
||||
protected void doSecurityTokenInBackground(SecurityTokenConnection stConnection) throws IOException {
|
||||
tokenInfo = stConnection.getTokenInfo();
|
||||
tokenInfo = stConnection.readTokenInfo();
|
||||
Log.d(Constants.TAG, "Security Token: " + tokenInfo);
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ public abstract class BaseSecurityTokenActivity extends BaseActivity
|
||||
|
||||
SecurityTokenInfo tokeninfo = null;
|
||||
try {
|
||||
tokeninfo = stConnection.getTokenInfo();
|
||||
tokeninfo = stConnection.readTokenInfo();
|
||||
} catch (IOException e2) {
|
||||
// don't care
|
||||
}
|
||||
@@ -278,7 +278,7 @@ public abstract class BaseSecurityTokenActivity extends BaseActivity
|
||||
case 0x6982: {
|
||||
SecurityTokenInfo tokeninfo = null;
|
||||
try {
|
||||
tokeninfo = stConnection.getTokenInfo();
|
||||
tokeninfo = stConnection.readTokenInfo();
|
||||
} catch (IOException e2) {
|
||||
// don't care
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user